Funding API

Fund and manage balances for your app users.

Grant User Balance

POST /v1/funding/grant

Add balance to an app user's account from your grant pool. Provide an Idempotency-Key header to prevent duplicates.

Request

curl https://api.usequota.ai/v1/funding/grant \
  -H "Authorization: Bearer sk-quota-your-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: funding-user123-jan2026" \
  -d '{
    "external_user_id": "user_123",
    "amount": 0.50,
    "description": "Welcome bonus"
  }'

Request Fields

FieldTypeDescription
external_user_idstringYour unique identifier for the user
amountnumberDollar amount to add (e.g., 0.50 for $0.50)
descriptionstringOptional. Notes stored in the ledger

Response

{
  "external_user_id": "user_123",
  "amount_granted": "$0.50",
  "balance_before": "$5.00",
  "balance_after": "$5.50",
  "ledger_id": "ledg_123",
  "duplicate": false
}

Check User Balance

GET /v1/users/:id/balance

Check an app user's dollar balance.

Request

curl https://api.usequota.ai/v1/users/user_123/balance \
  -H "Authorization: Bearer sk-quota-your-api-key"

Response

{
  "external_user_id": "user_123",
  "balance": "$15.00",
  "billing_mode": "user"
}

Developer Balance

GET /v1/balance returns the developer balance. Whenexternal_user_id is provided, it returns that user's balance instead.

User Profile & Usage

GET /v1/me returns the authenticated user with a 30-day usage summary.

curl https://api.usequota.ai/v1/me \
  -H "Authorization: Bearer sk-quota-your-api-key"

Purchase Packages

GET /v1/packages lists purchasable balance packages (public endpoint, no auth required). Users buy balance in tiered packages -- larger packages get a better rate.

curl https://api.usequota.ai/v1/packages

Error Responses

StatusCodeEndpointDescription
401invalid_api_keyAllMissing or invalid API key
400bad_requestPOST /v1/funding/grantMissing required fields
404user_not_foundGET /v1/users/:id/balanceUser not found
402insufficient_balancePOST /v1/users/:id/chat/completionsUser balance too low

All errors return a JSON body:

{
  "error": {
    "code": "bad_request",
    "message": "Missing required fields"
  }
}