ClocknextHelp
DocumentationAPI ReferenceMCP Tools
Dashboard

Get started

OverviewQuickstart

Good to know

Response formatHandling errorsPaginating resultsSending data reliablyYour own customer idsWebhooks

API reference

Record credit POSTRecord outcome POSTComplete outcome POSTRecord wallet POSTRecord unit POSTComplete composite POST
List customers GETCreate a customer POSTGet a customer GETUpdate a customer PATCHDelete a customer DELETEGet a customer's balances GETGet a customer's wallet ledger GETSet a customer's low-balance alert PUTGet a customer's current plan GETChange a recurring grant PUTList Customer Usage Log GETLook Up Usage Logs by ID GET
Manage a customer's credit balance POSTManage a customer's outcome balance POSTManage a customer's unit balance POSTManage a customer's composite balance POSTManage a customer's wallet balance POST
List a customer's members GETAdd a member POSTUpdate a member PATCHRemove a member DELETE
PlansCreditsOutcomesUnitsComposites
List taxes GETCreate a tax POSTGet a tax GETUpdate a tax PATCH
List purchases GETCreate a purchase POSTGet a purchase GETUpdate a purchase's auto-payment setting PATCHCancel a purchase POST
List invoices GETGet an invoice GETMint a hosted pay link GET
List payments GETGet a payment GET
wallet.balance.update POSTwallet.balance.drop POST
Mint a customer-portal access token POST
Customer Portal

Mint a customer-portal access token

Returns a short-lived HS256 JWT for the customer portal. A customer not in the key's organisation is reported as 400 here (not 404); an organizationId mismatch is 403.

POST
/portal/token

Authorization

apiKey
AuthorizationBearer <token>

Organisation-scoped key from Settings → API Keys.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/portal/token" \  -H "Content-Type: application/json" \  -d '{    "customerId": "cus_abc123",    "organizationId": "org_2b9c4d",    "ttlSeconds": 900,    "memberEmail": "dana@acme.com"  }'
{  "statusCode": 200,  "statusDetail": {    "status": "SUCCESS",    "message": "OK"  },  "result": {    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjdXNfYWJjMTIzIiwib3JnIjoib3JnXzJiOWM0ZCJ9.4kTjZq8x1vXK9mYw2rL6nQ",    "expiresAt": 1785499500,    "expiresIn": 900  }}
{  "statusCode": 400,  "statusDetail": {    "status": "ERROR",    "message": "Request body must be valid JSON."  },  "result": {}}
{  "statusCode": 401,  "statusDetail": {    "status": "ERROR",    "message": "Invalid API key."  },  "result": {}}
{  "statusCode": 403,  "statusDetail": {    "status": "ERROR",    "message": "organizationId does not match this API key."  },  "result": {}}
{  "statusCode": 500,  "statusDetail": {    "status": "ERROR",    "message": "Could not complete the request."  },  "result": {}}

wallet.balance.drop POST

Triggered when a customer's Wallet balance falls to or below their low-balance alert level, or the endpoint's threshold if they have none.

customerId*string
Length1 <= length
organizationId?string

If present, must equal the key's organisation (else 403).

Length1 <= length
ttlSeconds?integer

Clamped to the organisation's configured TTL cap.

Range1 <= value <= 3600
memberEmail?string

Paid-by / receipt email; embedded as the token's email claim.

Formatemail