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 current plan using customer Id

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

GET
/customers/{id}/plan

The customer's plan as its purchase froze it: the terms, the cycle billed now, and each entitlement with its grant per cycle and price. Usage is in Get a customer's balances. plan is null when the customer has no purchase.

Authorization

apiKey
headerAuthorizationBearer <cnk_…>

Organisation-scoped key from Settings → API Keys.

Path Parameters

id*string

Customer id.

Response Body

The customer's current plan.

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 currency and current plan. plan is null when the customer has no plan.

Example Request
curl -X GET 'https://payments.clocknext.com/api/v1/customers/cus_abc123/plan'
Example Response
{  "statusCode": 200,  "statusDetail": {    "status": "SUCCESS",    "message": "Request processed successfully."  },  "result": {    "customerId": "cmvgva5po000c07iir1vtn8vl",    "currency": {      "code": "USD",      "rateUsd": 1    },    "plan": {      "purchaseId": "cmvgvkmxz002h08l2h2i1dnsr",      "reference": "SUB-001",      "planId": "cmvgvg2yq000s08l21gkr472h",      "planName": "Pro",      "status": "COMPLETED",      "active": true,      "billingCycle": "MONTHLY",      "currencyCode": "USD",      "cost": 499,      "useWalletForArrear": true,      "autoPayment": false,      "startsAt": "2026-10-20T00:00:00.000Z",      "cancelRequestedAt": null,      "endsAt": null,      "cycle": {        "index": 0,        "start": "2026-10-20T00:00:00.000Z",        "end": "2026-11-20T00:00:00.000Z"      },      "entitlements": {        "credit": [          {            "id": "cmvgvfd63000508l2oexbgpzs",            "name": "Chat Message",            "agentKey": "chat_message",            "billingMode": "ADVANCE",            "recurringQuantity": 6000,            "allocatedQuantity": 5000,            "rollover": true,            "pricePerCredit": 0.001197          },          {            "id": "cmvgvfdfz000608l2wsff83hq",            "name": "Deep Research",            "agentKey": "deep_research",            "billingMode": "ADVANCE",            "recurringQuantity": 200,            "allocatedQuantity": 200,            "rollover": false,            "pricePerCredit": 0.8498125          },          {            "id": "cmvgvfdp2000708l2vd8r110d",            "name": "Code Review",            "agentKey": "code_review",            "billingMode": "ARREAR",            "recurringQuantity": null,            "allocatedQuantity": null,            "rollover": false,            "pricePerCredit": 0.145546875          }        ],        "outcome": [          {            "id": "cmvgvffng000808l237059in9",            "name": "Resolved Support Ticket",            "agentKey": "support_ticket",            "billingMode": "ADVANCE",            "recurringQuantity": 600,            "allocatedQuantity": 500,            "rollover": true,            "pricePerOutcome": 0.1260225          },          {            "id": "cmvgvffxr000c08l28wch48fa",            "name": "Contract Review",            "agentKey": "contract_review",            "billingMode": "ARREAR",            "recurringQuantity": null,            "allocatedQuantity": null,            "rollover": false,            "pricePerOutcome": 0.9316          }        ],        "unit": [          {            "id": "cmvgv92mk000n08l5jjjxnnul",            "name": "PDF Export",            "agentKey": "pdf_export",            "billingMode": "ADVANCE",            "recurringQuantity": 250,            "allocatedQuantity": 200,            "pricingType": "FLAT",            "flatPrice": 0.25,            "tiers": []          },          {            "id": "cmvgv92vf000o08l5qnqm39eo",            "name": "Voice Minute",            "agentKey": "voice_minute",            "billingMode": "ARREAR",            "recurringQuantity": null,            "allocatedQuantity": null,            "pricingType": "FLAT",            "flatPrice": 0.06,            "tiers": []          },          {            "id": "cmvgv9342000p08l59sk1lk51",            "name": "Web Scrape",            "agentKey": "web_scrape",            "billingMode": "ARREAR",            "recurringQuantity": null,            "allocatedQuantity": null,            "pricingType": "SLAB",            "flatPrice": 0,            "tiers": [              {                "upTo": 1000,                "price": 0.012              },              {                "upTo": 5000,                "price": 0.009              },              {                "upTo": null,                "price": 0.006              }            ]          },          {            "id": "cmvgv93fx000007iiew8xnjd8",            "name": "Seat",            "agentKey": "seat",            "billingMode": "ADVANCE",            "recurringQuantity": 10,            "allocatedQuantity": 10,            "pricingType": "VOLUME",            "flatPrice": 0,            "tiers": [              {                "upTo": 10,                "price": 12              },              {                "upTo": 50,                "price": 10              },              {                "upTo": null,                "price": 8              }            ]          }        ],        "composite": [          {            "id": "cmvgvfgqe000f08l219wzyt7v",            "name": "Voice AI Call",            "refId": "voice_call",            "billingMode": "ADVANCE",            "recurringQuantity": 120,            "allocatedQuantity": 100,            "rollover": true,            "pricePerComposite": 1.75          },          {            "id": "cmvgvfh1e000i08l2oi7oozop",            "name": "Research Report",            "refId": "research_report",            "billingMode": "ARREAR",            "recurringQuantity": null,            "allocatedQuantity": null,            "rollover": false,            "pricePerComposite": 12          }        ],        "wallet": {          "billingMode": "ADVANCE",          "recurringAmount": 75,          "allocatedAmount": 50,          "rollover": true        },        "flat": null      }    }  }}

Get a customer's current plan using external Id

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

GET
/customers/ext/{externalId}/plan

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

The customer's current plan.

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 currency and current plan. plan is null when the customer has no plan.

Example Request
curl -X GET 'https://payments.clocknext.com/api/v1/customers/ext/string/plan'
Example Response
{  "statusCode": 200,  "statusDetail": {    "status": "SUCCESS",    "message": "Request processed successfully."  },  "result": {    "customerId": "cmvgva5po000c07iir1vtn8vl",    "currency": {      "code": "USD",      "rateUsd": 1    },    "plan": {      "purchaseId": "cmvgvkmxz002h08l2h2i1dnsr",      "reference": "SUB-001",      "planId": "cmvgvg2yq000s08l21gkr472h",      "planName": "Pro",      "status": "COMPLETED",      "active": true,      "billingCycle": "MONTHLY",      "currencyCode": "USD",      "cost": 499,      "useWalletForArrear": true,      "autoPayment": false,      "startsAt": "2026-10-20T00:00:00.000Z",      "cancelRequestedAt": null,      "endsAt": null,      "cycle": {        "index": 0,        "start": "2026-10-20T00:00:00.000Z",        "end": "2026-11-20T00:00:00.000Z"      },      "entitlements": {        "credit": [          {            "id": "cmvgvfd63000508l2oexbgpzs",            "name": "Chat Message",            "agentKey": "chat_message",            "billingMode": "ADVANCE",            "recurringQuantity": 5000,            "allocatedQuantity": 5000,            "rollover": true,            "pricePerCredit": 0.001197          },          {            "id": "cmvgvfdfz000608l2wsff83hq",            "name": "Deep Research",            "agentKey": "deep_research",            "billingMode": "ADVANCE",            "recurringQuantity": 200,            "allocatedQuantity": 200,            "rollover": false,            "pricePerCredit": 0.8498125          },          {            "id": "cmvgvfdp2000708l2vd8r110d",            "name": "Code Review",            "agentKey": "code_review",            "billingMode": "ARREAR",            "recurringQuantity": null,            "allocatedQuantity": null,            "rollover": false,            "pricePerCredit": 0.145546875          }        ],        "outcome": [          {            "id": "cmvgvffng000808l237059in9",            "name": "Resolved Support Ticket",            "agentKey": "support_ticket",            "billingMode": "ADVANCE",            "recurringQuantity": 500,            "allocatedQuantity": 500,            "rollover": true,            "pricePerOutcome": 0.1260225          },          {            "id": "cmvgvffxr000c08l28wch48fa",            "name": "Contract Review",            "agentKey": "contract_review",            "billingMode": "ARREAR",            "recurringQuantity": null,            "allocatedQuantity": null,            "rollover": false,            "pricePerOutcome": 0.9316          }        ],        "unit": [          {            "id": "cmvgv92mk000n08l5jjjxnnul",            "name": "PDF Export",            "agentKey": "pdf_export",            "billingMode": "ADVANCE",            "recurringQuantity": 200,            "allocatedQuantity": 200,            "pricingType": "FLAT",            "flatPrice": 0.25,            "tiers": []          },          {            "id": "cmvgv92vf000o08l5qnqm39eo",            "name": "Voice Minute",            "agentKey": "voice_minute",            "billingMode": "ARREAR",            "recurringQuantity": null,            "allocatedQuantity": null,            "pricingType": "FLAT",            "flatPrice": 0.06,            "tiers": []          },          {            "id": "cmvgv9342000p08l59sk1lk51",            "name": "Web Scrape",            "agentKey": "web_scrape",            "billingMode": "ARREAR",            "recurringQuantity": null,            "allocatedQuantity": null,            "pricingType": "SLAB",            "flatPrice": 0,            "tiers": [              {                "upTo": 1000,                "price": 0.012              },              {                "upTo": 5000,                "price": 0.009              },              {                "upTo": null,                "price": 0.006              }            ]          },          {            "id": "cmvgv93fx000007iiew8xnjd8",            "name": "Seat",            "agentKey": "seat",            "billingMode": "ADVANCE",            "recurringQuantity": 10,            "allocatedQuantity": 10,            "pricingType": "VOLUME",            "flatPrice": 0,            "tiers": [              {                "upTo": 10,                "price": 12              },              {                "upTo": 50,                "price": 10              },              {                "upTo": null,                "price": 8              }            ]          }        ],        "composite": [          {            "id": "cmvgvfgqe000f08l219wzyt7v",            "name": "Voice AI Call",            "refId": "voice_call",            "billingMode": "ADVANCE",            "recurringQuantity": 100,            "allocatedQuantity": 100,            "rollover": true,            "pricePerComposite": 1.75          },          {            "id": "cmvgvfh1e000i08l2oi7oozop",            "name": "Research Report",            "refId": "research_report",            "billingMode": "ARREAR",            "recurringQuantity": null,            "allocatedQuantity": null,            "rollover": false,            "pricePerComposite": 12          }        ],        "wallet": {          "billingMode": "ADVANCE",          "recurringAmount": 50,          "allocatedAmount": 50,          "rollover": true        },        "flat": null      }    }  }}

Types

Every object type on this page, with its fields.

CustomerPlanSummary

FieldTypeRequiredDescription
customerIdstringyesThe customer's ClockNext id.
currencyCurrencyyesThe currency of the amounts: always USD, at a rate of 1.
planCustomerPlan | nullyesThe customer's plan, a started one before one that waits to start. null when there is none.

Currency

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

CustomerPlan

The plan a customer is on, as its purchase froze it. No usage.

FieldTypeRequiredDescription
purchaseIdstringyesThe id of the purchase that put the customer on this plan.
referencestring | nullyesThe purchase's reference: its subscription number (SUB-…), else its purchase number (PUR-…).
planIdstring | nullyesThe plan's id. null when the plan no longer exists.
planNamestringyesThe plan's name when it was bought.
status"COMPLETED" | "PENDING"yesBy payment: COMPLETED once the first invoice is paid (or none is due), else PENDING. See active.
activebooleanyestrue once the plan has started. false while it waits to start.
billingCycle"MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "YEARLY" | "FREE"yesHow often the plan bills. FREE has no end to its cycle.
currencyCodestringyesThe ISO 4217 code of the purchase's currency.
costnumberyesWhat one cycle of the plan costs, any rounding included.
useWalletForArrearbooleanyestrue when usage billed in arrears is paid from the wallet as it happens, instead of on an invoice.
autoPaymentbooleanyestrue when invoices are charged to the customer's saved card.
startsAtstringyesWhen the plan starts (or started): its subscription date when the purchase has one, else its billing date.
cancelRequestedAtstring | nullyesWhen the plan was marked for cancellation. null when it is not.
endsAtstring | nullyesWhen the plan ends: set once it is marked for cancellation or replaced by a plan change. null otherwise.
cycleobjectyesThe billing cycle billed now.
entitlementsCustomerPlanEntitlementsyesEvery entitlement on the plan, grouped by kind.

CustomerPlan.cycle

The billing cycle billed now.

FieldTypeRequiredDescription
indexintegeryesThe cycle's number, counted from 0.
startstringyesWhen the cycle started.
endstring | nullyesWhen the cycle ends. null on a FREE plan.

CustomerPlanEntitlements

Every entitlement on the plan, grouped by kind. recurringQuantity is what each cycle grants now (a unit: the whole purchase); allocatedQuantity is what the purchase granted at first. Both are null on an ARREAR line.

FieldTypeRequiredDescription
creditobject[]yesThe credits the plan sells.
outcomeobject[]yesThe outcomes the plan sells.
unitobject[]yesThe units the plan sells.
compositeobject[]yesThe composites the plan sells.
walletobject | nullyesThe wallet line. null when the plan has none.
flatobject | nullyesThe flat fee. null when the plan has none.

CustomerPlanEntitlements.credit

FieldTypeRequiredDescription
idstringyesThe credit's id.
namestring | nullyesThe credit's name now, or the name frozen at purchase if it was removed. The same on every line.
agentKeystring | nullyesThe key signals name it by.
billingMode"ADVANCE" | "ARREAR"yesADVANCE grants credits up front each cycle. ARREAR bills credits after use.
recurringQuantitynumber | nullyesThe credits each cycle grants now. null on an ARREAR line.
allocatedQuantitynumber | nullyesThe credits each cycle granted at purchase, before any resize. null on an ARREAR line.
rolloverbooleanyestrue when an unused balance carries into the next cycle.
pricePerCreditnumber | nullyesThe price per credit, frozen at purchase.

CustomerPlanEntitlements.outcome

FieldTypeRequiredDescription
idstringyesThe outcome's id.
namestring | nullyesThe outcome's name now, or the name frozen at purchase when the outcome no longer exists.
agentKeystring | nullyesThe outcome's own key (not a step's).
billingMode"ADVANCE" | "ARREAR"yesADVANCE grants outcomes up front each cycle. ARREAR bills outcomes after use.
recurringQuantitynumber | nullyesThe outcomes each cycle grants now. null on an ARREAR line.
allocatedQuantitynumber | nullyesThe outcomes each cycle granted at purchase, before any resize. null on an ARREAR line.
rolloverbooleanyestrue when an unused balance carries into the next cycle.
pricePerOutcomenumber | nullyesThe price per outcome, frozen at purchase.

CustomerPlanEntitlements.unit

FieldTypeRequiredDescription
idstringyesThe unit's id.
namestring | nullyesThe unit's name now, or the name frozen at purchase when the unit no longer exists.
agentKeystring | nullyesThe key signals name it by.
billingMode"ADVANCE" | "ARREAR"yesADVANCE grants units up front. ARREAR bills units after use.
recurringQuantitynumber | nullyesThe units the whole purchase grants now. null on an ARREAR line.
allocatedQuantitynumber | nullyesThe units the purchase granted at the start, before any resize. null on an ARREAR line.
pricingType"FLAT" | "SLAB" | "VOLUME" | nullyesHow the unit is priced, frozen at purchase. FLAT uses flatPrice. SLAB and VOLUME use tiers.
flatPricenumber | nullyesThe price per unit when pricingType is FLAT.
tiersobject[]yesThe tier ladder, frozen at purchase, in order. Empty when the unit has none.

CustomerPlanEntitlements.unit.tiers

FieldTypeRequiredDescription
upTonumber | nullyesThe last unit of the tier. null on the last tier.
pricenumberyesThe price per unit in this tier, frozen at purchase.

CustomerPlanEntitlements.composite

FieldTypeRequiredDescription
idstringyesThe composite's id.
namestring | nullyesThe composite's name now, or the name frozen at purchase when the composite no longer exists.
refIdstring | nullyesThe tag your signals send in their composite block.
billingMode"ADVANCE" | "ARREAR"yesADVANCE grants a pool of composites up front each cycle. ARREAR bills composites after use.
recurringQuantitynumber | nullyesThe composites each cycle grants now. null on an ARREAR line.
allocatedQuantitynumber | nullyesThe composites each cycle granted at purchase, before any resize. null on an ARREAR line.
rolloverbooleanyestrue when an unused balance carries into the next cycle.
pricePerCompositenumber | nullyesThe price per composite, frozen at purchase.

CustomerPlanEntitlements.wallet

FieldTypeRequiredDescription
billingMode"ADVANCE" | "ARREAR"yesADVANCE puts money in the wallet each cycle. ARREAR gives no money up front.
recurringAmountnumber | nullyesUSD the wallet gets every cycle now. null on an ARREAR wallet.
allocatedAmountnumber | nullyesUSD the plan gave every cycle at purchase, before any resize. null on an ARREAR wallet.
rolloverbooleanyestrue when unused wallet money carries into the next cycle.

CustomerPlanEntitlements.flat

FieldTypeRequiredDescription
amountnumber | nullyesThe flat fee, frozen at purchase.

Set a customer's low-balance alert for wallet PUT

Previous Page

Change a recurring grant PUT

Next Page