v1

latestOpenAPI 3.0.02026-07-2475182625.5 KB
Coupons

Add coupon codes

Adds new codes to an existing coupon. This operation is additive — existing codes are preserved and the new codes are appended.

Code handling

  • Case: Codes are normalized to uppercase on storage. summer10 and SUMMER10 are treated as the same code.
  • Duplicates: Duplicate codes within a single request are accepted without error and echoed verbatim in the response, but storage silently dedupes to a single entry per unique (case-insensitive) code. Call GET /coupons/{coupon_id}/codes after a write to confirm the stored state.
  • Format: Codes must contain only alphanumeric characters, hyphens, and underscores. Spaces and other special characters are rejected.
post/coupons/{coupon_id}

Path parameters

coupon_idstring required

The unique path identifier for the coupon.

Request body

codesstring[] required

Coupon codes to add to the coupon.

Code handling

  • Case: Codes are normalized to uppercase on storage. summer10 and SUMMER10 are stored as the same code.
  • Duplicates: Duplicate codes within a single request do not cause the request to be rejected. The API accepts the request, returns result: success, and echoes every submitted code verbatim in the response. However, storage silently dedupes (case-insensitively) to a single entry per unique code. Call GET /coupons/{coupon_id}/codes after the write to confirm the stored state.
  • Format: Alphanumeric characters, hyphens, and underscores only. Spaces and other special characters are rejected.

Example request

{
  "codes": [
    "SUMMER10",
    "SUMMER20",
    "SUMMER30"
  ]
}

Response

Codes successfully added.

couponstring

Path identifier of the coupon the codes were added to.

codesstring[]

The codes as they were submitted in the request — echoed verbatim, including any case variation.

Code handling

  • Request echo, not stored state: This array reflects the request payload, not what was persisted. Codes are normalized to uppercase on storage, and duplicates (including case-insensitive duplicates) are silently deduped. The response is not a reliable indicator of what was actually stored.
  • Verification: Call GET /coupons/{coupon_id}/codes after a write to confirm the stored codes.
result'success'

Indicates the operation succeeded.

Example response

{
  "coupon": "summer-sale-2026",
  "codes": [
    "SUMMER10",
    "SUMMER20",
    "SUMMER30"
  ],
  "result": "success"
}