> Index of every page: https://docs.merchantservicedepot.com/llms.txt

# Create subscription


`POST /v1/subscriptions`

Which calendar day a charge lands on is a timezone question, so `timezone` is explicit and defaults to UTC rather than being guessed.

Auth: a secret key with the `subscriptions.create` permission. Returns `201` with Subscription.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `customerId` | body | string | Yes | The customer that owns or receives this resource. |
| `planId` | body | string | Yes | The plan used to create the subscription. |
| `paymentMethodId` | body | string | Yes | The reusable identifier of a stored payment method. |
| `startAt` | body | string · YYYY-MM-DD | No | The first billing date in YYYY-MM-DD format. Defaults to today. |
| `timezone` | body | string · IANA timezone | No | The IANA timezone used to decide the billing calendar day. Defaults to UTC. |

## Request

**curl**

```curl
curl -X POST "https://payments-api-sandbox.merchantservicedepot.com/v1/subscriptions" \
  -H "Authorization: Bearer $MYELA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "customerId": "{{CUSTOMER_ID}}",
  "planId": "{{PLAN_ID}}",
  "paymentMethodId": "{{PAYMENT_METHOD_ID}}",
  "startAt": "2026-09-01",
  "timezone": "America/New_York"
}'
```

**Node**

```node
const res = await fetch("https://payments-api-sandbox.merchantservicedepot.com/v1/subscriptions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MYELA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "customerId": "{{CUSTOMER_ID}}",
    "planId": "{{PLAN_ID}}",
    "paymentMethodId": "{{PAYMENT_METHOD_ID}}",
    "startAt": "2026-09-01",
    "timezone": "America/New_York"
  }),
});

if (!res.ok) {
  const { error } = await res.json();
  // Branch on error.code — never on error.message.
  throw new Error(error.code);
}
const data = await res.json();
```

**Python**

```python
import os
import requests

res = requests.post(
    "https://payments-api-sandbox.merchantservicedepot.com/v1/subscriptions",
    headers={
        "Authorization": f"Bearer {os.environ['MYELA_API_KEY']}",
    },
    json={
        "customerId": "{{CUSTOMER_ID}}",
        "planId": "{{PLAN_ID}}",
        "paymentMethodId": "{{PAYMENT_METHOD_ID}}",
        "startAt": "2026-09-01",
        "timezone": "America/New_York"
    },
)

if not res.ok:
    # Branch on error["code"] — never on error["message"].
    raise RuntimeError(res.json()["error"]["code"])
data = res.json()
```

## Response

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Unique subscription identifier. |
| `object` | "subscription" | Stable resource discriminator. |
| `status` | string | Current subscription state. |
| `customerId` | string | Subscribed customer. |
| `planId` | string | Subscribed plan. |
| `paymentMethodId` | string | Stored payment method. |
| `nextBillingAt` | string | Next scheduled billing timestamp. |
| `createdAt` | string | ISO 8601 creation timestamp. |

```json
{
  "id": "sub_01JEXAMPLE",
  "object": "subscription",
  "status": "active",
  "customerId": "cus_01JEXAMPLE",
  "planId": "plan_01JEXAMPLE",
  "paymentMethodId": "pm_01JEXAMPLE",
  "nextBillingAt": "2026-09-01T13:00:00.000Z",
  "createdAt": "2026-08-10T20:49:51.653Z"
}
```

Source: https://docs.merchantservicedepot.com/api-reference/create-subscription/
