API reference

Usage

Usage and invoices

MethodPathSummary
GET/v1/account/invoicesIssued 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}/downloadThe invoice lines as a CSV file to save (there is no PDF)
GET/v1/account/invoices/{invoiceId}/payment-pageStripe's page for an invoice: pay it while due, or get its receipt and PDF once paid
GET/v1/account/usageThis 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

FieldTypeRequiredDescription
invoicesarray<Invoice>Yes—
invoices[].createdAtstring (date-time)Yes—
invoices[].currencystringYes—
invoices[].hasPaymentPagebooleanYes—
invoices[].idstring (inv_… ID)YesID (inv_…)
invoices[].issuedAtstring (date-time) | nullYes—
invoices[].periodEndstringYes—
invoices[].periodStartstringYes—
invoices[].statusenumYesOne of: "draft", "open", "paid", "void".
invoices[].subtotalCentsintegerYes—
invoices[].totalCentsintegerYes—

Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.

Example

bash
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

NameTypeRequiredDescription
invoiceIdstring (inv_… ID)YesID (inv_…)

Response 200

FieldTypeRequiredDescription
createdAtstring (date-time)Yes—
currencystringYes—
hasPaymentPagebooleanYes—
idstring (inv_… ID)YesID (inv_…)
issuedAtstring (date-time) | nullYes—
linesarray<object>Yes—
lines[].amountCentsintegerYes—
lines[].descriptionstring | nullYes—
lines[].groupIdstring (grp_… ID) | nullYes—
lines[].idstring (invl_… ID)YesID (invl_…)
lines[].kindenumYesOne of: "minutes", "answered", "booked", "sms_sent", "chat_message", "notetaker_minutes", "rep_minutes", "monthly_fee", "number_fee", "adjustment", "credit", "promotion".
lines[].quantitynumberYes—
lines[].unitPriceCentsnumberYes—
periodEndstringYes—
periodStartstringYes—
statusenumYesOne of: "draft", "open", "paid", "void".
subtotalCentsintegerYes—
totalCentsintegerYes—

Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.

Example

bash
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

NameTypeRequiredDescription
invoiceIdstring (inv_… ID)YesID (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

bash
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

NameTypeRequiredDescription
invoiceIdstring (inv_… ID)YesID (inv_…)

Response 200

FieldTypeRequiredDescription
urlstringYes—

Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.

Example

bash
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

NameTypeRequiredDescription
atstring (date)No—

Response 200

FieldTypeRequiredDescription
byGrouparray<object>Yes—
byGroup[].groupIdstring (grp_… ID) | nullYes—
byGroup[].groupNamestring | nullYes—
byGroup[].metersmapYes—
byGroup[].meters.{key}numberNoAny key.
byNumberarray<object>Yes—
byNumber[].e164string | nullYes—
byNumber[].groupIdstring (grp_… ID) | nullYes—
byNumber[].metersmapYes—
byNumber[].meters.{key}numberNoAny key.
byNumber[].phoneNumberIdstring (pn_… ID) | nullYes—
currencystringYes—
linesarray<object>Yes—
lines[].amountCentsintegerYes—
lines[].descriptionstringYes—
lines[].kindstringYes—
lines[].quantitynumberYes—
lines[].unitPriceCentsnumberYes—
metersmap | nullYes—
meters.{key}objectNoAny key.
meters.{key}.amountCentsintegerYes—
meters.{key}.billablenumberYes—
meters.{key}.includednumberYes—
meters.{key}.usednumberYes—
periodobjectYes—
period.endstringYes—
period.startstringYes—
planobject | nullYes—
plan.idstring (plan_… ID)YesID (plan_…)
plan.namestringYes—
runningTotalCentsinteger | nullYes—
spendAlertobject | nullYes—
spendAlert.monthlyBudgetCentsintegerYes—
spendAlert.percentUsednumberYes—
spendAlert.thresholdsReachedarray<integer>Yes—
totalsmapYes—
totals.{key}numberNoAny key.

Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.

Example

bash
curl -X GET "$ANSWERSTACK_API_URL/v1/account/usage" \
  -H "Authorization: Bearer $ACCESS_TOKEN"