curl --request POST \
--url https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/ \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"customer_id": "<string>",
"coupon_code": "<string>",
"status": "validated",
"remaining_usages": 123,
"total_usages_allowed": 123,
"validated_at": "2023-11-07T05:31:56Z",
"new_balance": 123,
"new_z_balance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Validate (use) a coupon
Atomically mark a coupon as used, creating an activity record. Prevents double-usage via select_for_update. Auto-expires coupons past valid_until.
curl --request POST \
--url https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/ \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zupy.com/api/v2/customers/{id}/coupons/{coupon_id}/validate/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"customer_id": "<string>",
"coupon_code": "<string>",
"status": "validated",
"remaining_usages": 123,
"total_usages_allowed": 123,
"validated_at": "2023-11-07T05:31:56Z",
"new_balance": 123,
"new_z_balance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Authorizations
Per-company partner API key (zupy_pk_…). Validated by Zupy against the company integration key hash (Story 14.x); send it on every request as the X-API-Key header. Scoped read-write to the owning company's data.
Headers
OTP session token returned by POST /auth/verify-otp/. REQUIRED when the company's integration OTP policy enables it (require_otp_for_redemption for redeem, require_otp_for_coupon_usage for validate). Omitting it returns 403 with code "otp-required".
Path Parameters
Accepts EITHER the RewardRedemption KSUID (e.g. 16a33f27fbbc1801d63d56d2027) OR the customer-facing coupon_code (e.g. CZ-914F15F3 or CP-LEGACY01). Lookup by code is case-insensitive — both CZ-914F15F3 and cz-914f15f3 resolve to the same coupon. The response always echoes the canonical upper-case form.
Unique identifier for this customer.
Response
Coupon validation result with current status, remaining usages, and a settled-state snapshot of the customer's balances. Story W.x: response now mirrors RewardRedeemResponse — partners get customer_id + new_balance + new_z_balance without a follow-up GET.
Customer KSUID (matches the {id} in the URL path).
validated Customer's points balance after validation. Validate itself debits 0 pts (points were spent at redemption time); this is the current balance so partners don't need an extra GET /customers/{id}/points/ to confirm settled state.
Customer's current Z$ balance after validation, as a stringified Decimal with 6 places (matches the format used everywhere else in the API).