Resources / Discount codes

Discount codes

Codes buyers enter at checkout, for one show, a production, or everything.

The object

code string
What buyers type.
kind string
fixed (amount_cents off) or percent.
applies_to object or string
show_id, production_id, or everything.
max_uses, min_tickets integer or null
Limits.
uses integer
Paid orders that used it.
The discount code object
{  "id": 31,  "code": "SKETCH5",  "kind": "fixed",  "amount_cents": 500,  "percent": null,  "applies_to": {    "production_id": 77  },  "ticket_type_ids": null,  "max_uses": 30,  "min_tickets": null,  "starts_at": null,  "ends_at": null,  "active": true,  "uses": 4}

List codes

GET /v1/discount_codes

Every code.

Query parameters

active boolean
Only on, or off.
limit integer
Up to 200 a page, 50 by default.
after string
The last page's `next`, for the page after it.
curl
curl https://api.cocoscout.com/v1/discount_codes \  -H "Authorization: Bearer cs_live_…"

Get a code

GET /v1/discount_codes/{id}

One code.

curl
curl https://api.cocoscout.com/v1/discount_codes/4812 \  -H "Authorization: Bearer cs_live_…"

Make a code

POST /v1/discount_codes Read-and-write key

A new code.

Body

code string required
What buyers type.
kind string required
fixed or percent.
amount_cents or percent number required
How much off.
show_id or production_id integer
What it's for; leave out for everything.
ticket_type_ids array
Only these types.
max_uses, min_tickets integer
Limits.
starts_at, ends_at time
When it works.
curl
curl -X POST https://api.cocoscout.com/v1/discount_codes \  -H "Authorization: Bearer cs_live_…" \  -H "Content-Type: application/json" \  -H "Idempotency-Key: $(uuidgen)" \  -d '{    "code": "SKETCH5",    "kind": "fixed",    "amount_cents": 500  }'

Change a code

PATCH /v1/discount_codes/{id} Read-and-write key

Any of the fields above, plus active.

curl
curl -X PATCH https://api.cocoscout.com/v1/discount_codes/4812 \  -H "Authorization: Bearer cs_live_…"

Remove a code

DELETE /v1/discount_codes/{id} Read-and-write key

Deleted when nobody used it; turned off when someone did, so their orders keep it.

curl
curl -X DELETE https://api.cocoscout.com/v1/discount_codes/4812 \  -H "Authorization: Bearer cs_live_…"