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
Signals

Complete outcome

Closes and bills ONE outcome run. This is the only way to close a run; POST /signal/outcome never accepts complete.

Closes the run only. If a step carried a composite, that occurrence still needs its own POST /signal/composite/complete.

POST
/signal/outcome/complete

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.

The completion-only shape: { customerId, runId }, plus the common member / idempotencyKey fields every signal accepts and an optional custom object. No agentKey, no usage, no composite — this closes an EXISTING run that an earlier step signal already opened, so there is no step behind THIS request and nothing here to price.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/signal/outcome/complete" \  -H "Content-Type: application/json" \  -d '{    "customerId": "cus_abc123",    "runId": "ticket_9021"  }'
{  "statusCode": 200,  "statusDetail": {    "status": "SUCCESS",    "message": "OK"  },  "result": {    "status": "COMPLETED",    "usageLog": null,    "rawId": "raw_4k8w2r"  }}
{  "statusCode": 202,  "statusDetail": {    "status": "SUCCESS",    "message": "Signal accepted for processing."  },  "result": {    "queued": true,    "messageId": "msg_2f4a1b8c",    "rawId": "raw_4k8w2r"  }}
{  "statusCode": 400,  "statusDetail": {    "status": "ERROR",    "message": "Request body must be valid JSON."  },  "result": {}}
{  "statusCode": 401,  "statusDetail": {    "status": "ERROR",    "message": "Invalid API key."  },  "result": {}}
{  "statusCode": 404,  "statusDetail": {    "status": "ERROR",    "message": "No customer with id \"cus_abc123\"."  },  "result": {}}
{  "statusCode": 409,  "statusDetail": {    "status": "ERROR",    "message": "Outcome \"Resolved ticket\" has already been completed."  },  "result": {}}
{  "statusCode": 422,  "statusDetail": {    "status": "ERROR",    "message": "No credit with agent key \"summarize\" exists in this workspace."  },  "result": {}}
{  "statusCode": 500,  "statusDetail": {    "status": "ERROR",    "message": "Could not complete the request."  },  "result": {}}

Record outcome POST

Records one step of a multi-call workflow. `agentKey` names the OutcomeStep. `runId` is required and groups every signal of one run — a step may repeat freely. This only records the step; it never bills. Close and bill the run with a separate call to [`POST /signal/outcome/complete`](/docs/api-reference/signals/completeOutcomeSignal). If the model has both cache-read and cache-write rates, `cacheTokens` carries the cache-**read** tokens only (billed at the cache-read rate); send cache-write tokens separately as `cacheWriteTokens`.

Record wallet POST

Debits the customer's wallet at the model's provider cost. No `agentKey` — this meters money, not a named entitlement — and no `composite`. The wallet may go negative; a signal is never refused for lack of funds. If the model has both cache-read and cache-write rates, `cacheTokens` carries the cache-**read** tokens only (billed at the cache-read rate); send cache-write tokens separately as `cacheWriteTokens`.

customerId?string

Customer id. Required unless externalId is sent.

Length1 <= length
externalId?string

Your own id for the customer, instead of customerId. Signals are processed asynchronously, so one matching no customer is accepted and then left Pending with a 404 reason — create the customer and retry it.

Match^[A-Za-z0-9-]{1,32}$
Length1 <= length <= 32
member?string

Member email this signal is attributed to; must belong to the customer. Matched case-insensitively.

idempotencyKey?string

Dedupes retries — a repeat request carrying the same key returns the original signal's result instead of recording a duplicate. Scoped per organisation AND per meter, so one key reused across /signal/credit and /signal/wallet is two independent keys, not a collision. See Async, flushing & reliability.

Length1 <= length <= 255
runId*string

The same runId the run's step signals were sent with.

Length1 <= length <= 255
custom?

Free-form metadata, stored as sent with this completion and shown in its Raw data.