HTTP API

Promo Code

GET/api/v1/promo-codes/batches
GET
/api/v1/promo-codes/batches

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Query Parameters

q?string

Full-text search query applied to batch name and description.

page?integer

1-indexed page number.

Formatint64
Range0 <= value
page_size?integer

Page size.

Formatint64
Range0 <= value
sort_by?string

Sort field.

sort_order?string

Sort order (asc or desc).

Value in

  • "asc"
  • "desc"
filter?array<string>

Additional filter expressions in the form field:operator:value.

Response Body

application/json

curl -X GET "https://example.com/api/v1/promo-codes/batches"
{  "batches": [    {      "batch_id": "string",      "caps": {        "global_redemptions": 0,        "per_code": 0,        "per_referrer": 0,        "per_user": 0      },      "claim_type": "single_use",      "claim_window": {        "ends_at": "2019-08-24T14:15:22Z",        "starts_at": "2019-08-24T14:15:22Z"      },      "created_at": "2019-08-24T14:15:22Z",      "created_by": "string",      "description": "string",      "geo_fence": {        "countries": [          "string"        ],        "mode": "allow"      },      "name": "string",      "quarantine_reason": "string",      "requested_count": 0,      "reward_payload": null,      "status": "draft",      "stored_value": {        "enabled": true,        "initial_value": 0,        "partial_redemption": true      },      "total_redemptions": 0,      "updated_at": "2019-08-24T14:15:22Z"    }  ],  "pagination": {    "has_more": true,    "page": 0,    "page_size": 0,    "total": 0  }}
POST/api/v1/promo-codes/batches
POST
/api/v1/promo-codes/batches

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/promo-codes/batches" \  -H "Content-Type: application/json" \  -d '{    "count": 0,    "name": "string",    "reward_payload": null  }'
{  "batch_id": "string",  "progress_url": "string",  "requested_count": 0,  "status": "draft"}
GET/api/v1/promo-codes/batches/{batch_id}
GET
/api/v1/promo-codes/batches/{batch_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

batch_id*string

Response Body

application/json

curl -X GET "https://example.com/api/v1/promo-codes/batches/string"
{  "batch_id": "string",  "caps": {    "global_redemptions": 0,    "per_code": 0,    "per_referrer": 0,    "per_user": 0  },  "claim_type": "single_use",  "claim_window": {    "ends_at": "2019-08-24T14:15:22Z",    "starts_at": "2019-08-24T14:15:22Z"  },  "created_at": "2019-08-24T14:15:22Z",  "created_by": "string",  "description": "string",  "geo_fence": {    "countries": [      "string"    ],    "mode": "allow"  },  "name": "string",  "quarantine_reason": "string",  "requested_count": 0,  "reward_payload": null,  "status": "draft",  "stored_value": {    "enabled": true,    "initial_value": 0,    "partial_redemption": true  },  "total_redemptions": 0,  "updated_at": "2019-08-24T14:15:22Z"}
POST/api/v1/promo-codes/batches/{batch_id}/archive
POST
/api/v1/promo-codes/batches/{batch_id}/archive

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

batch_id*string

Response Body

application/json

curl -X POST "https://example.com/api/v1/promo-codes/batches/string/archive"
{  "batch_id": "string",  "caps": {    "global_redemptions": 0,    "per_code": 0,    "per_referrer": 0,    "per_user": 0  },  "claim_type": "single_use",  "claim_window": {    "ends_at": "2019-08-24T14:15:22Z",    "starts_at": "2019-08-24T14:15:22Z"  },  "created_at": "2019-08-24T14:15:22Z",  "created_by": "string",  "description": "string",  "geo_fence": {    "countries": [      "string"    ],    "mode": "allow"  },  "name": "string",  "quarantine_reason": "string",  "requested_count": 0,  "reward_payload": null,  "status": "draft",  "stored_value": {    "enabled": true,    "initial_value": 0,    "partial_redemption": true  },  "total_redemptions": 0,  "updated_at": "2019-08-24T14:15:22Z"}
PATCH/api/v1/promo-codes/batches/{batch_id}/caps
PATCH
/api/v1/promo-codes/batches/{batch_id}/caps

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

batch_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X PATCH "https://example.com/api/v1/promo-codes/batches/string/caps" \  -H "Content-Type: application/json" \  -d '{}'
{  "batch_id": "string",  "caps": {    "global_redemptions": 0,    "per_code": 0,    "per_referrer": 0,    "per_user": 0  },  "claim_type": "single_use",  "claim_window": {    "ends_at": "2019-08-24T14:15:22Z",    "starts_at": "2019-08-24T14:15:22Z"  },  "created_at": "2019-08-24T14:15:22Z",  "created_by": "string",  "description": "string",  "geo_fence": {    "countries": [      "string"    ],    "mode": "allow"  },  "name": "string",  "quarantine_reason": "string",  "requested_count": 0,  "reward_payload": null,  "status": "draft",  "stored_value": {    "enabled": true,    "initial_value": 0,    "partial_redemption": true  },  "total_redemptions": 0,  "updated_at": "2019-08-24T14:15:22Z"}
POST/api/v1/promo-codes/batches/{batch_id}/export
POST
/api/v1/promo-codes/batches/{batch_id}/export

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

batch_id*string

Response Body

application/json

curl -X POST "https://example.com/api/v1/promo-codes/batches/string/export"
{  "batch_id": "string",  "codes": [    {      "code_hash": "string",      "status": "string"    }  ],  "expires_at": "2019-08-24T14:15:22Z"}
POST/api/v1/promo-codes/batches/{batch_id}/quarantine
POST
/api/v1/promo-codes/batches/{batch_id}/quarantine

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

batch_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/promo-codes/batches/string/quarantine" \  -H "Content-Type: application/json" \  -d '{    "reason": "string"  }'
{  "batch_id": "string",  "reason": "string",  "status": "draft"}
GET/api/v1/promo-codes/batches/{batch_id}/redemptions
GET
/api/v1/promo-codes/batches/{batch_id}/redemptions

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

batch_id*string

Query Parameters

page?integer

1-indexed page number.

Formatint64
Range0 <= value
page_size?integer

Page size.

Formatint64
Range0 <= value
status?string

Filter by redemption status.

user?string

Filter by claimant id.

referrer?string

Filter by referrer id.

country?string

Filter by country code.

Response Body

application/json

curl -X GET "https://example.com/api/v1/promo-codes/batches/string/redemptions"
{  "pagination": {    "has_more": true,    "page": 0,    "page_size": 0,    "total": 0  },  "redemptions": [    {      "amount_redeemed": 0,      "batch_id": "string",      "campaign_id": "string",      "claim_type": "single_use",      "claimant_id": "string",      "code_hash": "string",      "country": "string",      "redeemed_at": "2019-08-24T14:15:22Z",      "redemption_id": "string",      "referrer_id": "string",      "status": "rejected"    }  ]}
POST/api/v1/promo-codes/batches/{batch_id}/resume
POST
/api/v1/promo-codes/batches/{batch_id}/resume

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

batch_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/promo-codes/batches/string/resume" \  -H "Content-Type: application/json" \  -d '{}'
{  "batch_id": "string",  "caps": {    "global_redemptions": 0,    "per_code": 0,    "per_referrer": 0,    "per_user": 0  },  "claim_type": "single_use",  "claim_window": {    "ends_at": "2019-08-24T14:15:22Z",    "starts_at": "2019-08-24T14:15:22Z"  },  "created_at": "2019-08-24T14:15:22Z",  "created_by": "string",  "description": "string",  "geo_fence": {    "countries": [      "string"    ],    "mode": "allow"  },  "name": "string",  "quarantine_reason": "string",  "requested_count": 0,  "reward_payload": null,  "status": "draft",  "stored_value": {    "enabled": true,    "initial_value": 0,    "partial_redemption": true  },  "total_redemptions": 0,  "updated_at": "2019-08-24T14:15:22Z"}
POST/api/v1/promo-codes/lock
POST
/api/v1/promo-codes/lock

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/promo-codes/lock" \  -H "Content-Type: application/json" \  -d '{    "code": "string",    "ttl_seconds": 0  }'
{  "commit_token": "string",  "expires_at": "2019-08-24T14:15:22Z",  "lock_id": "string",  "status": "rejected"}
POST/api/v1/promo-codes/locks/{lock_id}/commit
POST
/api/v1/promo-codes/locks/{lock_id}/commit

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

lock_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/promo-codes/locks/string/commit" \  -H "Content-Type: application/json" \  -d '{    "commit_token": "string"  }'
{  "lock_id": "string",  "redemption_id": "string",  "reward_payload": null,  "status": "rejected"}
POST/api/v1/promo-codes/locks/{lock_id}/release
POST
/api/v1/promo-codes/locks/{lock_id}/release

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

lock_id*string

Response Body

application/json

curl -X POST "https://example.com/api/v1/promo-codes/locks/string/release"
{  "lock_id": "string",  "status": "rejected"}
POST/api/v1/promo-codes/redeem
POST
/api/v1/promo-codes/redeem

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/promo-codes/redeem" \  -H "Content-Type: application/json" \  -d '{    "code": "string"  }'
{  "redemption_id": "string",  "remaining_value": 0,  "reward_payload": null,  "status": "rejected"}
POST/api/v1/promo-codes/stored-value/redeem
POST
/api/v1/promo-codes/stored-value/redeem

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/promo-codes/stored-value/redeem" \  -H "Content-Type: application/json" \  -d '{    "amount": 0,    "code": "string"  }'
{  "redemption_id": "string",  "remaining_value": 0,  "reward_payload": null,  "status": "rejected"}

On this page