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

Get a customer's balances using customer Id

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

GET
/customers/{id}/balances

Wallet, credit, outcome, unit and composite balances, each split into the plan's part and its packages. wallet.reservedBalance is there only when the Reserved Wallet is on. used and remaining cover the cycle billed now (a unit: the whole purchase). With no plan, or one not started, hasPlan is false.

Authorization

apiKey
headerAuthorizationBearer <cnk_…>

Organisation-scoped key from Settings → API Keys.

Path Parameters

id*string

Customer id.

Response Body

Balances.

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 customer's current balances: the Wallet and each entitlement.

Example Request
curl -X GET 'https://payments.clocknext.com/api/v1/customers/cus_abc123/balances'
Example Response
{  "statusCode": 200,  "statusDetail": {    "status": "SUCCESS",    "message": "Request processed successfully."  },  "result": {    "customerId": "cmvgva5po000c07iir1vtn8vl",    "currency": {      "code": "USD",      "rateUsd": 1    },    "hasPlan": true,    "wallet": {      "balance": 129.381975,      "reservedBalance": 60,      "planGranted": 100,      "planRemaining": 129.381975,      "packages": []    },    "credits": [      {        "creditId": "cmvgvfdfz000608l2wsff83hq",        "agentKey": "deep_research",        "creditName": "Deep Research",        "granted": 200,        "used": 0.968044,        "remaining": 79.031956,        "originalGranted": null,        "planGranted": 200,        "planRemaining": 79.031956,        "packages": []      },      {        "creditId": "cmvgvfd63000508l2oexbgpzs",        "agentKey": "chat_message",        "creditName": "Chat Message",        "granted": 6000,        "used": 6.291667,        "remaining": 6493.708333,        "originalGranted": 5000,        "planGranted": 6000,        "planRemaining": 6493.708333,        "packages": []      }    ],    "outcomes": [      {        "outcomeId": "cmvgvffng000808l237059in9",        "outcomeName": "Resolved Support Ticket",        "granted": 600,        "remaining": 647,        "steps": [          {            "id": "cmvgvffnr000908l2m3xv3z3b",            "name": "Triage",            "agentKey": "support_ticket.triage"          },          {            "id": "cmvgvffnr000a08l26a3xw691",            "name": "Draft reply",            "agentKey": "support_ticket.draft"          },          {            "id": "cmvgvffnr000b08l2kzcwdx9f",            "name": "QA check",            "agentKey": "support_ticket.qa"          }        ],        "originalGranted": 500,        "planGranted": 600,        "planRemaining": 647,        "packages": []      }    ],    "units": [      {        "unitId": "cmvgv92mk000n08l5jjjxnnul",        "agentKey": "pdf_export",        "unitName": "PDF Export",        "granted": 250,        "remaining": 268,        "originalGranted": 200,        "planGranted": 250,        "planRemaining": 268,        "packages": []      },      {        "unitId": "cmvgv93fx000007iiew8xnjd8",        "agentKey": "seat",        "unitName": "Seat",        "granted": 10,        "remaining": 7,        "originalGranted": null,        "planGranted": 10,        "planRemaining": 7,        "packages": []      }    ],    "composites": [      {        "compositeId": "cmvgvfgqe000f08l219wzyt7v",        "refId": "voice_call",        "name": "Voice AI Call",        "granted": 120,        "used": 1,        "remaining": 129,        "originalGranted": 100,        "planGranted": 120,        "planRemaining": 129,        "packages": []      }    ]  }}

Get a customer's balances using external Id

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

GET
/customers/ext/{externalId}/balances

The same call, addressed by the customer's externalId. Same response.

Authorization

apiKey
headerAuthorizationBearer <cnk_…>

Organisation-scoped key from Settings → API Keys.

Path Parameters

externalId*string

Your own id for the customer: 1–64 letters, numbers or "-". Case-sensitive.

Match^[A-Za-z0-9-]{1,64}$
Length1 <= length <= 64

Response Body

Balances.

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 customer's current balances: the Wallet and each entitlement.

Example Request
curl -X GET 'https://payments.clocknext.com/api/v1/customers/ext/string/balances'
Example Response
{  "statusCode": 200,  "statusDetail": {    "status": "SUCCESS",    "message": "Request processed successfully."  },  "result": {    "customerId": "cmvgva5po000c07iir1vtn8vl",    "currency": {      "code": "USD",      "rateUsd": 1    },    "hasPlan": true,    "wallet": {      "balance": 50,      "planGranted": 50,      "planRemaining": 50,      "packages": []    },    "credits": [      {        "creditId": "cmvgvfd63000508l2oexbgpzs",        "agentKey": "chat_message",        "creditName": "Chat Message",        "granted": 5000,        "used": 0,        "remaining": 5000,        "originalGranted": null,        "planGranted": 5000,        "planRemaining": 5000,        "packages": []      },      {        "creditId": "cmvgvfdfz000608l2wsff83hq",        "agentKey": "deep_research",        "creditName": "Deep Research",        "granted": 200,        "used": 0,        "remaining": 200,        "originalGranted": null,        "planGranted": 200,        "planRemaining": 200,        "packages": []      }    ],    "outcomes": [      {        "outcomeId": "cmvgvffng000808l237059in9",        "outcomeName": "Resolved Support Ticket",        "granted": 500,        "remaining": 500,        "steps": [          {            "id": "cmvgvffnr000908l2m3xv3z3b",            "name": "Triage",            "agentKey": "support_ticket.triage"          },          {            "id": "cmvgvffnr000a08l26a3xw691",            "name": "Draft reply",            "agentKey": "support_ticket.draft"          },          {            "id": "cmvgvffnr000b08l2kzcwdx9f",            "name": "QA check",            "agentKey": "support_ticket.qa"          }        ],        "originalGranted": null,        "planGranted": 500,        "planRemaining": 500,        "packages": []      }    ],    "units": [      {        "unitId": "cmvgv92mk000n08l5jjjxnnul",        "agentKey": "pdf_export",        "unitName": "PDF Export",        "granted": 200,        "remaining": 200,        "originalGranted": null,        "planGranted": 200,        "planRemaining": 200,        "packages": []      },      {        "unitId": "cmvgv93fx000007iiew8xnjd8",        "agentKey": "seat",        "unitName": "Seat",        "granted": 10,        "remaining": 10,        "originalGranted": null,        "planGranted": 10,        "planRemaining": 10,        "packages": []      }    ],    "composites": [      {        "compositeId": "cmvgvfgqe000f08l219wzyt7v",        "refId": "voice_call",        "name": "Voice AI Call",        "granted": 100,        "used": 0,        "remaining": 100,        "originalGranted": null,        "planGranted": 100,        "planRemaining": 100,        "packages": []      }    ]  }}

Types

Every object type on this page, with its fields.

CustomerBalances

FieldTypeRequiredDescription
customerIdstringyesThe customer's ClockNext id.
currencyCurrencyyesThe currency of the amounts: always USD, at a rate of 1.
hasPlanbooleanyestrue when a plan has started or waits to start. When false, the balance lists are empty.
walletobjectyesBoth wallet balances, in USD. Always returned.
creditsobject[]yesThe prepaid (ADVANCE) credits on the customer's plan. A credit billed in ARREAR is not listed.
outcomesobject[]yesThe prepaid (ADVANCE) outcomes on the customer's plan. An outcome billed in ARREAR is not listed.
unitsobject[]yesThe prepaid (ADVANCE) units on the customer's plan. A unit billed in ARREAR is not listed.
compositesobject[]yesThe prepaid (ADVANCE) composite pools on the plan. An ARREAR composite has no pool.

Currency

FieldTypeRequiredDescription
codestringyesAlways USD: every amount in the response is in USD.
rateUsdnumberyesAlways 1.

CustomerBalances.wallet

Both wallet balances, in USD. Always returned.

FieldTypeRequiredDescription
balancenumberyesThe ordinary Wallet. Always present, also with no plan or no Wallet line. May be negative.
reservedBalancenumbernoThe Reserved Wallet. Left out when the workspace has it off. Never negative.
planGrantednumberyesThe plan's wallet top-up of each cycle. 0 with no plan or no advance wallet.
planRemainingnumberyesThe plan's part of balance, adjustments and portal top-ups included. Can be negative.
packagesWalletPackageShare[]yesThe running packages that hold wallet money, oldest first. [] when none.

WalletPackageShare

The wallet money of one running package, in USD. The plan's wallet money is used first, then the packages from the oldest attach.

FieldTypeRequiredDescription
purchasePackageIdstringyesThe package's id on the subscription (packages[].id of the subscription).
packageIdstring | nullyesThe package in the catalog. null when it no longer exists.
namestringyesThe package's name.
quantitynumberyesThe wallet money that the package grants, in USD.
term"RECURRING" | "ONE_TIME"yesRECURRING renews with the plan. ONE_TIME is granted once.
allocatednumberyesThis cycle's wallet money of the package, in USD: the grant, plus what rolled over.
consumednumberyesWhat was used of allocated up to now, in USD. Live. The plan is used first.
remainingnumberyesWhat is left of it now, in USD. Never negative.
status"ACTIVE" | "MARKED_FOR_CANCELLATION"yesMARKED_FOR_CANCELLATION: it ends at the end of the billing cycle.
startedAtstring | nullyesWhen its invoice was paid.

CustomerBalances.credits

FieldTypeRequiredDescription
creditIdstringyesThe credit's id.
agentKeystringyesThe credit's agent key: the key signals and the adjust API use for it.
creditNamestringyesThe credit's name on the plan.
grantednumberyesThe credits granted this cycle, the plan's and each running package's.
usednumberyesCredits used this cycle.
remainingnumberyesThe credits left now. Can be negative: usage past the balance is allowed.
originalGrantednumber | nullyesWhat granted was before it was ever resized for this customer; null if it never was.
planGrantednumberyesThe plan's part of granted, packages left out.
planRemainingnumberyesThe plan's part of remaining: the plan is used first. Can be negative.
packagesBalancePackageShare[]yesThe running packages that add to this balance, oldest first. [] when none.

BalancePackageShare

What one running package adds to a balance. The plan is used first, then the packages from the oldest attach.

FieldTypeRequiredDescription
purchasePackageIdstringyesThe package's id on the subscription (packages[].id of the subscription).
packageIdstring | nullyesThe package in the catalog. null when it no longer exists.
namestringyesThe package's name.
quantitynumberyesThe package's grant each cycle.
term"RECURRING" | "ONE_TIME"yesRECURRING renews with the plan. ONE_TIME is granted once.
allocatednumberyesThis cycle's allocation: the grant, plus what rolled over.
consumednumberyesWhat was used of allocated up to now, the plan used first.
remainingnumberyesWhat is left of it now. Never negative.
status"ACTIVE" | "MARKED_FOR_CANCELLATION"yesMARKED_FOR_CANCELLATION: it ends at endsAt.
startedAtstring | nullyesWhen its invoice was paid.
invoiceNumberstring | nullyesThe invoice that started it.
endsAtstring | nullyesWhen a MARKED_FOR_CANCELLATION package ends. null while ACTIVE.

CustomerBalances.outcomes

FieldTypeRequiredDescription
outcomeIdstringyesThe outcome's id.
outcomeNamestringyesThe outcome's name on the plan.
grantednumberyesThe outcomes granted this cycle (per-member seat plan: one member's grant × members), packages included.
remainingnumberyesThe outcomes left now.
originalGrantednumber | nullyesWhat granted was before it was ever resized; null if it never was.
planGrantednumberyesThe plan's part of granted, packages left out.
planRemainingnumberyesThe plan's part of remaining: the plan is used first. Can be negative.
packagesBalancePackageShare[]yesThe running packages that add to this balance, oldest first. [] when none.
stepsobject[]yesThe outcome's steps, in order.

CustomerBalances.outcomes.steps

FieldTypeRequiredDescription
idstringyesThe step's id.
namestringyesThe step's name.
agentKeystringyesThe step's agent key: the key signals and the adjust API use for this outcome.

CustomerBalances.units

FieldTypeRequiredDescription
unitIdstringyesThe unit's id.
agentKeystringyesThe unit's agent key: the key signals and the adjust API use for it.
unitNamestringyesThe unit's name on the plan.
grantednumberyesThe units granted (the plan's and each running package's). Usage and top-ups do not change it.
remainingnumberyesThe units left now. Can be more than granted after a top-up.
originalGrantednumber | nullyesWhat granted was before it was ever resized; null if it never was.
planGrantednumberyesThe plan's part of granted, packages left out.
planRemainingnumberyesThe plan's part of remaining: the plan is used first. Can be negative.
packagesBalancePackageShare[]yesThe running packages that add to this balance, oldest first. [] when none.

CustomerBalances.composites

FieldTypeRequiredDescription
compositeIdstringyesThe composite's id.
refIdstringyesThe tag your signals send in their composite block.
namestringyesThe composite's name.
grantednumberyesThe pool size this cycle, the plan's and each running package's.
usednumberyesCompletions counted this cycle. Every completion counts one, also a repeat of the same composite value.
remainingnumberyesgranted − used + this cycle's adjustments. May be negative; the overrun carries into the next cycle.
originalGrantednumber | nullyesWhat granted was before the pool was ever resized for this customer; null if it never was.
planGrantednumberyesThe plan's part of granted, packages left out.
planRemainingnumberyesThe plan's part of remaining: the plan is used first. Can be negative.
packagesBalancePackageShare[]yesThe running packages that add to this balance, oldest first. [] when none.

Delete a customer DELETE

Previous Page

Get a customer's wallet ledger GET

Next Page