Subscriptions

Create a subscription

Creates a subscription.

POST
/subscriptions

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

Subscription payload

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://api.sandbox.billingrails.com/v1/subscriptions" \  -H "Content-Type: application/json" \  -d '{    "account_id": "acc_IhMUl3rrZ3",    "plan_id": "pln_IhMUl3rrZ3",    "currency": "USD",    "billing_cycle_type": "anniversary",    "collection_method": "automatic",    "payment_method_id": "pme_IhMUl3rrZ3"  }'
{
  "subscription": {
    "object": "subscription",
    "id": "sub_IhMUl3rrZ3",
    "status": "active",
    "account_id": "acc_IhMUl3rrZ3",
    "plan_id": "pln_IhMUl3rrZ3",
    "payment_method_id": "pme_IhMUl3rrZ3",
    "currency": "USD",
    "billing_cycle_type": "anniversary",
    "collection_method": "automatic",
    "current_period_start": "2025-02-14T17:33:40.843Z",
    "current_period_end": "2025-03-14T17:33:40.843Z",
    "first_billing_at": "2025-02-28T17:33:40.843Z",
    "previous_billing_at": "2025-02-14T17:33:40.843Z",
    "billed_through": "2025-03-14T17:33:40.843Z",
    "next_billing_at": "2025-03-14T17:33:40.843Z",
    "started_at": "2025-02-14T17:33:40.843Z",
    "trial_period_start": null,
    "trial_period_end": null,
    "created_at": "2025-02-14T17:33:40.843Z",
    "items": [
      {
        "product_id": "prd_IhMUl3rrZ3",
        "price_id": "prc_IhMUl3rrZ3",
        "quantity": 1
      }
    ]
  },
  "meta": {
    "request_id": "req_IhMUl3rrZ3"
  }
}