Create a subscription

View as Markdown
Creates a new subscription linking a customer to a plan. Both must belong to the authenticated company.

Authentication

AuthorizationBearer
API key obtained from the Afternoon dashboard

Request

This endpoint expects an object.
customer_idstringRequiredformat: "cuid"
Customer ID
plan_codestringRequiredformat: "^[a-z0-9]+(?:_[a-z0-9]+)*$"
Plan code
start_datedatetimeOptional

ISO 8601 subscription start date (defaults to now)

billing_anchor_dayintegerOptional1-31

Day of month for billing anchor (1-31, defaults to 1)

initial_statusenumOptional
Initial status of the subscription. Defaults to pending.
Allowed values:

Response

Subscription created
successboolean
subscriptionobject
request_idstring

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error
409
Conflict Error
500
Internal Server Error