API reference
Usage
Usage and invoices
| Method | Path | Summary |
|---|---|---|
GET | /v1/account/invoices | Issued invoices, newest first (a draft is not shown until it is issued) |
GET | /v1/account/invoices/{invoiceId} | One invoice with its lines (per meter, fees, and the per-group breakdown) |
GET | /v1/account/invoices/{invoiceId}/download | The invoice lines as a CSV file to save (there is no PDF) |
GET | /v1/account/invoices/{invoiceId}/payment-page | Stripe's page for an invoice: pay it while due, or get its receipt and PDF once paid |
GET | /v1/account/usage | This period: the three meters by group and by number, and the running total against the plan |
Issued invoices, newest first (a draft is not shown until it is issued)#
GET /v1/account/invoices
Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token).
Response 200
| Field | Type | Required | Description |
|---|---|---|---|
invoices | array<Invoice> | Yes | — |
invoices[].createdAt | string (date-time) | Yes | — |
invoices[].currency | string | Yes | — |
invoices[].hasPaymentPage | boolean | Yes | — |
invoices[].id | string (inv_… ID) | Yes | ID (inv_…) |
invoices[].issuedAt | string (date-time) | null | Yes | — |
invoices[].periodEnd | string | Yes | — |
invoices[].periodStart | string | Yes | — |
invoices[].status | enum | Yes | One of: "draft", "open", "paid", "void". |
invoices[].subtotalCents | integer | Yes | — |
invoices[].totalCents | integer | Yes | — |
Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.
Example
curl -X GET "$ANSWERSTACK_API_URL/v1/account/invoices" \
-H "Authorization: Bearer $ACCESS_TOKEN"One invoice with its lines (per meter, fees, and the per-group breakdown)#
GET /v1/account/invoices/{invoiceId}
Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token).
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
invoiceId | string (inv_… ID) | Yes | ID (inv_…) |
Response 200
| Field | Type | Required | Description |
|---|---|---|---|
createdAt | string (date-time) | Yes | — |
currency | string | Yes | — |
hasPaymentPage | boolean | Yes | — |
id | string (inv_… ID) | Yes | ID (inv_…) |
issuedAt | string (date-time) | null | Yes | — |
lines | array<object> | Yes | — |
lines[].amountCents | integer | Yes | — |
lines[].description | string | null | Yes | — |
lines[].groupId | string (grp_… ID) | null | Yes | — |
lines[].id | string (invl_… ID) | Yes | ID (invl_…) |
lines[].kind | enum | Yes | One of: "minutes", "answered", "booked", "sms_sent", "chat_message", "notetaker_minutes", "rep_minutes", "monthly_fee", "number_fee", "adjustment", "credit", "promotion". |
lines[].quantity | number | Yes | — |
lines[].unitPriceCents | number | Yes | — |
periodEnd | string | Yes | — |
periodStart | string | Yes | — |
status | enum | Yes | One of: "draft", "open", "paid", "void". |
subtotalCents | integer | Yes | — |
totalCents | integer | Yes | — |
Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.
Example
curl -X GET "$ANSWERSTACK_API_URL/v1/account/invoices/{invoiceId}" \
-H "Authorization: Bearer $ACCESS_TOKEN"The invoice lines as a CSV file to save (there is no PDF)#
GET /v1/account/invoices/{invoiceId}/download
Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token).
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
invoiceId | string (inv_… ID) | Yes | ID (inv_…) |
Response 200
One row per invoice line, then a total row.
Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.
Example
curl -X GET "$ANSWERSTACK_API_URL/v1/account/invoices/{invoiceId}/download" \
-H "Authorization: Bearer $ACCESS_TOKEN"Stripe's page for an invoice: pay it while due, or get its receipt and PDF once paid#
GET /v1/account/invoices/{invoiceId}/payment-page
Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token).
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
invoiceId | string (inv_… ID) | Yes | ID (inv_…) |
Response 200
| Field | Type | Required | Description |
|---|---|---|---|
url | string | Yes | — |
Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.
Example
curl -X GET "$ANSWERSTACK_API_URL/v1/account/invoices/{invoiceId}/payment-page" \
-H "Authorization: Bearer $ACCESS_TOKEN"This period: the three meters by group and by number, and the running total against the plan#
GET /v1/account/usage
Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token). Bearer token: Authorization: Bearer <token> (An API token (ans_pat_ or ans_svc_). Only routes that list a scope here accept one, and only with that scope.).
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
at | string (date) | No | — |
Response 200
| Field | Type | Required | Description |
|---|---|---|---|
byGroup | array<object> | Yes | — |
byGroup[].groupId | string (grp_… ID) | null | Yes | — |
byGroup[].groupName | string | null | Yes | — |
byGroup[].meters | map | Yes | — |
byGroup[].meters.{key} | number | No | Any key. |
byNumber | array<object> | Yes | — |
byNumber[].e164 | string | null | Yes | — |
byNumber[].groupId | string (grp_… ID) | null | Yes | — |
byNumber[].meters | map | Yes | — |
byNumber[].meters.{key} | number | No | Any key. |
byNumber[].phoneNumberId | string (pn_… ID) | null | Yes | — |
currency | string | Yes | — |
lines | array<object> | Yes | — |
lines[].amountCents | integer | Yes | — |
lines[].description | string | Yes | — |
lines[].kind | string | Yes | — |
lines[].quantity | number | Yes | — |
lines[].unitPriceCents | number | Yes | — |
meters | map | null | Yes | — |
meters.{key} | object | No | Any key. |
meters.{key}.amountCents | integer | Yes | — |
meters.{key}.billable | number | Yes | — |
meters.{key}.included | number | Yes | — |
meters.{key}.used | number | Yes | — |
period | object | Yes | — |
period.end | string | Yes | — |
period.start | string | Yes | — |
plan | object | null | Yes | — |
plan.id | string (plan_… ID) | Yes | ID (plan_…) |
plan.name | string | Yes | — |
runningTotalCents | integer | null | Yes | — |
spendAlert | object | null | Yes | — |
spendAlert.monthlyBudgetCents | integer | Yes | — |
spendAlert.percentUsed | number | Yes | — |
spendAlert.thresholdsReached | array<integer> | Yes | — |
totals | map | Yes | — |
totals.{key} | number | No | Any key. |
Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.
Example
curl -X GET "$ANSWERSTACK_API_URL/v1/account/usage" \
-H "Authorization: Bearer $ACCESS_TOKEN"