Consumption analytics and the organization's view of its subscription, billing profile, and invoices.
Common responses
These responses apply across endpoints in this section unless an endpoint documents an additional response.
Status
Meaning
Body
200
Request succeeded.
Endpoint response object.
201
Resource created.
Created resource object.
400
Invalid request.
Error envelope.
401
Missing or invalid bearer token.
Error envelope.
404
Resource not found or not visible to the current organization.
Error envelope.
Usage
Get usage summary
Get a one-shot cost and token summary for the given date range, plus a delta percentage versus the preceding period of equal length. The `from` and `to` dates are inclusive; the range must be ≤ 365 days.
GET/v1/organization/usage/summary
Query parameters
Name
Type
Required
Description
from
string
Required
Start date in `YYYY-MM-DD` format (inclusive).
to
string
Required
End date in `YYYY-MM-DD` format (inclusive). Must be on or after `from`.
Get cost and token usage bucketed over time for charting. Use `granularity=daily` (default) for ranges up to 365 days, or `granularity=hourly` for ranges up to 7 days (168 hours).
GET/v1/organization/usage/timeseries
Query parameters
Name
Type
Required
Description
from
string
Required
Start date in `YYYY-MM-DD` format (inclusive).
to
string
Required
End date in `YYYY-MM-DD` format (inclusive).
granularity
string
Optional
Bucket size. One of: `daily` (default), `hourly`. Hourly is capped at a 168-hour window.
Get cost and call-count broken down by a single dimension. Results are sorted by cost descending and capped at 50 rows. `percentOfTotal` is a percentage (0–100) rounded to one decimal place.
GET/v1/organization/usage/breakdown
Query parameters
Name
Type
Required
Description
from
string
Required
Start date in `YYYY-MM-DD` format (inclusive).
to
string
Required
End date in `YYYY-MM-DD` format (inclusive).
dimension
string
Required
Breakdown dimension. One of: `model`, `agent`, `channel`, `department`, `user`.
Spend over time grouped by `department` or `user`. Returns the top-N values by total spend (default 6, max 20) as per-bucket series aligned to a `buckets` array spanning the full range, plus an `Other` series aggregating the rest (and any unattributed spend). Powers the Spending dashboard's per-dimension over-time charts.
GET/v1/organization/usage/timeseries-by
Query parameters
Name
Type
Required
Description
from
string
Required
Start date `YYYY-MM-DD` (inclusive).
to
string
Required
End date `YYYY-MM-DD` (inclusive).
granularity
string
Optional
`daily` (default) or `hourly` (hourly capped at 168 hours).
dimension
string
Required
`department` or `user`.
limit
number
Optional
Top-N series to return (default 6, max 20); the remainder is summed into `Other`.
Read-only view of the organization's prepaid wallet: `balance_minor`, `currency` (`USD`), `enforcement_enabled`, `low_balance_threshold_minor`. Amounts are in USD minor units (cents). Returns 404 (`no_wallet`) when no wallet is configured — treat that as "unlimited / not configured". Top-ups, enforcement, and limits are operator-managed (see the system Billing endpoints).
Read-only view of the organization's enabled monthly spend limits enriched with current calendar-month spend from rollup counters. Powers spending dashboard progress rows. Limits are sub-caps within the prepaid wallet and apply only when enforcement is enabled on the wallet.
Return the organization's live subscription joined with the plan name. "Live" means status is `trialing`, `active`, or `past_due`. Returns 404 if no live subscription exists.
Switch the organization to a different plan. Atomically cancels the current live subscription (kept for audit) and inserts a new active subscription on the requested plan. Returns the new subscription row joined with the plan name. Returns 409 `same_plan` if the org is already on the requested plan, or 409 `managed_externally` if the subscription is Stripe-managed.
POST/v1/organization/subscription/change-plan
Request body
Name
Type
Required
Description
planId
string (UUID)
Required
ID of the plan to switch to. Use `GET /admin/plans` to list available plan IDs.
Cancel the organization's live subscription immediately. After this call the org has no live subscription — runtime requests will be rejected with HTTP 402 `no_active_subscription` until a new subscription is created via change-plan. The canceled row stays in the table for audit. Returns the bare subscription row (no `planName` join). Returns 409 `managed_externally` if the subscription is Stripe-managed.
POST/v1/organization/subscription/cancel
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/subscription/cancel \
-X POST \
-H "Authorization: Bearer $CORTEX_TOKEN"
Return the organization's default billing profile (`is_default = true`, or the oldest profile when none is marked default). Returns 404 `no_billing_profile` if no profile exists.
Create a billing profile for the organization. An org may have multiple profiles (e.g. regional legal entities). The first profile becomes the default. Only `name` and `legalName` are required. Every optional field accepts `null` to clear it, and an empty string is stored as `null` rather than as `""`. The organization's Stripe customer lives on the organization, not the profile, and is assigned automatically when the first card is saved.
POST/v1/organization/billing-profiles
Request body
Name
Type
Required
Description
name
string
Required
The name you use for this profile, e.g. `Acme HQ`. 1–120 characters.
legalName
string
Required
Registered legal entity name as it should appear on invoices. 1–255 characters.
taxId
string | null
Optional
Tax / VAT registration number. Maximum 64 characters.
registrationNumber
string | null
Optional
Company registration number for the legal entity. Maximum 64 characters.
billingEmail
string | null
Optional
Where invoices and billing notices are delivered. Lowercased server-side. Maximum 255 characters.
billingContactName
string | null
Optional
Person to contact about billing. Maximum 255 characters.
billingContactPhone
string | null
Optional
Billing contact phone number. Length-bounded only — no format is enforced, so international numbers pass through as sent. Maximum 32 characters.
addressLine1
string | null
Optional
Invoice address, first line. Maximum 255 characters.
addressLine2
string | null
Optional
Invoice address, second line. Maximum 255 characters.
addressCountry
string | null
Optional
Invoice address country as an ISO 3166-1 alpha-2 code, e.g. `AE`. Uppercased server-side. Exactly 2 characters; not checked against a country list.
addressCity
string | null
Optional
Invoice address city. Maximum 120 characters.
addressPostalCode
string | null
Optional
Invoice address postal code. Maximum 32 characters.
isDefault
boolean
Optional
Set true to make this the organization's default profile, demoting the current default.
defaultPaymentMethod
string
Optional
One of `wire`, `check`. Defaults to `wire` on create.
currency
string
Optional
Invoicing currency — `AED` or `USD`. Defaults to `AED`.
paymentTerms
string
Optional
One of `due_on_receipt`, `net_15`, `net_30`, `net_60`. Defaults to `net_30`.
Update editable fields on a billing profile. All fields are optional, and an absent field is left untouched — so a single address line can be changed without resending the rest. Every optional field accepts `null` to clear it, and an empty string is stored as `null` rather than as `""`. `name` and `legalName` are the exception: they can be changed but not cleared. Strict-body — passing any unknown field returns 400. Returns 404 if the profile does not exist on this organization.
PATCH/v1/organization/billing-profiles/:profileId
Path parameters
Name
Type
Required
Description
profileId
string
Required
The profileId value from the endpoint path.
Request body
Name
Type
Required
Description
name
string
Optional
New profile name. 1–120 characters. Cannot be set to null or blank.
legalName
string
Optional
New legal entity name. 1–255 characters. Cannot be set to null or blank.
taxId
string | null
Optional
Tax / VAT registration number. Maximum 64 characters.
registrationNumber
string | null
Optional
Company registration number for the legal entity. Maximum 64 characters.
billingEmail
string | null
Optional
Where invoices and billing notices are delivered. Lowercased server-side. Maximum 255 characters.
billingContactName
string | null
Optional
Person to contact about billing. Maximum 255 characters.
billingContactPhone
string | null
Optional
Billing contact phone number. Length-bounded only — no format is enforced, so international numbers pass through as sent. Maximum 32 characters.
addressLine1
string | null
Optional
Invoice address, first line. Maximum 255 characters.
addressLine2
string | null
Optional
Invoice address, second line. Maximum 255 characters.
addressCountry
string | null
Optional
Invoice address country as an ISO 3166-1 alpha-2 code, e.g. `AE`. Uppercased server-side. Exactly 2 characters; not checked against a country list.
addressCity
string | null
Optional
Invoice address city. Maximum 120 characters.
addressPostalCode
string | null
Optional
Invoice address postal code. Maximum 32 characters.
isDefault
boolean
Optional
Set true to make this the organization's default profile, demoting the current default.
defaultPaymentMethod
string
Optional
One of `wire`, `check`. Defaults to `wire` on create.
currency
string
Optional
Invoicing currency — `AED` or `USD`.
paymentTerms
string
Optional
One of `due_on_receipt`, `net_15`, `net_30`, `net_60`.
Delete one of the organization's billing profiles. If the deleted profile was the default, the oldest remaining profile is promoted to default automatically. Invoices that referenced the profile keep the `billing_snapshot` they were issued with and have their `billing_profile_id` set to null.
Get a single invoice by ID, scoped to the caller's organization. Returns 404 for invoices that belong to a different org — cross-organization ID enumeration is not possible.