API reference · Account and billing
Usage and invoices
3 operations of the Ankra Cloud API: Usage, the billing log and invoices.
Invoices, newest month first#
GET
/v1/invoices- Operation
list_invoices- Credentials
- API token, Portal session
- Requires
- Permission
billing.read
Parameters
| Name | In | Type | Description |
|---|---|---|---|
cursor | query | string | The next_cursor of the previous page. |
Responses
200A page of invoices.application/json · InvoiceList
| Field | Type | Description |
|---|---|---|
itemsrequired | array of Invoice | |
idrequired | string | |
periodrequired | string | |
period_startrequired | string (date-time) | |
period_endrequired | string (date-time) | |
currencyrequired | string | |
total_centsrequired | integer | The usage total, before credits. |
credit_applied_cents | integer | The part of the total account credits paid. |
amount_due_cents | integer | What is charged: total_cents - credit_applied_cents. An invoice credits pay in full is paid and never sent to Stripe. |
created_atrequired | string (date-time) | |
linesrequired | array of InvoiceLine | |
kindrequired | string | credit lines are credits applied to the invoice: a negative amount_cents, the credit's label as name (for example "Welcome credit WELCOME500") and its id as resource_id.One of usage, credit |
resource_typerequired | string | |
resource_idrequired | string | |
namerequired | string | |
planrequired | string | |
hoursrequired | integer | |
amount_centsrequired | integer | |
cap_centsrequired | integer | |
payment_status | string | unbilled until Stripe has the invoice (or when payments are not configured or it totals nothing); overdue after a failed charge.One of unbilled, open, paid, overdue |
hosted_invoice_url | string | null | Stripe's page to view and pay the invoice. |
next_cursorrequired | string | null | Pass as ?cursor= for the next page; null on the last page. |
- 400The request is invalid;
detailsays why. - 401Not signed in, or the credential is invalid or expired.
- 403The role lacks the permission, the token is read-only (a read-only token also gets
reason: read_only_token_cannot_read_credentialson every credential read), the CSRF header is missing, a support session may not do this, or the route needs a verified email address and the caller's is not (reason: email_unverified). - defaultAny other error, usually 500.
Example
curl 'https://cloud.ankra.app/v1/invoices' \
-H "Authorization: Bearer $ANKRA_CLOUD_TOKEN"One line per resource per day, newest day first#
GET
/v1/usage/billing-log- Operation
list_billing_log- Credentials
- API token, Portal session
- Requires
- Permission
billing.read
Parameters
| Name | In | Type | Description |
|---|---|---|---|
cursor | query | string | The next_cursor of the previous page. |
limit | query | integer |
Responses
200A page of billing-log lines.application/json · BillingLogEntryList
| Field | Type | Description |
|---|---|---|
itemsrequired | array of BillingLogEntry | |
daterequired | string (date) | |
resource_typerequired | string | |
resource_idrequired | string | |
namerequired | string | |
planrequired | string | |
hoursrequired | integer | |
hourly_price_millicentsrequired | integer | |
amount_centsrequired | integer | |
next_cursorrequired | string | null | Pass as ?cursor= for the next page; null on the last page. |
- 400The request is invalid;
detailsays why. - 401Not signed in, or the credential is invalid or expired.
- 403The role lacks the permission, the token is read-only (a read-only token also gets
reason: read_only_token_cannot_read_credentialson every credential read), the CSRF header is missing, a support session may not do this, or the route needs a verified email address and the caller's is not (reason: email_unverified). - defaultAny other error, usually 500.
Example
curl 'https://cloud.ankra.app/v1/usage/billing-log' \
-H "Authorization: Bearer $ANKRA_CLOUD_TOKEN"This month's usage and estimate#
GET
/v1/usage/summary- Operation
get_usage_summary- Credentials
- API token, Portal session
- Requires
- Permission
billing.read
Responses
200The usage summary.application/json · UsageSummary
| Field | Type | Description |
|---|---|---|
currencyrequired | string | |
period_startrequired | string (date-time) | |
period_endrequired | string (date-time) | |
metered_throughrequired | string (date-time) | null | |
month_to_date_centsrequired | integer | |
estimated_month_centsrequired | integer | |
resourcesrequired | array of UsageResource | |
resource_typerequired | string | |
resource_idrequired | string | |
namerequired | string | |
planrequired | string | |
hoursrequired | integer | |
amount_centsrequired | integer | |
cap_centsrequired | integer | |
hourly_price_millicentsrequired | integer | |
is_activerequired | boolean | |
dailyrequired | array of UsageDay | The last 90 days including today, oldest first, zero-filled. |
daterequired | string (date) | |
amount_centsrequired | integer | |
credit_balance_cents | integer | What the account's live credits have left; the next invoice spends it before charging. |
credit_next_expiry | string (date-time) | null | The soonest expiry of a live credit. |
- 401Not signed in, or the credential is invalid or expired.
- 403The role lacks the permission, the token is read-only (a read-only token also gets
reason: read_only_token_cannot_read_credentialson every credential read), the CSRF header is missing, a support session may not do this, or the route needs a verified email address and the caller's is not (reason: email_unverified). - defaultAny other error, usually 500.
Example
curl 'https://cloud.ankra.app/v1/usage/summary' \
-H "Authorization: Bearer $ANKRA_CLOUD_TOKEN"