Discounts
View as Markdown

Create a promotion code

Needs the catalog:write scope, or a full-access key. About scopes

POST
/api/v1/promotion-codes

Authorization

Authorization
Required
Bearer <token>

An API key: gpy_test_… or gpy_live_… (or an agent key, agk_…).

In: header

Request Body

application/jsonOptional

max_redemptionsinteger | null

expires_atstring | null

Format: "date-time"

activeboolean

coupon_id
Required
string

Format: "uuid"

code
Required
string

Pattern: "^[A-Za-z0-9_-]{1,64}$"

first_time_onlyboolean

Header Parameters

Idempotency-Keystring

A unique value for this operation, chosen by you. A retry with the same key and the same body returns the first response instead of running again. The same key with a different body answers 409 idempotency_key_reused; a key whose first request is still running answers 409 idempotency_in_progress.

curl -X POST "https://globalymint.com/api/v1/promotion-codes" \
  -H "Idempotency-Key: order-8842-charge" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "max_redemptions": 1,
    "expires_at": "2019-08-24T14:15:22Z",
    "active": true,
    "coupon_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "code": "string",
    "first_time_only": true
  }'

The code.

{
  "data": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "coupon_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "code": "string",
    "first_time_only": true,
    "max_redemptions": 0,
    "times_redeemed": 0,
    "expires_at": "2019-08-24T14:15:22Z",
    "active": true,
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z"
  },
  "_agent": {
    "summary": "string",
    "status": "ok",
    "next_actions": [
      "string"
    ],
    "warnings": [
      "string"
    ]
  },
  "api_version": "2026-07-01"
}