> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeplo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# POST Create Subscription

> Create or assign a subscription.

## Create subscription

`POST /api/subscriptions`

Create a new subscription for a user.

### Headers

**x-api-key** `string` *required*

Your API key

**x-api-secret** `string` *required*

Your API secret key

**x-channel-id** `string` *required*

WhatsApp channel ID

### Body parameters

**planId** `integer` *required*

Plan ID.

**startDate** `string` (default: today)

Start date.

**autoRenew** `boolean` (default: true)

Enable auto-renewal.

```json theme={null}
{
  "planId": 2,
  "startDate": "2026-01-15",
  "autoRenew": true
}
```

```bash cURL theme={null}
curl -X POST https://zeplo.ai/api/subscriptions \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-api-secret: YOUR_API_SECRET" \
  -H "x-channel-id: YOUR_CHANNEL_ID" \
  -H "Content-Type: application/json" \
  -d '{ "planId": 2, "startDate": "2026-01-15", "autoRenew": true }'
```

***

## Assign subscription (superadmin)

`POST /api/assignSubscription`

### Body parameters

**userId** `integer` *required*

User ID to assign the subscription to.

**planId** `integer` *required*

Plan ID.

**duration** `integer` *required*

Subscription duration in days.

```json theme={null}
{
  "userId": 5,
  "planId": 2,
  "duration": 30
}
```

```json Response theme={null}
{
  "success": true,
  "data": {
    "id": 10,
    "userId": 5,
    "planId": 2,
    "status": "active",
    "startDate": "2026-01-15T00:00:00Z",
    "endDate": "2026-02-14T23:59:59Z",
    "autoRenew": true
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.