Skip to main content
POST
/
v1
/
billing
/
credits
/
purchase
Purchase credits
curl --request POST \
  --url https://api.example.com/v1/billing/credits/purchase \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "creditType": "<string>",
  "quantity": 123
}
'

Overview

Purchases additional credits for your tenant. Credits draw from the saved payment method on file. Credits are added immediately and do not expire within the current calendar year. Required role: admin
Your tenant must have a valid payment method saved before purchasing credits. Credits purchased in excess of your plan limit are carried into the next period.

Request headers

Authorization
string
required
JWT Bearer token. Format: Bearer <your-jwt>.

Request body

creditType
string
required
Type of credits to purchase. One of: investigations, events.
quantity
integer
required
Number of credits to purchase. Minimum: 100 for investigations, 10000 for events.

Response

Returns 201 Created.
{
  "purchaseId": "pch_01HX9VTPQR3KF8MZWBYD5N6JCE",
  "creditType": "investigations",
  "quantity": 500,
  "amountUsd": 49.00,
  "newBalance": 750,
  "purchasedAt": "2024-04-01T14:30:00Z"
}
FieldTypeDescription
purchaseIdstringUnique purchase transaction ID
creditTypestringThe type of credits purchased
quantityintegerCredits purchased
amountUsdnumberAmount charged in USD
newBalanceintegerUpdated credit balance after purchase
purchasedAtstringISO 8601 timestamp

Error responses

StatusError codeDescription
400validation_errorInvalid creditType or quantity below minimum
401unauthorizedMissing or invalid JWT
403forbiddenCaller lacks admin role
402payment_failedCharge declined — update payment method in dashboard
409no_payment_methodNo payment method on file

Examples

curl https://api.causeflow.ai/v1/billing/credits/purchase \
  -X POST \
  -H "Authorization: Bearer eyJhbGc..." \
  -H "Content-Type: application/json" \
  -d '{
    "creditType": "investigations",
    "quantity": 500
  }'

Credits balance

View current credit balance

Usage

Monitor quota burn rate