v1
latestOpenAPI 3.1.02026-08-042453938.9 KBContracts
Create a contract
Create a per-customer commercial agreement with custom pricing, prepaid commits, and spend caps.
Contracts override default pricing plans for a specific customer. Use them for:
- Enterprise deals with negotiated rates (via price overrides)
- Prepaid commits where the customer pays upfront and draws down a balance
- Spend caps to enforce maximum billing per period
- Minimum commits to guarantee a revenue floor
- Volume discounts applied as a percentage across all usage
- Free-tier allocations with included units per usage type
The customerId must reference a customer created via POST /customers. If prepaidAmountUsdc is provided, the contract is initialized with that amount as prepaidBalanceUsdc.
Requires a secret key (sk_*) with the ADMIN role.
post/v1/contracts
Request body
Example request
{
"customerId": "cus_abc123def456",
"name": "Acme Corp Enterprise Agreement",
"startDate": "2024-01-01T00:00:00.000Z",
"endDate": "2024-12-31T23:59:59.000Z",
"minimumUsdc": "500.00",
"maximumUsdc": "10000.00",
"discountPct": "15",
"prepaidAmountUsdc": "1000.00",
"includedUnits": {
"api_call": 10000,
"token": 1000000
},
"metadata": {
"salesforceId": "OPP-12345",
"tier": "enterprise"
}
}Response
Contract created successfully
Example response
{
"id": "ctr_abc123def456",
"businessId": "biz_789xyz",
"customerId": "cus_abc123def456",
"name": "Acme Corp Enterprise Agreement",
"status": "ACTIVE",
"startDate": "2024-01-01T00:00:00.000Z",
"endDate": "2024-12-31T23:59:59.000Z",
"minimumUsdc": "500.000000",
"maximumUsdc": "10000.000000",
"discountPct": "15.00",
"prepaidAmountUsdc": "1000.000000",
"prepaidBalanceUsdc": "750.000000",
"includedUnits": {
"api_call": 10000,
"token": 1000000
},
"metadata": {
"salesforceId": "OPP-12345",
"tier": "enterprise"
},
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z",
"priceOverrides": [
{
"id": "cpo_abc123def456",
"unitType": "api_call",
"unitPriceUsd": "0.000800"
}
]
}