AlphaCount Developers
API referenceContracts

Report usage

POST
/contracts/by-ref/{source}/{external_ref}/usage

Up to 500 usage records in one call, all or none. Each external_ref is stored once — the answer counts what was recorded and what was a duplicate, so a retry is safe. Usage before usage_open_from belongs to a period already billed and is refused. Scope partner:usage:write; a metering service needs no other.

Authorization

apiKey partner:usage:write
headerAuthorizationBearer <ab_…>

An API key from Integrations → Connect AI assistants (MCP) → New access, bound to exactly one company. Each operation names the scope the key must carry.

Scope: partner:usage:write

Path Parameters

source*Source
Match^[a-z0-9][a-z0-9_-]{0,49}$
external_ref*External Ref
Match^[A-Za-z0-9][A-Za-z0-9._:@+-]{0,254}$

Header Parameters

AlphaCount-Version?string

The API version to use. Default: the current one.

Request Body

application/json
  1. body
records*array<>
Items1 <= items <= 500

Response Body

OK

application/json
  1. response
duplicates*Duplicates

Records whose external_ref was known already; not stored again.

recorded*Recorded
Example Request
curl -X POST 'https://app.alphacount.ai/api/partner/v1/contracts/by-ref/string/string/usage' \  -H 'Authorization: Bearer ab_...' \  -H 'Content-Type: application/json' \  -d '{  "records": [    {      "external_ref": "u-1",      "item_ref": "tokens",      "occurred_on": "2026-01-10",      "quantity": 1500    },    {      "external_ref": "u-2",      "item_ref": "tokens",      "occurred_on": "2026-01-20",      "quantity": 500    },    {      "external_ref": "u-2",      "item_ref": "tokens",      "occurred_on": "2026-01-20",      "quantity": 500    }  ]}'
Example Response
{  "duplicates": 1,  "recorded": 2}