Preview converting an order to a Subscription, or attaching billing to it
curl --request POST \ --url https://example.com/api/v1/orders/example/create-subscription/preview \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "collectionMethod": "CHARGE_AUTOMATICALLY", "contactId": "example", "currency": "example", "hoursPerPeriod": 1, "interval": "WEEKLY", "intervalCount": 1, "invoiceNote": "example", "lineItems": [ { "description": "example", "discountPercent": 1, "note": "example", "quantity": 1, "rate": 1, "serviceId": "example" } ], "nextChargeDate": "example", "orderTypeId": "example", "periodStart": "example", "renewalPrice": 1, "serviceId": "example" }'Runs every check POST /orders/{id}/create-subscription runs and returns what it would do: the order’s type and hours per period before and after, the renewal price, the current period’s first day and the first automatic charge. Writes nothing. Same permissions as the create call.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Resource identifier (CUID2).
Resource identifier (CUID2).
Request Body
Section titled “Request Body”Attaches manual recurring billing to an existing order with none yet. Converts an HOUR_BLOCK or TIME_AND_MATERIALS order to a Subscription type; on an existing SUBSCRIPTION order it changes nothing else. Nothing is invoiced, charged or emailed now.
object
How each cycle is collected. CHARGE_AUTOMATICALLY sends the cycle invoice and charges the card on file; SEND_INVOICE only sends the invoice with its payment link, due by the company’s payment terms, and is never charged or retried.
ISO 4217 currency code, e.g. USD.
Hours the converted order gets every billing period; its current budget hours when left out. Not used when the order already is a Subscription.
Number of interval units between charges, e.g. 1 for monthly, 3 for a quarterly cadence billed by month.
The lines every cycle invoice bills; renewalPrice must be their sum. Left out or empty, each cycle bills renewalPrice as one line named after the order.
First automatic charge date (YYYY-MM-DD), resolved at workspace-local midnight. Must be after today. No invoice or charge is issued by this call — the renewal job bills it automatically once the date arrives.
The Subscription order type (see GET /order-types) an Hour block or Time & Materials order moves to; the workspace’s system Subscription type when left out. Not used when the order already is a Subscription.
First day of the period the next charge renews, YYYY-MM-DD in the workspace timezone; hours logged from it count against that period. An existing order defaults to one billing interval before nextChargeDate, never before the order’s start; a new order to today.
The price charged every renewal cycle, in currency.
Service to attribute the subscription to; omit or null for none.
Responses
Section titled “Responses”What the conversion or attachment would do.
object
object
How each cycle is collected. CHARGE_AUTOMATICALLY sends the cycle invoice and charges the card on file; SEND_INVOICE only sends the invoice with its payment link, due by the company’s payment terms, and is never charged or retried.
The order’s end date, YYYY-MM-DD; its subscription is cancelled then.
First automatic charge, YYYY-MM-DD.
Convert: the order changes type; attach: it already is a Subscription; new: no order yet.
First day of the current period, YYYY-MM-DD.
Example
{ "data": { "collectionMethod": "CHARGE_AUTOMATICALLY", "interval": "WEEKLY", "path": "convert" }}Validation error. Parse failures include field paths and expectations.
Validation error with safe field paths and expected values; submitted values are never returned.
object
object
Stable machine-readable error code.
object
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Unauthorized.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Forbidden.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Not found.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}The order already has a subscription.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Invalid input.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Rate limit exceeded. Wait for Retry-After before retrying.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Headers
Section titled “Headers”Maximum requests in the current quota window.
Quota policy in requests and window seconds, for example 60;w=60.
Requests left in this quota window (zero when blocked).
Seconds until the current quota window resets, when available from the rate-limit store.
Seconds until another request may be attempted.
Chelsea is operated by Arepa Labs LLC