ClocknextHelp
DocumentationAPI ReferenceMCP Tools
Dashboard

Get started

OverviewQuickstart

Core concepts

The response envelopeErrorsPaginationAsync, flushing & reliability

API reference

Record Signals POSTRecord usage logs POST
List customers GETCreate a customer POSTGet a customer GETUpdate a customer PATCHDelete a customer DELETEGet a customer's balances GETGet a customer's current plan GETList a customer's wallet transactions GETAdd a wallet transaction POSTAdjust a customer's credit balance POSTAdjust a customer's outcome balance POSTAdjust a customer's unit balance POST
List a customer's members GETAdd a member POSTUpdate a member PATCHRemove a member DELETE
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
Mint a customer-portal access token POST

API Reference

Pagination

Page through list endpoints with limit and cursor.

List endpoints — such as GET /customers, GET /invoices, and GET /payments — return one page at a time and page forward with a cursor. Cursor paging is stable while rows are being inserted: you never skip or repeat a record the way offset paging can.

Query parameters

Prop

Type

Some list endpoints add their own filters on top — for example customers accepts q (a case-insensitive match on name or email), and catalogue endpoints accept active=true to return only active records. See each endpoint's page for the full parameter list.

Paging forward

Request the first page, then pass the id of the last row you received as the cursor for the next request. When a page returns fewer rows than limit, you've reached the end.

# First page
curl "https://payments.clocknext.com/api/v1/customers?limit=50" \
  -H "Authorization: Bearer $CLOCKNEXT_API_KEY"

# Next page — cursor is the last id from the page above
curl "https://payments.clocknext.com/api/v1/customers?limit=50&cursor=cus_abc123" \
  -H "Authorization: Bearer $CLOCKNEXT_API_KEY"
// One page at a time
const page = await cnk.customers.list({ limit: 50, q: "ac" });

// Or let the SDK follow the cursor for you across every page
for await (const customer of cnk.customers.iterate()) {
  console.log(customer.id);
}

The @clocknext/sdk client exposes list() for a single page and iterate() (an async iterator) that walks the whole set, so you rarely touch the cursor by hand.

Keep limit modest (the default of 50 is a good start) and let the cursor walk the full set, rather than requesting a huge page. The maximum is 200; anything larger is clamped.

Errors

Every status code the API returns, what it means, and how to handle it.

Async, flushing & reliability

How the SDK sends signals — buffered by default, with retries, idempotency, and the flush() you must call before a serverless function exits.

On this page

Query parametersPaging forward