Commet
  • Pricing
Log InTry out
Create promo code POSTGet promo code GETList promo codes GETUpdate promo code PUT
DocumentationKnowledge BaseBuild with AIAPI ReferenceWebhooks

Create promo code

Create a new promo code. Optionally restrict to specific plans.

POST
/promo-codes

Create a new promo code. Optionally restrict to specific plans.

Authorization

ApiKeyAuth
x-api-key<token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

code*string
discountType*string
discountValue*integer
durationCycles?integer
maxRedemptions?integer
expiresAt?string
planIds?array<string>

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/promo-codes" \  -H "Content-Type: application/json" \  -d '{    "code": "string",    "discountType": "percentage",    "discountValue": 1  }'
{  "success": true,  "data": {    "id": "string",    "code": "string",    "discountType": "percentage",    "discountValue": -9007199254740991,    "durationCycles": -9007199254740991,    "maxRedemptions": -9007199254740991,    "expiresAt": "2019-08-24T14:15:22Z",    "isActive": true,    "redemptionCount": -9007199254740991,    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z",    "object": "promo_code",    "livemode": true  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}

Request portal access POST

Generate a customer portal URL. Exactly one identifier (email or customerId) is required.

Get promo code GET

Retrieve a promo code by its public ID.