API reference
/v1/chargeAgent paid access lifecycle
Purchase and manage paid resource access (fixed-price API calls, bounded
dataset access, prepaid compute seconds) through a single endpoint.
The operation field discriminates the lifecycle step. Charge is separate
from the security verbs (verify / feedback / challenge) and is not a verify
data-plane operation. Payment, permission, and delivery remain separate: a
security allow is never proof of payment, and buyers cannot assert
payment or delivery.
Every mutation requires an idempotency key. The Idempotency-Key header takes precedence over
body idempotencyKey.
resource | quote | accept | status | cancel | reconcile | permission | reserve | usage | refund | configure | budget
Seller tenant that owns the resource or purchase.
Retry dedupe key; header takes precedence over the body field.
quote: resourceId, quantity, operationDigest · accept: purchaseId, quoteVersion, maxAmount, currency · status/cancel/reconcile: purchaseId · permission: purchaseId, allowed, eventId? · reserve: purchaseId, executionId, operationDigest, units · usage: purchaseId, executionId, sequence, usedUnits, result · refund: purchaseId, amount · configure: resource · budget: buyerTenantId, limit.
Always true on a successful lifecycle result.
Present for purchase operations. Includes quote, accepted, permission, payment, delivery, stopped, and next.
Suggested next step: accept | pay | wait | seller_permission | execute | reconcile | complete.
Present for configure and resource operations.
Present for budget: { limit, committed }.
Present on reserve: { executionId, granted, leaseUntil }.
- 200 returns the ChargeResponse shape. 400 bad request, 401 unauthorized,
- 403 missing the required charge scope, 409 idempotency conflict, 413
- payload too large, 429 rate limited, 503 charge store unavailable return
- the Error schema.
- Use the configured test base URL and substitute your seller, resource, and server-computed operation digest. The all-zero digest in the wire examples is illustrative.
- The buyer uses
charge:buyfor quote, accept, status, and cancel. The buyer owner usescharge:budgetto set its own ceiling. The seller usescharge:configurefor resources,charge:fulfillfor permission, reserve, and usage, andcharge:managefor status, refund, and reconciliation. Resource reads accept buyer or seller configuration scope. - Exact mutation retries recover the original intent and current purchase. A changed payload under the same key returns
409 idempotency_conflict. Replays do not grant another execution reservation.
curl -fsS "$CHITMARK_API_BASE_URL/v1/charge" \
-H "Authorization: Bearer $CHITMARK_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: chg:sess_9f3a" \
-d '{
"operation": "quote",
"sellerTenantId": "org_acme",
"resourceId": "api_calls_v1",
"quantity": 1,
"operationDigest": "0000000000000000000000000000000000000000000000000000000000000000"
}'{
"ok": true,
"purchase": {
"purchaseId": "purchase_01JQ…",
"quote": {
"version": "quote_01JR…",
"sellerTenantId": "org_acme",
"buyerTenantId": "org_buyer",
"actingAgent": "agent_caller_1",
"resource": {
"resourceId": "api_calls_v1",
"version": 1,
"kind": "api_call",
"unit": "call",
"unitAmount": 100,
"currency": "usd",
"minQuantity": 1,
"maxQuantity": 1,
"maxAmount": 100,
"quoteTtlSeconds": 300,
"accessTtlSeconds": 3600,
"enabled": true,
"refundTerms": "unused_only"
},
"quantity": 1,
"amount": 100,
"currency": "usd",
"operationDigest": "0000000000000000000000000000000000000000000000000000000000000000",
"expiresAt": 1785800300000,
"accessUntil": 1785803600000
},
"accepted": false,
"permission": { "allowed": false, "source": "seller" },
"payment": {
"state": "pending",
"authorizedAmount": 0,
"capturedAmount": 0,
"refundedAmount": 0,
"refundState": "none",
"disputedAmount": 0,
"providerFee": null,
"checkedAt": null,
"source": "provider"
},
"delivery": { "source": "seller_report", "executions": [] },
"stopped": false,
"refundRequestedAmount": 0,
"createdAt": 1785800000000,
"updatedAt": 1785800000000
},
"next": "accept"
}