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

API Reference

Paginating results

Page through list endpoints with limit and cursor.

List endpoints — GET /customers, GET /invoices, GET /payments, GET /purchases and GET /subscriptions — 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. Every answer has a nextCursor: the id of the last row on the page. Pass it as the cursor of the next request. When nextCursor is null, you have reached the last page.

A cursor that is not a row of your workspace (a typo, or the id of another kind of record) is a 400 with the message Invalid `cursor`.. It never looks like an empty last page. A row that changed after you read its page (an invoice paid while you page through ?status=OPEN) is still a good cursor: the next page starts right after it.

GET /subscriptions pages by purchase: limit counts purchases, and nextCursor is the purchaseId of the last purchase on the page. A purchase's period rows are never split across two pages, so a page can have more rows than limit.

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

# Next page — cursor is result.nextCursor from the page above
curl "https://payments.clocknext.com/api/v1/customers?limit=50&cursor=cus_abc123" \
  -H "Authorization: Bearer $CLOCKNEXT_API_KEY"

# Invoices, payments, purchases and subscriptions page the same way
curl "https://payments.clocknext.com/api/v1/invoices?limit=50&cursor=inv_abc123" \
  -H "Authorization: Bearer $CLOCKNEXT_API_KEY"

Unknown parameters

On invoices, payments, purchases and subscriptions, a query parameter the list does not know is a 400, for example Unknown parameter `offset`. There is no offset, page, after or startingAfter: page with cursor only.

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 50 on the billing lists and 200 on customers; anything larger is cut to the maximum.

Handling errors

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

Sending data reliably

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 forwardUnknown parameters