POST
/
subscriptions
curl --request POST \
  --url https://api.cloud.flexprice.io/v1/subscriptions \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "billing_cadence": "RECURRING",
  "billing_period": "MONTHLY",
  "billing_period_count": 2,
  "currency": "<string>",
  "customer_id": "<string>",
  "end_date": "<string>",
  "lookup_key": "<string>",
  "metadata": {},
  "plan_id": "<string>",
  "start_date": "<string>",
  "trial_end": "<string>",
  "trial_start": "<string>"
}'
{
  "active_pause_id": "<string>",
  "billing_anchor": "<string>",
  "billing_cadence": "RECURRING",
  "billing_period": "MONTHLY",
  "billing_period_count": 123,
  "cancel_at": "<string>",
  "cancel_at_period_end": true,
  "cancelled_at": "<string>",
  "created_at": "<string>",
  "created_by": "<string>",
  "currency": "<string>",
  "current_period_end": "<string>",
  "current_period_start": "<string>",
  "customer": {
    "address_city": "<string>",
    "address_country": "<string>",
    "address_line1": "<string>",
    "address_line2": "<string>",
    "address_postal_code": "<string>",
    "address_state": "<string>",
    "created_at": "<string>",
    "created_by": "<string>",
    "email": "<string>",
    "environment_id": "<string>",
    "external_id": "<string>",
    "id": "<string>",
    "metadata": {},
    "name": "<string>",
    "status": "published",
    "tenant_id": "<string>",
    "updated_at": "<string>",
    "updated_by": "<string>"
  },
  "customer_id": "<string>",
  "end_date": "<string>",
  "environment_id": "<string>",
  "id": "<string>",
  "line_items": [
    {
      "billing_period": "MONTHLY",
      "created_at": "<string>",
      "created_by": "<string>",
      "currency": "<string>",
      "customer_id": "<string>",
      "display_name": "<string>",
      "end_date": "<string>",
      "environment_id": "<string>",
      "id": "<string>",
      "invoice_cadence": "ARREAR",
      "metadata": {},
      "meter_display_name": "<string>",
      "meter_id": "<string>",
      "plan_display_name": "<string>",
      "plan_id": "<string>",
      "price_id": "<string>",
      "price_type": "USAGE",
      "quantity": 123,
      "start_date": "<string>",
      "status": "published",
      "subscription_id": "<string>",
      "tenant_id": "<string>",
      "trial_period": 123,
      "updated_at": "<string>",
      "updated_by": "<string>"
    }
  ],
  "lookup_key": "<string>",
  "metadata": {},
  "pause_status": "none",
  "pauses": [
    {
      "created_at": "<string>",
      "created_by": "<string>",
      "environment_id": "<string>",
      "id": "<string>",
      "metadata": {},
      "original_period_end": "<string>",
      "original_period_start": "<string>",
      "pause_end": "<string>",
      "pause_mode": "immediate",
      "pause_start": "<string>",
      "pause_status": "none",
      "reason": "<string>",
      "resume_mode": "immediate",
      "resumed_at": "<string>",
      "status": "published",
      "subscription_id": "<string>",
      "tenant_id": "<string>",
      "updated_at": "<string>",
      "updated_by": "<string>"
    }
  ],
  "plan": {
    "created_at": "<string>",
    "created_by": "<string>",
    "description": "<string>",
    "entitlements": [
      {
        "created_at": "<string>",
        "created_by": "<string>",
        "environment_id": "<string>",
        "feature": {
          "created_at": "<string>",
          "created_by": "<string>",
          "description": "<string>",
          "environment_id": "<string>",
          "id": "<string>",
          "lookup_key": "<string>",
          "metadata": {},
          "meter": {
            "aggregation": {
              "field": "<string>",
              "type": "COUNT"
            },
            "created_at": "2024-03-20T15:04:05Z",
            "event_name": "api_request",
            "filters": [
              {
                "key": "<string>",
                "values": [
                  "<string>"
                ]
              }
            ],
            "id": "550e8400-e29b-41d4-a716-446655440000",
            "name": "API Usage Meter",
            "reset_usage": "BILLING_PERIOD",
            "status": "published",
            "tenant_id": "tenant123",
            "updated_at": "2024-03-20T15:04:05Z"
          },
          "meter_id": "<string>",
          "name": "<string>",
          "status": "published",
          "tenant_id": "<string>",
          "type": "metered",
          "unit_plural": "<string>",
          "unit_singular": "<string>",
          "updated_at": "<string>",
          "updated_by": "<string>"
        },
        "feature_id": "<string>",
        "feature_type": "metered",
        "id": "<string>",
        "is_enabled": true,
        "is_soft_limit": true,
        "plan": {},
        "plan_id": "<string>",
        "static_value": "<string>",
        "status": "published",
        "tenant_id": "<string>",
        "updated_at": "<string>",
        "updated_by": "<string>",
        "usage_limit": 123,
        "usage_reset_period": "MONTHLY"
      }
    ],
    "environment_id": "<string>",
    "id": "<string>",
    "lookup_key": "<string>",
    "name": "<string>",
    "prices": [
      {
        "amount": 123,
        "billing_cadence": "RECURRING",
        "billing_model": "FLAT_FEE",
        "billing_period": "MONTHLY",
        "billing_period_count": 123,
        "created_at": "<string>",
        "created_by": "<string>",
        "currency": "<string>",
        "description": "<string>",
        "display_amount": "<string>",
        "environment_id": "<string>",
        "id": "<string>",
        "invoice_cadence": "ARREAR",
        "lookup_key": "<string>",
        "metadata": {},
        "meter": {
          "aggregation": {
            "field": "<string>",
            "type": "COUNT"
          },
          "created_at": "2024-03-20T15:04:05Z",
          "event_name": "api_request",
          "filters": [
            {
              "key": "<string>",
              "values": [
                "<string>"
              ]
            }
          ],
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "API Usage Meter",
          "reset_usage": "BILLING_PERIOD",
          "status": "published",
          "tenant_id": "tenant123",
          "updated_at": "2024-03-20T15:04:05Z"
        },
        "meter_id": "<string>",
        "plan_id": "<string>",
        "status": "published",
        "tenant_id": "<string>",
        "tier_mode": "VOLUME",
        "tiers": [
          {
            "flat_amount": 123,
            "unit_amount": 123,
            "up_to": 123
          }
        ],
        "transform_quantity": {
          "divide_by": 123,
          "round": "<string>"
        },
        "trial_period": 123,
        "type": "USAGE",
        "updated_at": "<string>",
        "updated_by": "<string>"
      }
    ],
    "status": "published",
    "tenant_id": "<string>",
    "updated_at": "<string>",
    "updated_by": "<string>"
  },
  "plan_id": "<string>",
  "start_date": "<string>",
  "status": "published",
  "subscription_status": "active",
  "tenant_id": "<string>",
  "trial_end": "<string>",
  "trial_start": "<string>",
  "updated_at": "<string>",
  "updated_by": "<string>",
  "version": 123
}

Authorizations

x-api-key
string
header
required

Enter your API key in the format x-api-key <api-key>*

Body

application/json
Subscription Request
billing_cadence
enum<string>
required
Available options:
RECURRING,
ONETIME
billing_period
enum<string>
required
Available options:
MONTHLY,
ANNUAL,
WEEKLY,
DAILY,
QUARTERLY,
HALF_YEARLY
billing_period_count
integer
required
Required range: x >= 1
currency
string
required
customer_id
string
required
plan_id
string
required
start_date
string
required
end_date
string
lookup_key
string
metadata
object
trial_end
string
trial_start
string

Response

201
application/json
Created
active_pause_id
string

ActivePauseID references the current active pause configuration This will be null if no pause is active or scheduled

billing_anchor
string

BillingAnchor is the reference point that aligns future billing cycle dates. It sets the day of week for week intervals, the day of month for month and year intervals, and the month of year for year intervals. The timestamp is in UTC format.

billing_cadence
enum<string>
Available options:
RECURRING,
ONETIME
billing_period
enum<string>
Available options:
MONTHLY,
ANNUAL,
WEEKLY,
DAILY,
QUARTERLY,
HALF_YEARLY
billing_period_count
integer

BillingPeriodCount is the total number units of the billing period.

cancel_at
string

CancelAt is the date the subscription will be canceled

cancel_at_period_end
boolean

CancelAtPeriodEnd is whether the subscription was canceled at the end of the current period

cancelled_at
string

CanceledAt is the date the subscription was canceled

created_at
string
created_by
string
currency
string

Currency is the currency of the subscription in lowercase 3 digit ISO codes

current_period_end
string

CurrentPeriodEnd is the end of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.

current_period_start
string

CurrentPeriodStart is the end of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.

customer
object
customer_id
string

CustomerID is the identifier for the customer in our system

end_date
string

EndDate is the end date of the subscription

environment_id
string

EnvironmentID is the environment identifier for the subscription

id
string

ID is the unique identifier for the subscription

line_items
object[]
lookup_key
string

LookupKey is the key used to lookup the subscription in our system

metadata
object
pause_status
enum<string>
Available options:
none,
active,
scheduled,
completed,
cancelled
pauses
object[]
plan
object
plan_id
string

PlanID is the identifier for the plan in our system

start_date
string

StartDate is the start date of the subscription

status
enum<string>
Available options:
published,
deleted,
archived
subscription_status
enum<string>
Available options:
active,
paused,
cancelled,
incomplete,
incomplete_expired,
past_due,
trialing,
unpaid
tenant_id
string
trial_end
string

TrialEnd is the end date of the trial period

trial_start
string

TrialStart is the start date of the trial period

updated_at
string
updated_by
string
version
integer

Version is used for optimistic locking