Skip to main content
POST
JavaScript

Authorizations

X-API-KEY
string
header
required

Server API Key

Headers

X-ACCOUNT-ID
string

Account ID — optional when authenticating with a user JWT (Bearer token); falls back to the user's first membership. Ignored for API-key auth.

X-ENVIRONMENT-ID
string

Environment ID — required when authenticating with a user JWT (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is intrinsic to the key).

Body

application/json

Input for creating a contract and its subscriptions atomically.

customerId
string
required

The customer ref ID the contract belongs to

Required string length: 1 - 255
Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_|.@-]*$
contractId
string

Your own ID for the contract, which makes this call idempotent: sending the same one again returns the existing contract instead of creating a second. Omit it and one is generated for you, but then a retry cannot be told apart from a new contract — and contracts cannot be deleted. Recommended whenever a retry is possible, e.g. building a contract from an order form.

Required string length: 1 - 255
Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$
name
string | null

Optional contract name

Maximum string length: 255
poNumber
string | null

Optional purchase-order number

Maximum string length: 255
activationStartDate
string<date-time>

Optional contract activation start date

activationEndDate
string<date-time>

Optional contract activation end date

setupBilling
boolean
default:true

Whether to set up billing for the contract by creating a billing contract in the connected billing provider. When false, the contract only provisions access (grants entitlements) and no billing contract is created. Defaults to true.

subscriptions
ContractSubscriptionEntry · object[]

The subscriptions to attach to the contract. Each entry is either a new subscription to create or a reference to an existing custom subscription. Optional — omit it (or pass an empty list) to create a contract with no subscriptions and attach them later.

Response

The created contract, including the custom subscriptions attached to it.

Response object

data
Contract · object
required

A billing contract as reported by the connected billing provider.