AlphaCount Developers
API referenceContracts

Retrieve a contract

GET
/contracts/by-ref/{source}/{external_ref}

The contract with its items, its next billing date, usage_open_from and the cycles billed so far with their invoices. Scope partner:contracts:read.

Authorization

apiKey partner:contracts:read
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:contracts:read

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.

Response Body

OK

application/json
  1. response
billing_interval*Billing Interval
Value in"month""quarter""year"
billing_starts_on*|null
customer_external_ref*string|null
cycles*array<>
end_date*|null
external_ref*string|null
external_source*string|null
id*Id
invoice_mode*Invoice Mode
Value in"draft""issue""issue_send"
items*array<>
name*Name
next_billing_date*|null
number*Number
payment_terms_days*integer|null
start_date*Start Date
Formatdate
status*Status
Value in"draft""active""paused""cancelled""ended"
usage_open_from*|

Usage before this day is billed already and refused.

Example Request
curl -X GET 'https://app.alphacount.ai/api/partner/v1/contracts/by-ref/string/string' \  -H 'Authorization: Bearer ab_...'
Example Response
{  "billing_interval": "month",  "billing_starts_on": null,  "customer_external_ref": "school-7",  "cycles": [    {      "end": "2026-01-31",      "invoice_id": "00000000-0000-4000-8000-000000000002",      "invoice_number": null,      "invoice_status": "draft",      "start": "2026-01-01",      "status": "billed",      "total_net": "425.00"    },    {      "end": "2026-02-28",      "invoice_id": "00000000-0000-4000-8000-000000000003",      "invoice_number": null,      "invoice_status": "draft",      "start": "2026-02-01",      "status": "billed",      "total_net": "825.00"    }  ],  "end_date": null,  "external_ref": "c-7",  "external_source": "alphalearn",  "id": "00000000-0000-4000-8000-000000000001",  "invoice_mode": "draft",  "items": [    {      "billing_timing": "advance",      "description": "Seat",      "ends_after": null,      "pricing_model": "per_unit",      "product_ref": "seat",      "quantity": "10",      "ref": "seats",      "unit_price_net": "12.50"    },    {      "billing_timing": "arrears",      "description": "Token",      "ends_after": null,      "pricing_model": "per_unit",      "product_ref": "tokens",      "quantity": "0",      "ref": "tokens",      "unit_price_net": "0.20"    },    {      "billing_timing": "advance",      "description": "SLA",      "ends_after": null,      "pricing_model": "flat",      "product_ref": "sla",      "quantity": "1",      "ref": "sla",      "unit_price_net": "300.00"    }  ],  "name": "Lernplattform",  "next_billing_date": "2026-03-01",  "number": "VT-2026-0001",  "payment_terms_days": null,  "start_date": "2026-01-01",  "status": "active",  "usage_open_from": "2026-02-01"}