ClocknextClocknextHelp
DocumentationAPI ReferenceMCP Tools
Dashboard

Get started

OverviewQuickstart

Good to know

Response formatHandling errorsPaginating resultsSending data reliablyYour own customer idsWebhooks

API reference

Signals

Record credit POSTRecord outcome POSTComplete outcome POSTRecord wallet POSTRecord unit POSTComplete composite POSTList raw signals GETRetry signals POSTList Customer Usage Log GETLook Up Usage Logs by ID GET

Deprecated

Record credit POSTRecord outcome POSTComplete outcome POSTRecord wallet POSTRecord unit POSTComplete composite POSTList raw signals GETRetry signals POST

Customers

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 for wallet PUTGet a customer's current plan GETChange a recurring grant PUTUpdate a customer's card POSTGet a customer's invoice balance GETAdjust a customer's invoice balance POST

Deprecated

List Customer Usage Log GETLook Up Usage Logs by ID GET

Manage

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

Members

List a customer's members GETAdd a member POSTUpdate a member PATCHRemove a member DELETE

Plans and Entitlements

PlansPackagesCreditsOutcomesUnitsComposites

Taxes

List taxes GETCreate a tax POSTGet a tax GETUpdate a tax PATCH

Purchases

List purchases GETCreate a purchase POSTGet a purchase GETUpdate a purchase's auto-payment setting PATCHCancel a purchase POST

Checkout

Create a checkout POST

Subscriptions

List subscriptions GETGet a subscription GETCancel a subscription POSTAdd packages to a subscription POSTRemove a package from a subscription POST

Plan changes

List plan changes GETPreview a plan change POSTChange a customer's plan POSTGet a plan change GET

Invoices

List invoices GETGet an invoice GETMint a hosted pay link GETRecord a payment POST

Credit notes

List credit notes GETCreate a credit note POSTGet a credit note GETVoid a credit note POST

Refunds

List refunds GETRefund to the card POSTGet a refund GET

Payments

List payments GETGet a payment GET

Webhooks

Customer Portal

Mint a customer-portal access token POST

Credits

Credits your product draws down by agentKey, priced from a model bundle. Nothing is deleted — archive instead.

List credits

Base URL https://payments.clocknext.com/api/v1

GET
/credits

Lists your credits. Pass active=true for active ones only.

Authorization

apiKey
headerAuthorizationBearer <cnk_…>

Organisation-scoped key from Settings → API Keys.

Query Parameters

active?boolean

true returns only active credits.

Response Body

Credits.

application/json
  1. response
  1. response
  2. …
statusCode*integer

The HTTP status code of the response, repeated in the body.

statusDetail*

The status of the request. status is SUCCESS, and message says what happened.

result*

The workspace's credits.

Example Request
curl -X GET 'https://payments.clocknext.com/api/v1/credits?active=true'
Example Response
{  "statusCode": 200,  "statusDetail": {    "status": "SUCCESS",    "message": "Request processed successfully."  },  "result": {    "credits": [      {        "id": "cmvgvfdp2000708l2vd8r110d",        "name": "Code Review",        "agentKey": "code_review",        "description": "Updated 2026-10-20 — credit description",        "basePrice": 0.1078125,        "modelBundle": [          {            "modelId": "gpt-4o",            "modelName": "GPT-4o",            "input": 70,            "output": 25,            "cache": 5,            "cacheWrite": 0,            "averageTokensPerLLMCall": 25000          }        ],        "marginPercent": 35,        "pricePerCredit": 0.145546875,        "isActive": true,        "createdAt": "2026-10-20T16:01:47.030Z",        "updatedAt": "2026-10-20T16:05:13.842Z"      },      {        "id": "cmvgvfdfz000608l2wsff83hq",        "name": "Deep Research",        "agentKey": "deep_research",        "description": "One multi-source research query",        "basePrice": 0.67985,        "modelBundle": [          {            "modelId": "claude-sonnet-4-5",            "modelName": "Claude Sonnet 4.5 (latest)",            "input": 60,            "output": 30,            "cache": 5,            "cacheWrite": 5,            "averageTokensPerLLMCall": 100000          },          {            "modelId": "gemini-2.5-flash",            "modelName": "Gemini 2.5 Flash",            "input": 80,            "output": 20,            "cache": 0,            "cacheWrite": 0,            "averageTokensPerLLMCall": 40000          }        ],        "marginPercent": 25,        "pricePerCredit": 0.8498125,        "isActive": true,        "createdAt": "2026-10-20T16:01:46.703Z",        "updatedAt": "2026-10-20T16:01:46.703Z"      },      {        "id": "cmvgvfd63000508l2oexbgpzs",        "name": "Chat Message",        "agentKey": "chat_message",        "description": "One assistant reply in the in-app chat",        "basePrice": 0.000855,        "modelBundle": [          {            "modelId": "gpt-4o-mini",            "modelName": "GPT-4o mini",            "input": 70,            "output": 30,            "cache": 0,            "cacheWrite": 0,            "averageTokensPerLLMCall": 3000          }        ],        "marginPercent": 40,        "pricePerCredit": 0.001197,        "isActive": true,        "createdAt": "2026-10-20T16:01:46.347Z",        "updatedAt": "2026-10-20T16:01:46.347Z"      }    ]  }}

Create a credit

Base URL https://payments.clocknext.com/api/v1

POST
/credits

Creates a credit. Its price is worked out from modelBundle.

Authorization

apiKey
headerAuthorizationBearer <cnk_…>

Organisation-scoped key from Settings → API Keys.

Request Body

application/json
  1. body
  1. body
  2. …

A new credit. Keys use letters, digits, ., _ and - (at most 80) and match exactly. The price per credit is the modelBundle base price × (1 + marginPercent / 100); you never send a price.

name*string

The credit's name. Must be unique in the workspace, ignoring case (409 if taken).

Length1 <= length <= 80
agentKey*string

The key a credit signal names. Unique among your credits (409 if taken).

Match^[A-Za-z0-9._-]+$
Length1 <= length <= 80
description?|

Optional note about the credit. An empty string is saved as null.

Lengthlength <= 400
marginPercent*number

Markup on the base price, in percent. -100 makes the credit free.

Range-100 <= value
modelBundle*array<>

The models and token mix that the server prices the credit from, one line per model.

Items1 <= items

Response Body

Credit created.

application/json
  1. response
  1. response
  2. …
statusCode*integer

The HTTP status code of the response, repeated in the body.

statusDetail*

The status of the request. status is SUCCESS, and message says what happened.

result*

The new credit.

curl -X POST 'https://payments.clocknext.com/api/v1/credits' \  -H 'Content-Type: application/json' \  -d '{  "name": "Deep Research",  "agentKey": "deep_research",  "description": "One multi-source research query",  "marginPercent": 25,  "modelBundle": [    {      "modelId": "claude-sonnet-4-5",      "averageTokensPerLLMCall": 100000,      "input": 60,      "output": 30,      "cache": 5,      "cacheWrite": 5    },    {      "modelId": "gemini-2.5-flash",      "averageTokensPerLLMCall": 40000,      "input": 80,      "output": 20,      "cache": 0,      "cacheWrite": 0    }  ]}'
Example Response
{  "statusCode": 201,  "statusDetail": {    "status": "SUCCESS",    "message": "Credit created."  },  "result": {    "created": true,    "credit": {      "id": "cmvgvfdfz000608l2wsff83hq",      "name": "Deep Research",      "agentKey": "deep_research",      "description": "One multi-source research query",      "basePrice": 0.67985,      "modelBundle": [        {          "modelId": "claude-sonnet-4-5",          "modelName": "Claude Sonnet 4.5 (latest)",          "input": 60,          "output": 30,          "cache": 5,          "cacheWrite": 5,          "averageTokensPerLLMCall": 100000        },        {          "modelId": "gemini-2.5-flash",          "modelName": "Gemini 2.5 Flash",          "input": 80,          "output": 20,          "cache": 0,          "cacheWrite": 0,          "averageTokensPerLLMCall": 40000        }      ],      "marginPercent": 25,      "pricePerCredit": 0.8498125,      "isActive": true,      "createdAt": "2026-10-20T16:01:46.703Z",      "updatedAt": "2026-10-20T16:01:46.703Z"    }  }}

Update a credit

Base URL https://payments.clocknext.com/api/v1

PATCH
/credits/{id}

Updates only the fields you send. Send modelBundle to re-price.

Authorization

apiKey
headerAuthorizationBearer <cnk_…>

Organisation-scoped key from Settings → API Keys.

Path Parameters

id*string

Credit id.

Request Body

application/json
  1. body
  1. body
  2. …

Only the fields you send change. Keys use letters, digits, ., _ and - (at most 80) and match exactly. Leave modelBundle out, or send [], to keep the saved bundle and price.

name?string

A new name. Must be unique in the workspace, ignoring case (409 if taken).

Length1 <= length <= 80
agentKey?string

A new key for credit signals. Unique among your credits (409 if taken).

Match^[A-Za-z0-9._-]+$
Length1 <= length <= 80
description?|

A new note. Send null to clear it.

Lengthlength <= 400
marginPercent?number

A new markup, in percent, down to -100. Without a new modelBundle, it applies to the saved base price.

Range-100 <= value
modelBundle?array<>

The complete new bundle. A non-empty list prices the credit again at today's model prices.

Response Body

Credit updated.

application/json
  1. response
  1. response
  2. …
statusCode*integer

The HTTP status code of the response, repeated in the body.

statusDetail*

The status of the request. status is SUCCESS, and message says what happened.

result*

The updated credit.

curl -X PATCH 'https://payments.clocknext.com/api/v1/credits/cr_8f2k1' \  -H 'Content-Type: application/json' \  -d '{  "marginPercent": 35}'
Example Response
{  "statusCode": 200,  "statusDetail": {    "status": "SUCCESS",    "message": "Credit updated."  },  "result": {    "updated": true,    "credit": {      "id": "cmvgvfdp2000708l2vd8r110d",      "name": "Code Review",      "agentKey": "code_review",      "description": "Updated 2026-10-20 — credit description",      "basePrice": 0.0984375,      "modelBundle": [        {          "modelId": "gpt-4o",          "modelName": "GPT-4o",          "input": 75,          "output": 20,          "cache": 5,          "cacheWrite": 0,          "averageTokensPerLLMCall": 25000        }      ],      "marginPercent": 35,      "pricePerCredit": 0.132890625,      "isActive": true,      "createdAt": "2026-10-20T16:01:47.030Z",      "updatedAt": "2026-10-20T16:05:13.499Z"    }  }}

Get a credit

Base URL https://payments.clocknext.com/api/v1

GET
/credits/{id}

Gets one credit.

Authorization

apiKey
headerAuthorizationBearer <cnk_…>

Organisation-scoped key from Settings → API Keys.

Path Parameters

id*string

Credit id.

Response Body

The credit.

application/json
  1. response
  1. response
  2. …
statusCode*integer

The HTTP status code of the response, repeated in the body.

statusDetail*

The status of the request. status is SUCCESS, and message says what happened.

result*

The credit with this id, in credit.

Example Request
curl -X GET 'https://payments.clocknext.com/api/v1/credits/cr_8f2k1'
Example Response
{  "statusCode": 200,  "statusDetail": {    "status": "SUCCESS",    "message": "Request processed successfully."  },  "result": {    "credit": {      "id": "cmvgvfdp2000708l2vd8r110d",      "name": "Code Review",      "agentKey": "code_review",      "description": "Updated 2026-10-20 — credit description",      "basePrice": 0.0984375,      "modelBundle": [        {          "modelId": "gpt-4o",          "modelName": "GPT-4o",          "input": 75,          "output": 20,          "cache": 5,          "cacheWrite": 0,          "averageTokensPerLLMCall": 25000        }      ],      "marginPercent": 30,      "pricePerCredit": 0.12796875,      "isActive": true,      "createdAt": "2026-10-20T16:01:47.030Z",      "updatedAt": "2026-10-20T16:03:01.282Z"    }  }}

Archive a credit

Base URL https://payments.clocknext.com/api/v1

POST
/credits/{id}/archive

Archives a credit. Nothing is deleted.

Authorization

apiKey
headerAuthorizationBearer <cnk_…>

Organisation-scoped key from Settings → API Keys.

Path Parameters

id*string

Credit id.

Response Body

Credit archived.

application/json
  1. response
  1. response
  2. …
statusCode*integer

The HTTP status code of the response, repeated in the body.

statusDetail*

The status of the request. status is SUCCESS, and message says what happened.

result*

The archived credit.

Example Request
curl -X POST 'https://payments.clocknext.com/api/v1/credits/cr_8f2k1/archive'
Example Response
{  "statusCode": 200,  "statusDetail": {    "status": "SUCCESS",    "message": "Credit archived."  },  "result": {    "archived": true,    "credit": {      "id": "cmvgvfdp2000708l2vd8r110d",      "name": "Code Review",      "agentKey": "code_review",      "description": "Updated 2026-10-20 — credit description",      "basePrice": 0.0984375,      "modelBundle": [        {          "modelId": "gpt-4o",          "modelName": "GPT-4o",          "input": 75,          "output": 20,          "cache": 5,          "cacheWrite": 0,          "averageTokensPerLLMCall": 25000        }      ],      "marginPercent": 30,      "pricePerCredit": 0.12796875,      "isActive": false,      "createdAt": "2026-10-20T16:01:47.030Z",      "updatedAt": "2026-10-20T16:04:45.355Z"    }  }}

Unarchive a credit

Base URL https://payments.clocknext.com/api/v1

POST
/credits/{id}/unarchive

Restores an archived credit.

Authorization

apiKey
headerAuthorizationBearer <cnk_…>

Organisation-scoped key from Settings → API Keys.

Path Parameters

id*string

Credit id.

Response Body

Credit unarchived.

application/json
  1. response
  1. response
  2. …
statusCode*integer

The HTTP status code of the response, repeated in the body.

statusDetail*

The status of the request. status is SUCCESS, and message says what happened.

result*

The restored credit.

Example Request
curl -X POST 'https://payments.clocknext.com/api/v1/credits/cr_8f2k1/unarchive'
Example Response
{  "statusCode": 200,  "statusDetail": {    "status": "SUCCESS",    "message": "Credit restored."  },  "result": {    "unarchived": true,    "credit": {      "id": "cmvgvfdp2000708l2vd8r110d",      "name": "Code Review",      "agentKey": "code_review",      "description": "Updated 2026-10-20 — credit description",      "basePrice": 0.0984375,      "modelBundle": [        {          "modelId": "gpt-4o",          "modelName": "GPT-4o",          "input": 75,          "output": 20,          "cache": 5,          "cacheWrite": 0,          "averageTokensPerLLMCall": 25000        }      ],      "marginPercent": 30,      "pricePerCredit": 0.12796875,      "isActive": true,      "createdAt": "2026-10-20T16:01:47.030Z",      "updatedAt": "2026-10-20T16:04:46.067Z"    }  }}

Types

Every object type on this page, with its fields.

Credit

FieldTypeRequiredDescription
idstringyesThe credit's id.
namestringyesThe credit's name. Unique in the workspace, ignoring case.
agentKeystringyesUnique key a credit signal names.
descriptionstring | nullyesOptional note about the credit. null when not set.
basePricenumberyesCost of one credit.
modelBundleModelBundleLine[]yesThe models and token mix that basePrice comes from, one line per model.
marginPercentnumberyesMarkup on basePrice in percent: pricePerCredit = basePrice × (1 + marginPercent / 100). Down to -100.
pricePerCreditnumberyesBase price plus margin.
isActivebooleanyesfalse once archived.
createdAtstringyesWhen the credit was created.
updatedAtstringyesWhen the credit was last changed.

ModelBundleLine

One model in the mix of a credit or outcome step. input, output, cache and cacheWrite are whole percentages of averageTokensPerLLMCall that add up to 100.

FieldTypeRequiredDescription
modelIdstring | nullyesThe model's id, as sent in usage.model. null when the model was removed after the bundle was saved.
modelNamestringyesModel name.
averageTokensPerLLMCallnumberyesAverage tokens per LLM call.
inputintegeryesInput share (%).
outputintegeryesOutput share (%).
cacheintegeryesCache-read share (%).
cacheWriteintegeryesCache-write share (%).

CreateCreditInput

A new credit. Keys use letters, digits, ., _ and - (at most 80) and match exactly. The price per credit is the modelBundle base price × (1 + marginPercent / 100); you never send a price.

FieldTypeRequiredDescription
namestringyesThe credit's name. Must be unique in the workspace, ignoring case (409 if taken).
agentKeystringyesThe key a credit signal names. Unique among your credits (409 if taken).
descriptionstring | nullnoOptional note about the credit. An empty string is saved as null.
marginPercentnumberyesMarkup on the base price, in percent. -100 makes the credit free.
modelBundleModelBundleLineInput[]yesThe models and token mix that the server prices the credit from, one line per model.

ModelBundleLineInput

One model in the mix of a credit or outcome step. input, output, cache and cacheWrite are whole percentages of averageTokensPerLLMCall that add up to 100. cacheWrite is 0 when the model has no cache-write price.

FieldTypeRequiredDescription
modelIdstringyesA model id enabled in your workspace — the id you send as usage.model. An archived model is refused (400).
averageTokensPerLLMCallnumberyesAverage tokens one LLM call to this model uses. Must be above 0. The four shares split these tokens.
inputintegeryesInput-token share of averageTokensPerLLMCall: a whole percent, 0 to 100.
outputintegeryesOutput-token share of averageTokensPerLLMCall: a whole percent, 0 to 100.
cacheintegeryesCache-read share of averageTokensPerLLMCall: a whole percent, 0 to 100.
cacheWriteintegernoCache-write share: a whole percent, 0 to 100. 0 when the model has no cache-write price.

UpdateCreditInput

Only the fields you send change. Keys use letters, digits, ., _ and - (at most 80) and match exactly. Leave modelBundle out, or send [], to keep the saved bundle and price.

FieldTypeRequiredDescription
namestringnoA new name. Must be unique in the workspace, ignoring case (409 if taken).
agentKeystringnoA new key for credit signals. Unique among your credits (409 if taken).
descriptionstring | nullnoA new note. Send null to clear it.
marginPercentnumbernoA new markup, in percent, down to -100. Without a new modelBundle, it applies to the saved base price.
modelBundleModelBundleLineInput[]noThe complete new bundle. A non-empty list prices the credit again at today's model prices.

Packages

Extra entitlements for one price, added to a customer's subscription. A package is always paid in advance. Added as `RECURRING` (the default), it renews with the subscription on its plan's billing cycle until it is removed; added as `ONE_TIME`, it is billed and granted once. It has no billing cycle, billing mode or rollover of its own. It holds credits, outcomes, units, composites and, once at most, wallet money for the customer's Main wallet. Each entitlement must be on the customer's plan as advance (wallet money: an advance wallet). `flatFee` is deprecated: put the fee in the package price. Nothing is deleted — archive instead. Add and remove packages with the [Subscriptions](/docs/api-reference/subscriptions/addSubscriptionPackages) routes. See [Packages](/docs/documentation/packages).

Outcomes

Multi-step deliverables billed per completed outcome. Nothing is deleted — archive instead.