CreddotDocsCreddot Docs
API referenceSubscriptions

Create a subscription

POST
/api/v1/subscriptions

Authorization

api-key
headerx-api-key<token>

Your API key: ck_test_... for test mode, ck_live_... for live. Send it with x-api-secret (or Authorization: Bearer ).

Header Parameters

x-api-secret?string

Recommended: API secret sent over HTTPS. You may send it as Authorization: Bearer instead. If supplied, x-timestamp and x-signature are not required.

x-timestamp?string

Legacy signed mode: Unix time in milliseconds; maximum clock skew five minutes.

x-signature?string

Legacy signed mode: HMAC-SHA256(secret, timestamp.METHOD.url.idempotencyKey.bodyHash).

x-idempotency-key*string

1–128 letters/digits or ._:-. Same key and payload replay for 24 hours; conflicting, in-flight, or expired keys return 409. Never change a key to retry an uncertain payment.

Request Body

application/json
  1. body
name*string
Lengthlength <= 160
plans?array<>

The plans offered (1–10); the first is the default. Required unless planId is given.

planId?string

Legacy: an existing plan in the same environment, copied onto this subscription as its only plan. Use plans instead.

description?string
Lengthlength <= 5000
amountMinor?string

Legacy (with planId): overrides the copied plan amount.

billingCycle?string

Legacy (with planId): overrides the copied plan cycle.

Value in"WEEKLY""MONTHLY""QUARTERLY""BIANNUALLY""ANNUALLY"
startAt?string

Defaults to now.

Formatdate-time
status?string
Default"ACTIVE"
Value in"DRAFT""ACTIVE"
autoRenewal?
Defaulttrue
renewalReminders?
Defaulttrue
allowPlanUpgrade?
Defaulttrue
gracePeriodDays?number

Days after a missed billing date before a subscriber lapses.

Range0 <= value <= 30
Default3

Response Body

application/json
  1. response
id*string
subscriptionCode*string
environment*string
Value in"SANDBOX""LIVE"
name*string
description*string|null
planId*string
planName*string
amountMinor*string
currency*string
billingCycle*string
status*string
Value in"DRAFT""ACTIVE""CANCELLED"
startAt*string
nextBillingAt*string
autoRenewal*boolean
renewalReminders*boolean
allowPlanUpgrade*boolean
slug*|

Public share code (checkout /sub/{slug}).

shareUrl*|

Hosted subscribe page, while the subscription is active.

gracePeriodDays*number

Days after a missed billing date before a subscriber lapses.

activatedAt*string|null
cancelledAt*string|null
createdAt*string
updatedAt*string
plan*

The default plan.

plans*array<>

Every plan of this subscription, in display order (archived included).

progress*
recentSubscribers*array<>
Example Request
curl -X POST 'https://api.creddot.com/api/v1/subscriptions' \  -H 'x-idempotency-key: string' \  -H 'Content-Type: application/json' \  -d '{  "name": "Meaty Enterprise"}'
Example Response
{  "id": "string",  "subscriptionCode": "string",  "environment": "SANDBOX",  "name": "string",  "description": "string",  "planId": "string",  "planName": "string",  "amountMinor": "string",  "currency": "string",  "billingCycle": "string",  "status": "DRAFT",  "startAt": "string",  "nextBillingAt": "string",  "autoRenewal": true,  "renewalReminders": true,  "allowPlanUpgrade": true,  "slug": "string",  "shareUrl": "string",  "gracePeriodDays": 0,  "activatedAt": "string",  "cancelledAt": "string",  "createdAt": "string",  "updatedAt": "string",  "plan": {    "id": "string",    "environment": "SANDBOX",    "name": "string",    "description": "string",    "amountMinor": "string",    "currency": "string",    "billingCycle": "WEEKLY",    "status": "ACTIVE",    "features": [      "string"    ],    "highlight": "string",    "subscriptionId": "string",    "position": 0,    "createdAt": "string",    "updatedAt": "string"  },  "plans": [    {      "id": "string",      "environment": "SANDBOX",      "name": "string",      "description": "string",      "amountMinor": "string",      "currency": "string",      "billingCycle": "WEEKLY",      "status": "ACTIVE",      "features": [        "string"      ],      "highlight": "string",      "subscriptionId": "string",      "position": 0,      "createdAt": "string",      "updatedAt": "string",      "isDefault": true,      "activeSubscribers": 0,      "subscribers": 0    }  ],  "progress": {    "total": 0,    "active": 0,    "cancelled": 0,    "pending": 0,    "processing": 0,    "overdue": 0,    "lapsed": 0,    "percentageActive": 0,    "collectedAmountMinor": "string"  },  "recentSubscribers": [    {      "id": "string",      "orderCode": "string",      "customerId": "string",      "customerName": "string",      "customerEmail": "string",      "amountMinor": "string",      "currency": "string",      "paymentMethod": "string",      "status": "PENDING",      "customerPhone": "string",      "lastPaidAt": "string",      "overdueAt": "string",      "lapsedAt": "string",      "planId": "string",      "planName": "string",      "billingCycle": "WEEKLY",      "startedAt": "string",      "nextBillingAt": "string",      "cancelledAt": "string",      "createdAt": "string"    }  ]}