{"openapi":"3.1.0","info":{"title":"Capital Quality Wallet API","version":"2026-09-01","description":"Issue and update Apple Wallet and Google Wallet loyalty passes, manage customers, award and redeem points, and receive signed webhooks. All mutations accept an Idempotency-Key; loyalty mutations require one. Money is expressed in integer minor units.","contact":{"name":"Developer support","url":"https://wallet.capitalquality.net/docs"}},"servers":[{"url":"https://wallet.capitalquality.net/api/v1","description":"Live and sandbox (the credential selects the environment)"}],"tags":[{"name":"Authentication"},{"name":"Customers"},{"name":"Loyalty"},{"name":"POS"},{"name":"Rewards"},{"name":"Promotions"},{"name":"Passes"},{"name":"Webhooks"},{"name":"Account"}],"paths":{"/oauth/token":{"post":{"operationId":"createAccessToken","summary":"Exchange OAuth 2.0 client credentials for an access token","description":"Send client_id and client_secret via HTTP Basic auth (preferred) or form/JSON body. Tokens are valid for 1 hour.","tags":["Authentication"],"security":[],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"grant_type":{"type":"string"},"client_id":{"type":"string","maxLength":100},"client_secret":{"type":"string","maxLength":200},"scope":{"type":"string","maxLength":1000}},"required":["grant_type"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string"},"token_type":{"type":"string","const":"Bearer"},"expires_in":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"scope":{"type":"string"}},"required":["access_token","token_type","expires_in","scope"],"additionalProperties":false}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/me":{"get":{"operationId":"getCredential","summary":"Describe the calling credential (tenant, environment, scopes)","tags":["Authentication"],"security":[{"oauth2":[]},{"apiKey":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/health":{"get":{"operationId":"getHealth","summary":"Liveness and dependency health (no authentication)","tags":["Account"],"security":[],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/openapi.json":{"get":{"operationId":"getOpenApi","summary":"This API’s OpenAPI 3.1 document","tags":["Account"],"security":[],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tenant":{"get":{"operationId":"getTenant","summary":"The client account the credential belongs to","tags":["Account"],"security":[{"oauth2":[]},{"apiKey":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/usage":{"get":{"operationId":"getUsage","summary":"Current billing-period usage against plan limits","tags":["Account"],"security":[{"oauth2":["usage:read"]},{"apiKey":[]}],"x-required-scopes":["usage:read"],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/locations":{"get":{"operationId":"listLocations","summary":"List branches","tags":["Account"],"security":[{"oauth2":["programs:read"]},{"apiKey":[]}],"x-required-scopes":["programs:read"],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Location"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createLocation","summary":"Create a branch","tags":["Account"],"security":[{"oauth2":["customers:write"]},{"apiKey":[]}],"x-required-scopes":["customers:write"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[A-Za-z0-9_-]+$"},"name":{"type":"string","minLength":1,"maxLength":120},"address":{"type":"object","properties":{"line1":{"type":"string","maxLength":200},"line2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":100},"region":{"type":"string","maxLength":100},"postal_code":{"type":"string","maxLength":20},"country":{"type":"string","minLength":2,"maxLength":2}}},"latitude":{"type":"number","minimum":-90,"maximum":90},"longitude":{"type":"number","minimum":-180,"maximum":180},"phone":{"type":"string","maxLength":40}},"required":["code","name"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Location"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/locations/{id}":{"get":{"operationId":"getLocation","summary":"Retrieve a branch","tags":["Account"],"security":[{"oauth2":["programs:read"]},{"apiKey":[]}],"x-required-scopes":["programs:read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Location"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateLocation","summary":"Update a branch","tags":["Account"],"security":[{"oauth2":["customers:write"]},{"apiKey":[]}],"x-required-scopes":["customers:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[A-Za-z0-9_-]+$"},"name":{"type":"string","minLength":1,"maxLength":120},"address":{"type":"object","properties":{"line1":{"type":"string","maxLength":200},"line2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":100},"region":{"type":"string","maxLength":100},"postal_code":{"type":"string","maxLength":20},"country":{"type":"string","minLength":2,"maxLength":2}}},"latitude":{"type":"number","minimum":-90,"maximum":90},"longitude":{"type":"number","minimum":-180,"maximum":180},"phone":{"type":"string","maxLength":40}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Location"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers":{"get":{"operationId":"listCustomers","summary":"List and filter customers","tags":["Customers"],"security":[{"oauth2":["customers:read"]},{"apiKey":[]}],"x-required-scopes":["customers:read"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":25,"type":"integer","minimum":1,"maximum":100}},{"name":"starting_after","in":"query","required":false,"schema":{"type":"string","maxLength":64}},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":120}},{"name":"email","in":"query","required":false,"schema":{"type":"string","maxLength":254}},{"name":"phone","in":"query","required":false,"schema":{"type":"string","maxLength":20}},{"name":"external_id","in":"query","required":false,"schema":{"type":"string","maxLength":128}},{"name":"tag","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","merged","anonymized"]}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createCustomer","summary":"Create a customer","description":"Returns 409 customer_exists with details.existing_id if the email, phone or external_id is taken.","tags":["Customers"],"security":[{"oauth2":["customers:write"]},{"apiKey":[]}],"x-required-scopes":["customers:write"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"external_id":{"type":"string","minLength":1,"maxLength":128},"email":{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string","pattern":"^\\+[1-9]\\d{6,14}$"},"first_name":{"type":"string","maxLength":80},"last_name":{"type":"string","maxLength":80},"birth_month":{"type":"integer","minimum":1,"maximum":12},"birth_day":{"type":"integer","minimum":1,"maximum":31},"locale":{"type":"string","minLength":2,"maxLength":10},"marketing_email":{"type":"boolean"},"marketing_sms":{"type":"boolean"},"tags":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":40}},"metadata":{"type":"object","propertyNames":{"type":"string","maxLength":40},"additionalProperties":{"type":"string","maxLength":500}}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers/upsert":{"post":{"operationId":"upsertCustomer","summary":"Create or update a customer (match on external_id → email → phone)","tags":["Customers"],"security":[{"oauth2":["customers:write"]},{"apiKey":[]}],"x-required-scopes":["customers:write"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"external_id":{"type":"string","minLength":1,"maxLength":128},"email":{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string","pattern":"^\\+[1-9]\\d{6,14}$"},"first_name":{"type":"string","maxLength":80},"last_name":{"type":"string","maxLength":80},"birth_month":{"type":"integer","minimum":1,"maximum":12},"birth_day":{"type":"integer","minimum":1,"maximum":31},"locale":{"type":"string","minLength":2,"maxLength":10},"marketing_email":{"type":"boolean"},"marketing_sms":{"type":"boolean"},"tags":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":40}},"metadata":{"type":"object","propertyNames":{"type":"string","maxLength":40},"additionalProperties":{"type":"string","maxLength":500}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers/lookup":{"get":{"operationId":"lookupCustomer","summary":"Find a customer by scanned barcode, member number, phone, email or external id","tags":["Customers"],"security":[{"oauth2":["customers:read"]},{"apiKey":[]}],"x-required-scopes":["customers:read"],"parameters":[{"name":"barcode","in":"query","required":false,"schema":{"type":"string","maxLength":128}},{"name":"member_number","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"phone","in":"query","required":false,"schema":{"type":"string","maxLength":20}},{"name":"email","in":"query","required":false,"schema":{"type":"string","maxLength":254}},{"name":"external_id","in":"query","required":false,"schema":{"type":"string","maxLength":128}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers/{id}":{"get":{"operationId":"getCustomer","summary":"Retrieve a customer with loyalty accounts","tags":["Customers"],"security":[{"oauth2":["customers:read"]},{"apiKey":[]}],"x-required-scopes":["customers:read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateCustomer","summary":"Update a customer","tags":["Customers"],"security":[{"oauth2":["customers:write"]},{"apiKey":[]}],"x-required-scopes":["customers:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"external_id":{"type":"string","minLength":1,"maxLength":128},"email":{"anyOf":[{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","pattern":"^\\+[1-9]\\d{6,14}$"},{"type":"null"}]},"first_name":{"type":"string","maxLength":80},"last_name":{"type":"string","maxLength":80},"birth_month":{"type":"integer","minimum":1,"maximum":12},"birth_day":{"type":"integer","minimum":1,"maximum":31},"locale":{"type":"string","minLength":2,"maxLength":10},"marketing_email":{"type":"boolean"},"marketing_sms":{"type":"boolean"},"tags":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":40}},"metadata":{"type":"object","propertyNames":{"type":"string","maxLength":40},"additionalProperties":{"type":"string","maxLength":500}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteCustomer","summary":"Erase a customer (GDPR/CCPA anonymization)","description":"Irreversibly removes personal data, voids wallet passes and closes accounts. Ledger history is kept with the pseudonymous member number.","tags":["Customers"],"security":[{"oauth2":["customers:write"]},{"apiKey":[]}],"x-required-scopes":["customers:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers/{id}/consents":{"get":{"operationId":"listConsents","summary":"Consent evidence log (append-only)","tags":["Customers"],"security":[{"oauth2":["customers:read"]},{"apiKey":[]}],"x-required-scopes":["customers:read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"recordConsent","summary":"Record a consent decision","tags":["Customers"],"security":[{"oauth2":["customers:write"]},{"apiKey":[]}],"x-required-scopes":["customers:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"purpose":{"type":"string","enum":["marketing_email","marketing_sms","wallet_notifications","terms","privacy"]},"granted":{"type":"boolean"},"text_version":{"type":"string","maxLength":40}},"required":["purpose","granted"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/enrollments":{"post":{"operationId":"createEnrollment","summary":"Enroll a customer in a program and issue a wallet pass","description":"Creates the customer if `customer` is given, opens the loyalty account (welcome/referral bonuses apply) and returns Apple/Google install links.","tags":["Customers"],"security":[{"oauth2":["customers:write"]},{"apiKey":[]}],"x-required-scopes":["customers:write"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"program_id":{"type":"string","maxLength":64},"customer_id":{"type":"string","maxLength":64},"customer":{"type":"object","properties":{"external_id":{"type":"string","minLength":1,"maxLength":128},"email":{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string","pattern":"^\\+[1-9]\\d{6,14}$"},"first_name":{"type":"string","maxLength":80},"last_name":{"type":"string","maxLength":80},"birth_month":{"type":"integer","minimum":1,"maximum":12},"birth_day":{"type":"integer","minimum":1,"maximum":31},"locale":{"type":"string","minLength":2,"maxLength":10},"marketing_email":{"type":"boolean"},"marketing_sms":{"type":"boolean"},"tags":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":40}},"metadata":{"type":"object","propertyNames":{"type":"string","maxLength":40},"additionalProperties":{"type":"string","maxLength":500}}}},"referral_code":{"type":"string","maxLength":40}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/programs":{"get":{"operationId":"listPrograms","summary":"List loyalty programs and their rules","tags":["Loyalty"],"security":[{"oauth2":["programs:read"]},{"apiKey":[]}],"x-required-scopes":["programs:read"],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Program"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/programs/{id}":{"get":{"operationId":"getProgram","summary":"Retrieve a program","tags":["Loyalty"],"security":[{"oauth2":["programs:read"]},{"apiKey":[]}],"x-required-scopes":["programs:read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Program"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/programs/{id}/quote":{"post":{"operationId":"quoteEarn","summary":"Preview points for a basket without writing anything","tags":["Loyalty"],"security":[{"oauth2":["programs:read"]},{"apiKey":[]}],"x-required-scopes":["programs:read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"integer","minimum":0,"maximum":1000000000},"currency":{"type":"string","minLength":3,"maxLength":3},"location_id":{"type":"string","maxLength":64},"items":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"sku":{"type":"string","maxLength":64},"category":{"type":"string","maxLength":64},"quantity":{"default":1,"type":"integer","minimum":1,"maximum":10000},"unit_amount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["unit_amount"]}},"occurred_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"note":{"type":"string","maxLength":500},"account_id":{"type":"string","maxLength":64}},"required":["amount","currency"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/loyalty-accounts/{id}":{"get":{"operationId":"getLoyaltyAccount","summary":"Balance, stamps and tier of a loyalty account","tags":["Loyalty"],"security":[{"oauth2":["loyalty:read"]},{"apiKey":[]}],"x-required-scopes":["loyalty:read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoyaltyAccount"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/loyalty-accounts/{id}/transactions":{"get":{"operationId":"listTransactions","summary":"Ledger history of an account (newest first)","tags":["Loyalty"],"security":[{"oauth2":["loyalty:read"]},{"apiKey":[]}],"x-required-scopes":["loyalty:read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":25,"type":"integer","minimum":1,"maximum":100}},{"name":"starting_after","in":"query","required":false,"schema":{"type":"string","maxLength":64}},{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["earn","bonus","redeem","adjust","reversal","expire","transfer"]}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/LoyaltyTransaction"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/loyalty-accounts/{id}/earn":{"post":{"operationId":"earnPoints","summary":"Award points/stamps for a purchase","description":"Runs the program rules (rates, tiers, campaigns, caps). external_transaction_id is de-duplicated per credential; retries must reuse the Idempotency-Key.","tags":["Loyalty"],"security":[{"oauth2":["loyalty:write"]},{"apiKey":[]}],"x-required-scopes":["loyalty:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"integer","minimum":0,"maximum":1000000000},"currency":{"type":"string","minLength":3,"maxLength":3},"location_id":{"type":"string","maxLength":64},"external_transaction_id":{"type":"string","minLength":1,"maxLength":128},"items":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"sku":{"type":"string","maxLength":64},"category":{"type":"string","maxLength":64},"quantity":{"default":1,"type":"integer","minimum":1,"maximum":10000},"unit_amount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["unit_amount"]}},"occurred_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"note":{"type":"string","maxLength":500}},"required":["amount","currency"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EarnResult"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/loyalty-accounts/{id}/redeem":{"post":{"operationId":"redeem","summary":"Redeem points or a catalog reward","tags":["Loyalty"],"security":[{"oauth2":["loyalty:write"]},{"apiKey":[]}],"x-required-scopes":["loyalty:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"points":{"type":"integer","exclusiveMinimum":0,"maximum":100000000},"reward_id":{"type":"string","maxLength":64},"location_id":{"type":"string","maxLength":64},"external_transaction_id":{"type":"string","minLength":1,"maxLength":128},"note":{"type":"string","maxLength":500}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/loyalty-accounts/{id}/adjust":{"post":{"operationId":"adjustPoints","summary":"Manual adjustment (202 when approval is required)","tags":["Loyalty"],"security":[{"oauth2":["loyalty:write"]},{"apiKey":[]}],"x-required-scopes":["loyalty:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"points":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"type":"string","minLength":3,"maxLength":500},"location_id":{"type":"string","maxLength":64}},"required":["reason"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/loyalty-accounts/{id}/rewards":{"get":{"operationId":"listAccountRewards","summary":"Vouchers issued to an account","tags":["Rewards"],"security":[{"oauth2":["rewards:read"]},{"apiKey":[]}],"x-required-scopes":["rewards:read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/IssuedReward"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/transactions/{id}":{"get":{"operationId":"getTransaction","summary":"Retrieve a ledger transaction","tags":["Loyalty"],"security":[{"oauth2":["loyalty:read"]},{"apiKey":[]}],"x-required-scopes":["loyalty:read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoyaltyTransaction"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/transactions/{id}/reverse":{"post":{"operationId":"reverseTransaction","summary":"Reverse an earn, redemption or adjustment (once)","tags":["Loyalty"],"security":[{"oauth2":["loyalty:write"]},{"apiKey":[]}],"x-required-scopes":["loyalty:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":3,"maxLength":500}},"required":["reason"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pos/sales":{"post":{"operationId":"recordPosSale","summary":"One-call POS integration: find/create customer, award points, update pass, return balance","tags":["POS"],"security":[{"oauth2":["loyalty:write","customers:read"]},{"apiKey":[]}],"x-required-scopes":["loyalty:write","customers:read"],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"program_id":{"type":"string","maxLength":64},"customer":{"type":"object","properties":{"id":{"type":"string","maxLength":64},"lookup":{"type":"object","properties":{"barcode":{"type":"string","maxLength":128},"member_number":{"type":"string","maxLength":40},"phone":{"type":"string","maxLength":20},"email":{"type":"string","maxLength":254},"external_id":{"type":"string","maxLength":128}}},"create_if_missing":{"default":false,"type":"boolean"},"profile":{"type":"object","properties":{"external_id":{"type":"string","minLength":1,"maxLength":128},"email":{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string","pattern":"^\\+[1-9]\\d{6,14}$"},"first_name":{"type":"string","maxLength":80},"last_name":{"type":"string","maxLength":80},"birth_month":{"type":"integer","minimum":1,"maximum":12},"birth_day":{"type":"integer","minimum":1,"maximum":31},"locale":{"type":"string","minLength":2,"maxLength":10},"marketing_email":{"type":"boolean"},"marketing_sms":{"type":"boolean"},"tags":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":40}},"metadata":{"type":"object","propertyNames":{"type":"string","maxLength":40},"additionalProperties":{"type":"string","maxLength":500}}}}}},"sale":{"type":"object","properties":{"amount":{"type":"integer","minimum":0,"maximum":1000000000},"currency":{"type":"string","minLength":3,"maxLength":3},"location_id":{"type":"string","maxLength":64},"items":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"sku":{"type":"string","maxLength":64},"category":{"type":"string","maxLength":64},"quantity":{"default":1,"type":"integer","minimum":1,"maximum":10000},"unit_amount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["unit_amount"]}},"occurred_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"note":{"type":"string","maxLength":500},"external_id":{"type":"string","minLength":1,"maxLength":128}},"required":["amount","currency","external_id"]}},"required":["customer","sale"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PosSaleResult"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/rewards":{"get":{"operationId":"listRewards","summary":"Reward catalog","tags":["Rewards"],"security":[{"oauth2":["rewards:read"]},{"apiKey":[]}],"x-required-scopes":["rewards:read"],"parameters":[{"name":"program_id","in":"query","required":false,"schema":{"type":"string","maxLength":64}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Reward"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createReward","summary":"Add a reward to the catalog","tags":["Rewards"],"security":[{"oauth2":["rewards:write"]},{"apiKey":[]}],"x-required-scopes":["rewards:write"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"program_id":{"type":"string","maxLength":64},"name":{"type":"string","minLength":2,"maxLength":80},"description":{"type":"string","maxLength":500},"kind":{"default":"free_item","type":"string","enum":["free_item","amount_off","percent_off","custom"]},"cost_points":{"type":"integer","exclusiveMinimum":0,"maximum":100000000},"cost_stamps":{"type":"integer","exclusiveMinimum":0,"maximum":50},"value":{"type":"integer","minimum":0,"maximum":9007199254740991},"percent_off":{"type":"integer","minimum":1,"maximum":100},"valid_days":{"type":"integer","minimum":1,"maximum":3650},"max_per_customer":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"auto_issue":{"default":false,"type":"boolean"}},"required":["program_id","name"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Reward"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/rewards/{id}":{"patch":{"operationId":"updateReward","summary":"Update or archive a reward","tags":["Rewards"],"security":[{"oauth2":["rewards:write"]},{"apiKey":[]}],"x-required-scopes":["rewards:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":80},"description":{"type":"string","maxLength":500},"cost_points":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"cost_stamps":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"value":{"type":"integer","minimum":0,"maximum":9007199254740991},"valid_days":{"type":"integer","minimum":1,"maximum":9007199254740991},"max_per_customer":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"status":{"type":"string","enum":["active","archived"]}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Reward"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/issued-rewards/{id}/redeem":{"post":{"operationId":"redeemIssuedReward","summary":"Redeem an issued voucher at the counter","tags":["Rewards"],"security":[{"oauth2":["rewards:write"]},{"apiKey":[]}],"x-required-scopes":["rewards:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"location_id":{"type":"string","maxLength":64}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssuedReward"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/promotions":{"get":{"operationId":"listPromotions","summary":"List campaigns and promotions","tags":["Promotions"],"security":[{"oauth2":["promotions:read"]},{"apiKey":[]}],"x-required-scopes":["promotions:read"],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["draft","scheduled","active","paused","ended"]}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Promotion"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createPromotion","summary":"Create a coupon, offer, bonus-points or event promotion","tags":["Promotions"],"security":[{"oauth2":["promotions:write"]},{"apiKey":[]}],"x-required-scopes":["promotions:write"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":120},"description":{"type":"string","maxLength":1000},"kind":{"type":"string","enum":["coupon","offer","bonus_points","event"]},"program_id":{"type":"string","maxLength":64},"starts_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"ends_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"targeting":{"default":{},"type":"object","properties":{"tags":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":40}},"tiers":{"maxItems":10,"type":"array","items":{"type":"string","maxLength":32}},"segment_id":{"type":"string","maxLength":64},"require_consent":{"type":"boolean"}}},"location_ids":{"default":[],"maxItems":200,"type":"array","items":{"type":"string","maxLength":64}},"offer":{"default":{},"type":"object","properties":{"percent_off":{"type":"integer","minimum":1,"maximum":100},"amount_off":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"free_item":{"type":"string","maxLength":120},"points_multiplier":{"type":"number","minimum":1,"maximum":20},"bonus_points":{"type":"integer","exclusiveMinimum":0,"maximum":1000000},"min_purchase":{"type":"integer","minimum":0,"maximum":9007199254740991},"categories":{"maxItems":50,"type":"array","items":{"type":"string","maxLength":64}}}},"code_type":{"default":"none","type":"string","enum":["none","shared","unique"]},"shared_code":{"type":"string","pattern":"^[A-Z0-9-]{3,32}$"},"max_redemptions":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"max_per_customer":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"pass_template_id":{"type":"string","maxLength":64},"update_passes":{"default":false,"type":"boolean"}},"required":["name","kind"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Promotion"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/promotions/{id}":{"get":{"operationId":"getPromotion","summary":"Retrieve a promotion with performance counters","tags":["Promotions"],"security":[{"oauth2":["promotions:read"]},{"apiKey":[]}],"x-required-scopes":["promotions:read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"transitionPromotion","summary":"Schedule, activate, pause or end a promotion","tags":["Promotions"],"security":[{"oauth2":["promotions:write"]},{"apiKey":[]}],"x-required-scopes":["promotions:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["schedule","activate","pause","end"]}},"required":["action"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Promotion"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/promotions/{id}/codes":{"post":{"operationId":"generateCodes","summary":"Generate unique single-use coupon codes","tags":["Promotions"],"security":[{"oauth2":["promotions:write"]},{"apiKey":[]}],"x-required-scopes":["promotions:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"count":{"default":1,"type":"integer","minimum":1,"maximum":10000},"prefix":{"type":"string","pattern":"^[A-Z0-9]{1,6}$"},"customer_ids":{"maxItems":10000,"type":"array","items":{"type":"string"}}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/coupons/validate":{"post":{"operationId":"validateCoupon","summary":"Check a coupon at checkout (no side effects)","tags":["Promotions"],"security":[{"oauth2":["promotions:read"]},{"apiKey":[]}],"x-required-scopes":["promotions:read"],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":3,"maxLength":64},"customer_id":{"type":"string","maxLength":64},"location_id":{"type":"string","maxLength":64},"amount":{"type":"integer","minimum":0,"maximum":9007199254740991},"external_id":{"type":"string","maxLength":128}},"required":["code"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CouponCheck"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/coupons/redeem":{"post":{"operationId":"redeemCoupon","summary":"Redeem a coupon (atomic, limit-checked)","tags":["Promotions"],"security":[{"oauth2":["promotions:write"]},{"apiKey":[]}],"x-required-scopes":["promotions:write"],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":3,"maxLength":64},"customer_id":{"type":"string","maxLength":64},"location_id":{"type":"string","maxLength":64},"amount":{"type":"integer","minimum":0,"maximum":9007199254740991},"external_id":{"type":"string","maxLength":128}},"required":["code"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/passes/{id}":{"get":{"operationId":"getPass","summary":"Wallet pass status (Apple install signal, Google save state, links)","tags":["Passes"],"security":[{"oauth2":["passes:read"]},{"apiKey":[]}],"x-required-scopes":["passes:read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/passes/{id}/install-links":{"get":{"operationId":"getInstallLinks","summary":"Add-to-Apple-Wallet / Save-to-Google-Wallet / landing / QR links","tags":["Passes"],"security":[{"oauth2":["passes:read"]},{"apiKey":[]}],"x-required-scopes":["passes:read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/passes/{id}/refresh":{"post":{"operationId":"refreshPass","summary":"Re-render the pass and push it to devices (APNs) and Google","tags":["Passes"],"security":[{"oauth2":["passes:write"]},{"apiKey":[]}],"x-required-scopes":["passes:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/passes/{id}/messages":{"post":{"operationId":"sendPassMessage","summary":"Send a wallet message (Apple change message; Google addMessage, max 3 notifications/24 h)","tags":["Passes"],"security":[{"oauth2":["passes:write"]},{"apiKey":[]}],"x-required-scopes":["passes:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"header":{"type":"string","minLength":1,"maxLength":60},"body":{"type":"string","minLength":1,"maxLength":500}},"required":["header","body"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/passes/{id}/void":{"post":{"operationId":"voidPass","summary":"Void a pass (Apple shows it as voided; Google object becomes inactive)","tags":["Passes"],"security":[{"oauth2":["passes:write"]},{"apiKey":[]}],"x-required-scopes":["passes:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":3,"maxLength":200}},"required":["reason"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/passes/{id}/reissue":{"post":{"operationId":"reissuePass","summary":"Void a pass and issue a replacement with a new serial number","tags":["Passes"],"security":[{"oauth2":["passes:write"]},{"apiKey":[]}],"x-required-scopes":["passes:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/promotions/{id}/issue":{"post":{"operationId":"issuePromotionPass","summary":"Issue a coupon/offer pass for a customer","tags":["Promotions"],"security":[{"oauth2":["promotions:write","passes:write"]},{"apiKey":[]}],"x-required-scopes":["promotions:write","passes:write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{"type":"string","maxLength":64}},"required":["customer_id"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook-endpoints":{"get":{"operationId":"listWebhookEndpoints","summary":"List webhook endpoints","tags":["Webhooks"],"security":[{"oauth2":["webhooks:manage"]},{"apiKey":[]}],"x-required-scopes":["webhooks:manage"],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createWebhookEndpoint","summary":"Register an endpoint (the signing secret is returned once)","tags":["Webhooks"],"security":[{"oauth2":["webhooks:manage"]},{"apiKey":[]}],"x-required-scopes":["webhooks:manage"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"description":{"type":"string","maxLength":200},"events":{"default":["*"],"minItems":1,"type":"array","items":{"type":"string","enum":["*","customer.created","customer.updated","customer.deleted","pass.issued","pass.installed","pass.updated","pass.uninstalled","loyalty.points_earned","loyalty.points_redeemed","loyalty.points_adjusted","loyalty.points_expired","loyalty.transaction_reversed","loyalty.tier_changed","reward.issued","reward.redeemed","promotion.redeemed","webhook.delivery_failed","webhook.test"]}}},"required":["url"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook-endpoints/{id}":{"get":{"operationId":"getWebhookEndpoint","summary":"Retrieve an endpoint","tags":["Webhooks"],"security":[{"oauth2":["webhooks:manage"]},{"apiKey":[]}],"x-required-scopes":["webhooks:manage"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateWebhookEndpoint","summary":"Change URL, events or enable/disable","tags":["Webhooks"],"security":[{"oauth2":["webhooks:manage"]},{"apiKey":[]}],"x-required-scopes":["webhooks:manage"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"description":{"type":"string","maxLength":200},"events":{"default":["*"],"minItems":1,"type":"array","items":{"type":"string","enum":["*","customer.created","customer.updated","customer.deleted","pass.issued","pass.installed","pass.updated","pass.uninstalled","loyalty.points_earned","loyalty.points_redeemed","loyalty.points_adjusted","loyalty.points_expired","loyalty.transaction_reversed","loyalty.tier_changed","reward.issued","reward.redeemed","promotion.redeemed","webhook.delivery_failed","webhook.test"]}},"status":{"type":"string","enum":["enabled","disabled"]}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteWebhookEndpoint","summary":"Delete an endpoint","tags":["Webhooks"],"security":[{"oauth2":["webhooks:manage"]},{"apiKey":[]}],"x-required-scopes":["webhooks:manage"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook-endpoints/{id}/rotate-secret":{"post":{"operationId":"rotateWebhookSecret","summary":"Rotate the signing secret (old secret keeps signing for 24 h)","tags":["Webhooks"],"security":[{"oauth2":["webhooks:manage"]},{"apiKey":[]}],"x-required-scopes":["webhooks:manage"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook-endpoints/{id}/test":{"post":{"operationId":"sendTestWebhook","summary":"Send a webhook.test event to this endpoint","tags":["Webhooks"],"security":[{"oauth2":["webhooks:manage"]},{"apiKey":[]}],"x-required-scopes":["webhooks:manage"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook-deliveries":{"get":{"operationId":"listWebhookDeliveries","summary":"Delivery log (filter status=dead for the dead-letter queue)","tags":["Webhooks"],"security":[{"oauth2":["webhooks:manage"]},{"apiKey":[]}],"x-required-scopes":["webhooks:manage"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":25,"type":"integer","minimum":1,"maximum":100}},{"name":"starting_after","in":"query","required":false,"schema":{"type":"string","maxLength":64}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["pending","succeeded","failed","dead"]}},{"name":"endpoint_id","in":"query","required":false,"schema":{"type":"string","maxLength":64}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook-deliveries/{id}/retry":{"post":{"operationId":"retryWebhookDelivery","summary":"Replay a failed or dead-lettered delivery","tags":["Webhooks"],"security":[{"oauth2":["webhooks:manage"]},{"apiKey":[]}],"x-required-scopes":["webhooks:manage"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key per logical operation (retries must reuse it). Stored for 24 hours.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/events":{"get":{"operationId":"listEvents","summary":"Event log (30 days)","tags":["Webhooks"],"security":[{"oauth2":["webhooks:manage"]},{"apiKey":[]}],"x-required-scopes":["webhooks:manage"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":25,"type":"integer","minimum":1,"maximum":100}},{"name":"starting_after","in":"query","required":false,"schema":{"type":"string","maxLength":64}},{"name":"type","in":"query","required":false,"schema":{"type":"string","maxLength":64}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/events/{id}":{"get":{"operationId":"getEvent","summary":"Retrieve an event with its provenance","tags":["Webhooks"],"security":[{"oauth2":["webhooks:manage"]},{"apiKey":[]}],"x-required-scopes":["webhooks:manage"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request (validation_failed, invalid_json, missing_idempotency_key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient scope, IP not allowed or tenant suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found (also returned for other tenants’ ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict (idempotency_in_progress, duplicate_transaction, already_reversed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Business rule violation (insufficient_balance, idempotency_key_reused, …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited — see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string","enum":["invalid_request_error","authentication_error","permission_error","conflict_error","business_rule_error","plan_error","rate_limit_error","api_error"]},"code":{"type":"string"},"message":{"type":"string"},"param":{"type":"string"},"details":{},"request_id":{"type":"string"},"doc_url":{"type":"string"}},"required":["type","code","message","request_id","doc_url"],"additionalProperties":false}},"required":["error"],"additionalProperties":false},"Customer":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"customer"},"external_id":{"type":["string","null"]},"member_number":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"birth_month":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"birth_day":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"locale":{"type":["string","null"]},"status":{"type":"string","enum":["active","merged","anonymized"]},"marketing_email":{"type":"boolean"},"marketing_sms":{"type":"boolean"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"source":{"type":"string"},"merged_into":{"type":["string","null"]},"last_activity_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"created":{"type":"string","description":"ISO-8601 UTC timestamp"}},"required":["id","object","external_id","member_number","email","phone","first_name","last_name","birth_month","birth_day","locale","status","marketing_email","marketing_sms","metadata","source","merged_into","last_activity_at","created"],"additionalProperties":false},"LoyaltyAccount":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"loyalty_account"},"program_id":{"type":"string"},"customer_id":{"type":"string"},"points_balance":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps_balance":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lifetime_points":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"tier":{"type":["string","null"]},"barcode":{"type":"string"},"status":{"type":"string","enum":["active","closed"]},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last_activity_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"created":{"type":"string","description":"ISO-8601 UTC timestamp"}},"required":["id","object","program_id","customer_id","points_balance","stamps_balance","lifetime_points","tier","barcode","status","version","last_activity_at","created"],"additionalProperties":false},"LoyaltyTransaction":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"loyalty_transaction"},"account_id":{"type":"string"},"type":{"type":"string","enum":["earn","bonus","redeem","adjust","reversal","expire","transfer"]},"points":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"points_after":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps_after":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"amount":{"anyOf":[{"type":"object","properties":{"amount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Minor units (e.g. 4500 = 4.500 KWD)"},"currency":{"type":"string","minLength":3,"maxLength":3}},"required":["amount","currency"],"additionalProperties":false},{"type":"null"}]},"reason":{"type":["string","null"]},"reverses":{"type":["string","null"]},"location_id":{"type":["string","null"]},"pos_transaction_id":{"type":["string","null"]},"reward_id":{"type":["string","null"]},"issued_reward_id":{"type":["string","null"]},"promotion_id":{"type":["string","null"]},"source":{"type":"string"},"actor":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":["string","null"]}},"required":["type","id"],"additionalProperties":false},"expires_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"created":{"type":"string","description":"ISO-8601 UTC timestamp"}},"required":["id","object","account_id","type","points","stamps","points_after","stamps_after","amount","reason","reverses","location_id","pos_transaction_id","reward_id","issued_reward_id","promotion_id","source","actor","expires_at","metadata","created"],"additionalProperties":false},"EarnResult":{"type":"object","properties":{"transaction":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"loyalty_transaction"},"account_id":{"type":"string"},"type":{"type":"string","enum":["earn","bonus","redeem","adjust","reversal","expire","transfer"]},"points":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"points_after":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps_after":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"amount":{"anyOf":[{"type":"object","properties":{"amount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Minor units (e.g. 4500 = 4.500 KWD)"},"currency":{"type":"string","minLength":3,"maxLength":3}},"required":["amount","currency"],"additionalProperties":false},{"type":"null"}]},"reason":{"type":["string","null"]},"reverses":{"type":["string","null"]},"location_id":{"type":["string","null"]},"pos_transaction_id":{"type":["string","null"]},"reward_id":{"type":["string","null"]},"issued_reward_id":{"type":["string","null"]},"promotion_id":{"type":["string","null"]},"source":{"type":"string"},"actor":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":["string","null"]}},"required":["type","id"],"additionalProperties":false},"expires_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"created":{"type":"string","description":"ISO-8601 UTC timestamp"}},"required":["id","object","account_id","type","points","stamps","points_after","stamps_after","amount","reason","reverses","location_id","pos_transaction_id","reward_id","issued_reward_id","promotion_id","source","actor","expires_at","metadata","created"],"additionalProperties":false},{"type":"null"}]},"account":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"loyalty_account"},"program_id":{"type":"string"},"customer_id":{"type":"string"},"points_balance":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps_balance":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lifetime_points":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"tier":{"type":["string","null"]},"barcode":{"type":"string"},"status":{"type":"string","enum":["active","closed"]},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last_activity_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"created":{"type":"string","description":"ISO-8601 UTC timestamp"}},"required":["id","object","program_id","customer_id","points_balance","stamps_balance","lifetime_points","tier","barcode","status","version","last_activity_at","created"],"additionalProperties":false},"points_awarded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps_awarded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"breakdown":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string"},"points":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"detail":{"type":"string"}},"required":["rule","points","stamps"],"additionalProperties":false}},"issued_rewards":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"issued_reward"},"account_id":{"type":"string"},"reward_id":{"type":"string"},"code":{"type":"string"},"status":{"type":"string","enum":["issued","redeemed","expired","void"]},"source":{"type":"string"},"issued_at":{"type":"string","description":"ISO-8601 UTC timestamp"},"expires_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"redeemed_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"redeemed_location_id":{"type":["string","null"]}},"required":["id","object","account_id","reward_id","code","status","source","issued_at","expires_at","redeemed_at","redeemed_location_id"],"additionalProperties":false}},"below_minimum":{"type":"boolean"},"pass_update":{"type":"object","properties":{"status":{"type":"string","enum":["queued","no_pass"]},"passes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["status","passes"],"additionalProperties":false}},"required":["transaction","account","points_awarded","stamps_awarded","breakdown","issued_rewards","below_minimum","pass_update"],"additionalProperties":false},"PosSaleResult":{"type":"object","properties":{"transaction":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"loyalty_transaction"},"account_id":{"type":"string"},"type":{"type":"string","enum":["earn","bonus","redeem","adjust","reversal","expire","transfer"]},"points":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"points_after":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps_after":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"amount":{"anyOf":[{"type":"object","properties":{"amount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Minor units (e.g. 4500 = 4.500 KWD)"},"currency":{"type":"string","minLength":3,"maxLength":3}},"required":["amount","currency"],"additionalProperties":false},{"type":"null"}]},"reason":{"type":["string","null"]},"reverses":{"type":["string","null"]},"location_id":{"type":["string","null"]},"pos_transaction_id":{"type":["string","null"]},"reward_id":{"type":["string","null"]},"issued_reward_id":{"type":["string","null"]},"promotion_id":{"type":["string","null"]},"source":{"type":"string"},"actor":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":["string","null"]}},"required":["type","id"],"additionalProperties":false},"expires_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"created":{"type":"string","description":"ISO-8601 UTC timestamp"}},"required":["id","object","account_id","type","points","stamps","points_after","stamps_after","amount","reason","reverses","location_id","pos_transaction_id","reward_id","issued_reward_id","promotion_id","source","actor","expires_at","metadata","created"],"additionalProperties":false},{"type":"null"}]},"account":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"loyalty_account"},"program_id":{"type":"string"},"customer_id":{"type":"string"},"points_balance":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps_balance":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lifetime_points":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"tier":{"type":["string","null"]},"barcode":{"type":"string"},"status":{"type":"string","enum":["active","closed"]},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last_activity_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"created":{"type":"string","description":"ISO-8601 UTC timestamp"}},"required":["id","object","program_id","customer_id","points_balance","stamps_balance","lifetime_points","tier","barcode","status","version","last_activity_at","created"],"additionalProperties":false},"points_awarded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps_awarded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"breakdown":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string"},"points":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"detail":{"type":"string"}},"required":["rule","points","stamps"],"additionalProperties":false}},"issued_rewards":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"issued_reward"},"account_id":{"type":"string"},"reward_id":{"type":"string"},"code":{"type":"string"},"status":{"type":"string","enum":["issued","redeemed","expired","void"]},"source":{"type":"string"},"issued_at":{"type":"string","description":"ISO-8601 UTC timestamp"},"expires_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"redeemed_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"redeemed_location_id":{"type":["string","null"]}},"required":["id","object","account_id","reward_id","code","status","source","issued_at","expires_at","redeemed_at","redeemed_location_id"],"additionalProperties":false}},"below_minimum":{"type":"boolean"},"pass_update":{"type":"object","properties":{"status":{"type":"string","enum":["queued","no_pass"]},"passes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["status","passes"],"additionalProperties":false},"object":{"type":"string","const":"pos_sale"},"customer":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"customer"},"external_id":{"type":["string","null"]},"member_number":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"birth_month":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"birth_day":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"locale":{"type":["string","null"]},"status":{"type":"string","enum":["active","merged","anonymized"]},"marketing_email":{"type":"boolean"},"marketing_sms":{"type":"boolean"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"source":{"type":"string"},"merged_into":{"type":["string","null"]},"last_activity_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"created":{"type":"boolean"}},"required":["id","object","external_id","member_number","email","phone","first_name","last_name","birth_month","birth_day","locale","status","marketing_email","marketing_sms","metadata","source","merged_into","last_activity_at","created"],"additionalProperties":false},"balance":{"type":"object","properties":{"points":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stamps":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"tier":{"type":["string","null"]}},"required":["points","stamps","tier"],"additionalProperties":false}},"required":["transaction","account","points_awarded","stamps_awarded","breakdown","issued_rewards","below_minimum","pass_update","object","customer","balance"],"additionalProperties":false},"Program":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"program"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"type":{"type":"string","enum":["points","stamps","hybrid"]},"status":{"type":"string","enum":["draft","active","archived"]},"currency":{"type":"string"},"rules":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"rules_version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"enrollment_enabled":{"type":"boolean"},"pass_template_id":{"type":["string","null"]},"created":{"type":"string","description":"ISO-8601 UTC timestamp"},"updated":{"type":"string","description":"ISO-8601 UTC timestamp"}},"required":["id","object","name","slug","description","type","status","currency","rules","rules_version","enrollment_enabled","pass_template_id","created","updated"],"additionalProperties":false},"Reward":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"reward"},"program_id":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"kind":{"type":"string","enum":["free_item","amount_off","percent_off","custom"]},"cost_points":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"cost_stamps":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"value":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"percent_off":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"valid_days":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"max_per_customer":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"auto_issue":{"type":"boolean"},"status":{"type":"string","enum":["active","archived"]},"created":{"type":"string","description":"ISO-8601 UTC timestamp"}},"required":["id","object","program_id","name","description","kind","cost_points","cost_stamps","value","percent_off","valid_days","max_per_customer","auto_issue","status","created"],"additionalProperties":false},"IssuedReward":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"issued_reward"},"account_id":{"type":"string"},"reward_id":{"type":"string"},"code":{"type":"string"},"status":{"type":"string","enum":["issued","redeemed","expired","void"]},"source":{"type":"string"},"issued_at":{"type":"string","description":"ISO-8601 UTC timestamp"},"expires_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"redeemed_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"redeemed_location_id":{"type":["string","null"]}},"required":["id","object","account_id","reward_id","code","status","source","issued_at","expires_at","redeemed_at","redeemed_location_id"],"additionalProperties":false},"Promotion":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"promotion"},"name":{"type":"string"},"description":{"type":["string","null"]},"kind":{"type":"string","enum":["coupon","offer","bonus_points","event"]},"status":{"type":"string","enum":["draft","scheduled","active","paused","ended"]},"program_id":{"type":["string","null"]},"starts_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"ends_at":{"anyOf":[{"type":"string","description":"ISO-8601 UTC timestamp"},{"type":"null"}]},"targeting":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"location_ids":{"type":"array","items":{"type":"string"}},"offer":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"code_type":{"type":"string","enum":["none","shared","unique"]},"shared_code":{"type":["string","null"]},"max_redemptions":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"max_per_customer":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"pass_template_id":{"type":["string","null"]},"update_passes":{"type":"boolean"},"redemptions":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created":{"type":"string","description":"ISO-8601 UTC timestamp"}},"required":["id","object","name","description","kind","status","program_id","starts_at","ends_at","targeting","location_ids","offer","code_type","shared_code","max_redemptions","max_per_customer","pass_template_id","update_passes","created"],"additionalProperties":false},"Location":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"location"},"code":{"type":"string"},"name":{"type":"string"},"address":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"phone":{"type":["string","null"]},"status":{"type":"string","enum":["active","archived"]},"created":{"type":"string","description":"ISO-8601 UTC timestamp"}},"required":["id","object","code","name","address","latitude","longitude","phone","status","created"],"additionalProperties":false},"CouponCheck":{"type":"object","properties":{"valid":{"type":"boolean"},"code":{"type":"string"},"reason":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false},"promotion_id":{"type":["string","null"]},"discount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["valid","code","promotion_id","discount"],"additionalProperties":false}},"securitySchemes":{"oauth2":{"type":"oauth2","description":"OAuth 2.0 client credentials. Exchange client_id/client_secret at /oauth/token for a 1-hour bearer token.","flows":{"clientCredentials":{"tokenUrl":"https://wallet.capitalquality.net/api/v1/oauth/token","scopes":{"customers:read":"customers:read","customers:write":"customers:write","loyalty:read":"loyalty:read","loyalty:write":"loyalty:write","rewards:read":"rewards:read","rewards:write":"rewards:write","promotions:read":"promotions:read","promotions:write":"promotions:write","passes:read":"passes:read","passes:write":"passes:write","programs:read":"programs:read","webhooks:manage":"webhooks:manage","usage:read":"usage:read"}}}},"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"lw_live_… / lw_test_… scoped API key"}}}}