API referenceBilling
Apply a promotion code to the running subscription
Applies a promotion code, as a customer types it, to the workspace's running subscription (a new subscription takes codes on the Checkout page itself). An unknown or inactive code is a 404. Requires billing:manage.
Authorization
apiKey AuthorizationBearer <token>
Long-lived tenant API key, cd_live_… (production) or cd_test_… (staging, development), stored hashed. Keys created before the switch to cd_ start with sk_live_… / sk_test_… and are still accepted. Scoped to the owning application's tenant.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/billing/promotion-code" \ -H "Content-Type: application/json" \ -d '{ "code": "string" }'{ "tenant_id": "string", "state": "trialing", "reason": "string", "restricted": true, "first_domain_free": true, "attention": true, "setup_required": true, "days_left": 0, "price_cents": 0, "currency": "string", "trial_ends_at": "2019-08-24T14:15:22Z", "grace_started_at": "2019-08-24T14:15:22Z", "grace_ends_at": "2019-08-24T14:15:22Z", "current_period_end": "2019-08-24T14:15:22Z", "cancel_at_period_end": true, "ended_at": "2019-08-24T14:15:22Z", "comped": true, "comped_until": "2019-08-24T14:15:22Z", "payment_failed": true, "payment_failed_at": "2019-08-24T14:15:22Z", "has_billing_account": true, "portal_available": true, "can_change_plan": true, "mode": "test", "plan": { "id": "starter", "name": "string", "price_cents": 0, "public_price": true, "domains_per_year": 0, "domains_per_month": 0, "hard_cap": true, "retired": true }, "next_charge": { "at": "2019-08-24T14:15:22Z", "amount_cents": 0, "currency": "string" }, "checkout": { "available": true, "trial_days": 0, "trial_end": "2019-08-24T14:15:22Z", "first_charge_at": "2019-08-24T14:15:22Z", "default_plan": "starter" }, "usage": { "used": 0, "quota": 0, "period_start": "2019-08-24T14:15:22Z", "period_end": "2019-08-24T14:15:22Z" }, "payment_method": { "type": "card", "brand": "string", "last4": "string", "exp_month": 0, "exp_year": 0, "wallet": "apple_pay", "email": "string" }}{ "code": "string", "title": "string", "details": "string"}{ "code": "string", "title": "string", "details": "string"}{ "code": "string", "title": "string", "details": "string"}{ "code": "string", "title": "string", "details": "string"}{ "code": "string", "title": "string", "details": "string"}