Jump to

  • Quickstarts
  • API reference
  • Webhook events
  • Error codes
  • SDKs

API reference

Billing

How these fit together: the Billing guide.

Get balance

get/v1/balance

Retrieves the prepaid balance, this period’s included minutes and the plan enrolment.

The wallet’s availableMinor in minor units of currency, the low-balance threshold, this billing period’s included minutes (total, used, remaining) and the plan enrolment (subscription: status, plan, period dates, trial end). Read as the rows stand — a read never enrols the organization or rolls a period over, so a period that has just ended shows until the platform rolls it. An organization never billed reads zero, with subscription: null. billing says who pays its charges: when its integration does (payer: integration), this wallet is not spent and the monthly cap and this month’s spend are there.

Access: an organization key with the billing:read scope.

Response 200PublicBalance

  • availableMinorintegerRequired

    Prepaid credit in minor units of currency (paise for INR). May be negative: a call admitted on one minute of credit runs to its end, and the next dial is refused.

  • billingPublicOrganizationBilling

    Who pays the organization’s charges. While its integration pays (payer: integration) this wallet is not spent — the figures above stay as they were — and the monthly cap and this month’s spend are here.

    3 fields of billing
    • payerstringRequired

      organization: its own wallet. integration: the wallet of the billing organization the platform set for the integration that provisioned it — each charge debits that wallet, attributed to this organization, and its own wallet is not spent.

      One oforganizationintegration

    • spendPublicSpend | nullRequired

      While the integration pays: what this month has taken from it so far; null otherwise.

      3 fields of spend
      • amountMinorintegerRequired

        Net: charges less what was credited back (a refunded message, a re-rated call), as posted this month.

      • periodEndstring (date-time)Required

        Exclusive.

      • periodStartstring (date-time)Required

        The month’s start (UTC).

    • spendCapPublicSpendCap | nullRequired

      While the integration pays: the monthly cap on what it pays (dials, sends and numbers past it are refused 402 BILLING_SPEND_CAP_REACHED); null for none.

      2 fields of spendCap
      • amountMinorintegerRequired

        The most its usage and fees may take, net, from the paying account in a month (minor units of the currency).

        at least 1

      • periodstringRequired

        A UTC calendar month.

        One ofmonth

  • currencystringRequired

  • includedMinutesPublicIncludedMinutes | nullRequired

    This period’s included call minutes (spent before per-minute rates apply); null without a subscription.

    3 fields of includedMinutes
    • remainingintegerRequired

    • totalintegerRequired

      Minutes in this period’s bundle, as snapshotted when the period started.

    • usedintegerRequired

  • lowBalanceThresholdMinorinteger | nullRequired

    Below this the console warns the organization’s administrators. Null before the wallet exists.

  • objectstringRequired

    One ofbalance

  • subscriptionPublicBillingSubscription | nullRequired

    Null for an organization not enrolled on a plan yet.

    6 fields of subscription
    • cancelAtPeriodEndbooleanRequired

    • currentPeriodEndstring (date-time)Required

      The next renewal: the plan’s fee is debited then.

    • currentPeriodStartstring (date-time)Required

    • planPublicBillingPlanRefRequired

      2 fields of plan
      • codestringRequired

      • namestringRequired

    • statusstringRequired

      past_due: the plan’s fee could not be covered — dialling and sending are refused until a top-up settles it; suspended: held by the platform; canceled: cancelled at a period end.

      One oftrialingactivepast_duesuspendedcanceled

    • trialEndsAtstring (date-time) | nullRequired

  • updatedAtstring (date-time) | nullRequired

    When the balance last moved; null before the wallet exists.

Errors

Request
curl 'https://api.trovacast.com/v1/balance' \
  -H "Authorization: Bearer $TROVACAST_API_KEY"
Response 200 (json)
{
  "availableMinor": 482500,
  "billing": {
    "payer": "organization",
    "spend": {
      "amountMinor": 182350,
      "periodEnd": "2026-11-05T10:00:00.000Z",
      "periodStart": "2026-11-05T10:00:00.000Z"
    },
    "spendCap": {
      "amountMinor": 500000,
      "period": "month"
    }
  },
  "currency": "INR",
  "includedMinutes": {
    "remaining": 1,
    "total": 1,
    "used": 1
  },
  "lowBalanceThresholdMinor": 1,
  "object": "balance",
  "subscription": {
    "cancelAtPeriodEnd": true,
    "currentPeriodEnd": "2026-11-05T10:00:00.000Z",
    "currentPeriodStart": "2026-11-05T10:00:00.000Z",
    "plan": {
      "code": "GROWTH",
      "name": "Growth"
    },
    "status": "trialing",
    "trialEndsAt": "2026-11-05T10:00:00.000Z"
  },
  "updatedAt": "2026-11-05T10:00:00.000Z"
}

Update balance

patch/v1/balance

Sets the low-balance threshold (balance.low fires when spend crosses it).

Settings only: credit moves through top-ups (POST /v1/balance/top-ups), which a person pays at the payment gateway. Zero turns the warning (and the event) off.

Access: an organization key with the billing:manage scope. Live keys only: a test key is refused with 422 TEST_MODE_UNSUPPORTED.

Headers

  • Idempotency-Keystring

    Makes the request safe to retry: a repeat with the same key and the same body returns the stored success (with Idempotent-Replayed: true) instead of running again; a 4xx stores nothing. A 5xx is stored and replayed to every retry with the same key (Idempotent-Replayed: true): the first attempt may have taken effect, so check before retrying with a new key — except the errors that provably changed nothing (503 MESSAGING_TRANSPORT, 503 WHATSAPP_CONNECT_UNAVAILABLE; see https://trovacast.com/developers/idempotency), which store nothing, so a retry with the same key runs again. 1–255 visible ASCII characters; kept for 24 hours.

Request body

  • lowBalanceThresholdMinorintegerRequired

    The balance (minor units) below which balance.low fires and the console warns administrators. Zero turns the warning off.

    0–100000000

Response 200PublicBalance

  • availableMinorintegerRequired

    Prepaid credit in minor units of currency (paise for INR). May be negative: a call admitted on one minute of credit runs to its end, and the next dial is refused.

  • billingPublicOrganizationBilling

    Who pays the organization’s charges. While its integration pays (payer: integration) this wallet is not spent — the figures above stay as they were — and the monthly cap and this month’s spend are here.

    3 fields of billing
    • payerstringRequired

      organization: its own wallet. integration: the wallet of the billing organization the platform set for the integration that provisioned it — each charge debits that wallet, attributed to this organization, and its own wallet is not spent.

      One oforganizationintegration

    • spendPublicSpend | nullRequired

      While the integration pays: what this month has taken from it so far; null otherwise.

      3 fields of spend
      • amountMinorintegerRequired

        Net: charges less what was credited back (a refunded message, a re-rated call), as posted this month.

      • periodEndstring (date-time)Required

        Exclusive.

      • periodStartstring (date-time)Required

        The month’s start (UTC).

    • spendCapPublicSpendCap | nullRequired

      While the integration pays: the monthly cap on what it pays (dials, sends and numbers past it are refused 402 BILLING_SPEND_CAP_REACHED); null for none.

      2 fields of spendCap
      • amountMinorintegerRequired

        The most its usage and fees may take, net, from the paying account in a month (minor units of the currency).

        at least 1

      • periodstringRequired

        A UTC calendar month.

        One ofmonth

  • currencystringRequired

  • includedMinutesPublicIncludedMinutes | nullRequired

    This period’s included call minutes (spent before per-minute rates apply); null without a subscription.

    3 fields of includedMinutes
    • remainingintegerRequired

    • totalintegerRequired

      Minutes in this period’s bundle, as snapshotted when the period started.

    • usedintegerRequired

  • lowBalanceThresholdMinorinteger | nullRequired

    Below this the console warns the organization’s administrators. Null before the wallet exists.

  • objectstringRequired

    One ofbalance

  • subscriptionPublicBillingSubscription | nullRequired

    Null for an organization not enrolled on a plan yet.

    6 fields of subscription
    • cancelAtPeriodEndbooleanRequired

    • currentPeriodEndstring (date-time)Required

      The next renewal: the plan’s fee is debited then.

    • currentPeriodStartstring (date-time)Required

    • planPublicBillingPlanRefRequired

      2 fields of plan
      • codestringRequired

      • namestringRequired

    • statusstringRequired

      past_due: the plan’s fee could not be covered — dialling and sending are refused until a top-up settles it; suspended: held by the platform; canceled: cancelled at a period end.

      One oftrialingactivepast_duesuspendedcanceled

    • trialEndsAtstring (date-time) | nullRequired

  • updatedAtstring (date-time) | nullRequired

    When the balance last moved; null before the wallet exists.

Errors

Request
curl -X PATCH 'https://api.trovacast.com/v1/balance' \
  -H "Authorization: Bearer $TROVACAST_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H 'Content-Type: application/json' \
  -d '{
  "lowBalanceThresholdMinor": 50000
}'
Response 200 (json)
{
  "availableMinor": 482500,
  "billing": {
    "payer": "organization",
    "spend": {
      "amountMinor": 182350,
      "periodEnd": "2026-11-05T10:00:00.000Z",
      "periodStart": "2026-11-05T10:00:00.000Z"
    },
    "spendCap": {
      "amountMinor": 500000,
      "period": "month"
    }
  },
  "currency": "INR",
  "includedMinutes": {
    "remaining": 1,
    "total": 1,
    "used": 1
  },
  "lowBalanceThresholdMinor": 1,
  "object": "balance",
  "subscription": {
    "cancelAtPeriodEnd": true,
    "currentPeriodEnd": "2026-11-05T10:00:00.000Z",
    "currentPeriodStart": "2026-11-05T10:00:00.000Z",
    "plan": {
      "code": "GROWTH",
      "name": "Growth"
    },
    "status": "trialing",
    "trialEndsAt": "2026-11-05T10:00:00.000Z"
  },
  "updatedAt": "2026-11-05T10:00:00.000Z"
}

Create top up

post/v1/balance/top-ups

Starts a credit top-up: returns a checkout for a person to pay, with the tax on it itemised.

The wallet is credited when the payment gateway reports the payment (its webhook, or a later GET /v1/balance/top-ups/{topUpId}), never by this call. amountMinor is the credit; where tax applies (GST for an organization in India) it is charged on top — taxMinor, with totalMinor what the payer pays — and never becomes balance. The gateway follows your organization’s country, and checkout says how to open it without naming one: redirect is a hosted page at url (also checkoutUrl), embedded opens on your own page from scriptUrl with options. The checkout is returned once and stops accepting payment at expiresAt.

Access: an organization key with the billing:manage scope. Live keys only: a test key is refused with 422 TEST_MODE_UNSUPPORTED.

Headers

  • Idempotency-Keystring

    Makes the request safe to retry: a repeat with the same key and the same body returns the stored success (with Idempotent-Replayed: true) instead of running again; a 4xx stores nothing. A 5xx is stored and replayed to every retry with the same key (Idempotent-Replayed: true): the first attempt may have taken effect, so check before retrying with a new key — except the errors that provably changed nothing (503 MESSAGING_TRANSPORT, 503 WHATSAPP_CONNECT_UNAVAILABLE; see https://trovacast.com/developers/idempotency), which store nothing, so a retry with the same key runs again. 1–255 visible ASCII characters; kept for 24 hours.

Request body

  • amountMinorintegerRequired

    Credit to buy, in minor units of your plan’s currency (paise for INR). At least the plan’s minimum top-up (BILLING_TOP_UP_BELOW_MINIMUM), at most the online limit (BILLING_TOP_UP_ABOVE_MAXIMUM). Tax, where it applies, is charged on top of it (taxMinor in the answer) and is not credit; a top-up that carries tax must be a whole amount — a multiple of 100, no paise (BILLING_TOP_UP_NOT_WHOLE_UNIT).

    1–50000000

  • cancelUrlstring (uri)

    Where the payer lands if they abandon the checkout (https). Default: the console’s billing page.

  • successUrlstring (uri)

    Where the payer lands after paying (https). Default: the console’s billing page.

Response 201PublicTopUp

Its fields are listed under Get top up.

Errors

Request
curl -X POST 'https://api.trovacast.com/v1/balance/top-ups' \
  -H "Authorization: Bearer $TROVACAST_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H 'Content-Type: application/json' \
  -d '{
  "amountMinor": 100000,
  "cancelUrl": "https://app.example.com/billing",
  "successUrl": "https://app.example.com/billing/thanks"
}'
Response 201 (json)
{
  "amountMinor": 100000,
  "checkout": {
    "constructorName": "Razorpay",
    "kind": "redirect",
    "options": {},
    "scriptUrl": "https://example.com/trovacast/webhook",
    "url": "https://example.com/trovacast/webhook"
  },
  "checkoutUrl": "https://example.com/trovacast/webhook",
  "createdAt": "2026-11-05T10:00:00.000Z",
  "currency": "INR",
  "expiresAt": "2026-11-05T10:00:00.000Z",
  "id": "ID",
  "invoiceNumber": "TC/26-27/000123",
  "object": "top_up",
  "status": "pending",
  "taxMinor": 18000,
  "taxRateBps": 1800,
  "totalMinor": 118000
}

Get top up

get/v1/balance/top-ups/{topUpId}

Retrieves a top-up; a pending one is checked with the payment gateway (and credited if paid).

The top-up’s status (pending, succeeded, failed, expired or refunded), credit, tax, total and expiresAt; the checkout is never returned again (checkoutUrl and checkout are null). A pending top-up is checked with the payment gateway on each read: a paid one is credited to the wallet then — once, whichever of this read and the gateway’s webhook comes first — and an expired checkout reads expired. invoiceNumber is set once a taxed top-up has succeeded.

Access: an organization key with the billing:manage scope. Live keys only: a test key is refused with 422 TEST_MODE_UNSUPPORTED.

Path parameters

  • topUpIdstringRequired

Response 200PublicTopUp

Show the 13 fields
  • amountMinorintegerRequired

    The credit bought, in minor units: exactly what the balance rises by when the top-up succeeds.

  • checkoutPublicTopUpCheckout | nullRequired

    How to open the checkout. Returned by the create call only (null on a read).

    5 fields of checkout
    • constructorNamestring | nullRequired

      The global the script defines, to construct with options (embedded); null otherwise.

    • kindstringRequired

      redirect: send the payer to url, a hosted page that returns them to your successUrl or cancelUrl. embedded: the checkout opens on your own page — load scriptUrl, construct window[constructorName] with options and call open().

      One ofredirectembedded

    • optionsobject | nullRequired

      What to construct the checkout with (embedded): the gateway’s public key id, the order and the amount it is fixed at. Nothing in it is a secret, and the amount cannot be changed from the page. Null otherwise.

    • scriptUrlstring (uri) | nullRequired

      The gateway’s checkout script to load on your page (embedded); null otherwise.

    • urlstring (uri) | nullRequired

      The hosted checkout page (redirect); null otherwise.

  • checkoutUrlstring (uri) | nullRequired

    The hosted checkout to send the payer to, when the checkout is a hosted page (checkout.kind is redirect); null when it opens on your own page (embedded). Returned by the create call only (null on a read): a lost link is a new top-up — the abandoned one expires.

  • createdAtstring (date-time)Required

  • currencystringRequired

  • expiresAtstring (date-time)Required

    When the checkout stops accepting payment.

  • idstring (uuid)Required

  • invoiceNumberstring | nullRequired

    The number of the tax invoice issued when a taxed top-up succeeded; null before that and for a top-up that is not taxed (GET /v1/balance/top-ups/{topUpId}/invoice then answers a plain receipt).

  • objectstringRequired

    One oftop_up

  • statusstringRequired

    pending until the payer pays; succeeded once the gateway reports the payment and the wallet is credited.

    One ofpendingsucceededfailedexpiredrefunded

  • taxMinorintegerRequired

    Tax charged on top of the credit, in minor units — GST for an organization in India; 0 when the top-up is not taxed. It is paid with the credit and never becomes balance.

  • taxRateBpsinteger | nullRequired

    The rate taxMinor was charged at, in basis points (1800 is 18%); null when the top-up is not taxed.

  • totalMinorintegerRequired

    What the payer is charged: amountMinor plus taxMinor, in minor units.

Errors

Request
curl 'https://api.trovacast.com/v1/balance/top-ups/TOP_UP_ID' \
  -H "Authorization: Bearer $TROVACAST_API_KEY"
Response 200 (json)
{
  "amountMinor": 100000,
  "checkout": {
    "constructorName": "Razorpay",
    "kind": "redirect",
    "options": {},
    "scriptUrl": "https://example.com/trovacast/webhook",
    "url": "https://example.com/trovacast/webhook"
  },
  "checkoutUrl": "https://example.com/trovacast/webhook",
  "createdAt": "2026-11-05T10:00:00.000Z",
  "currency": "INR",
  "expiresAt": "2026-11-05T10:00:00.000Z",
  "id": "ID",
  "invoiceNumber": "TC/26-27/000123",
  "object": "top_up",
  "status": "pending",
  "taxMinor": 18000,
  "taxRateBps": 1800,
  "totalMinor": 118000
}

Get top up invoice

get/v1/balance/top-ups/{topUpId}/invoice

Retrieves a paid top-up’s tax invoice (or its receipt, when it carried no tax), as JSON or a PDF.

For a top-up that was taxed, the GST tax invoice issued when it succeeded: its number (consecutive within the Indian financial year), the credit as the taxable value, the tax by head — CGST and SGST halves when the place of supply is the supplier’s state, IGST otherwise — and the total, with a credit note for each refund. For a top-up that carried no tax (type: receipt), the same figures without a number or tax. The document names the business as it stood when it was issued; a later change to your business details never changes it. As a PDF: add .pdf (/v1/balance/top-ups/{topUpId}/invoice.pdf) or send Accept: application/pdf.

Access: an organization key with the billing:read scope.

Path parameters

  • topUpIdstringRequired

Response 200PublicTopUpInvoice

The invoice as JSON — or as a one-page A4 PDF with .pdf on the path or Accept: application/pdf (Content-Type: application/pdf).

Show the 11 fields
  • amountMinorintegerRequired

    The credit bought (the taxable value), in minor units.

  • creditNotesPublicTopUpCreditNote[]Required

    One credit note per refund of a taxed top-up, oldest first; empty when nothing was refunded.

    6 fields of creditNotes
    • amountMinorintegerRequired

      The credit this refund returned, in minor units.

    • idstring (uuid)Required

    • issuedAtstring (date-time)Required

    • numberstringRequired

    • taxMinorintegerRequired

      The tax refunded with it, in minor units.

    • totalMinorintegerRequired

  • currencystringRequired

  • issuedAtstring (date-time)Required

    When the invoice was issued (the receipt: when it was paid).

  • numberstring | nullRequired

    The tax invoice’s number, consecutive within the Indian financial year (April to March); null for a receipt.

  • objectstringRequired

    One oftop_up_invoice

  • taxPublicTopUpInvoiceTax | nullRequired

    The tax by head; null for a receipt.

    5 fields of tax
    • cgstMinorintegerRequired

      Central GST, in minor units: half the tax when the place of supply is the supplier’s own state, else 0.

    • igstMinorintegerRequired

      Integrated GST, in minor units: the whole tax when the place of supply is another state, else 0.

    • placeOfSupplystringRequired

      The GST state code of the place of supply: the state of your GSTIN or verified address, else the supplier’s.

    • rateBpsintegerRequired

      The GST rate in basis points (1800 is 18%).

    • sgstMinorintegerRequired

      State GST, in minor units: the other half when the place of supply is the supplier’s own state, else 0.

  • taxMinorintegerRequired

  • topUpIdstring (uuid)Required

  • totalMinorintegerRequired

  • typestringRequired

    tax_invoice: a numbered GST invoice, issued when a taxed top-up succeeded. receipt: the top-up carried no tax, so there is no tax invoice — a plain receipt of the payment.

    One oftax_invoicereceipt

Errors

Request
curl 'https://api.trovacast.com/v1/balance/top-ups/TOP_UP_ID/invoice' \
  -H "Authorization: Bearer $TROVACAST_API_KEY"
Response 200 (json)
{
  "amountMinor": 100000,
  "creditNotes": [
    {
      "amountMinor": 50000,
      "id": "ID",
      "issuedAt": "2026-11-05T10:00:00.000Z",
      "number": "CN/26-27/000004",
      "taxMinor": 9000,
      "totalMinor": 59000
    }
  ],
  "currency": "INR",
  "issuedAt": "2026-11-05T10:00:00.000Z",
  "number": "TC/26-27/000123",
  "object": "top_up_invoice",
  "tax": {
    "cgstMinor": 9000,
    "igstMinor": 0,
    "placeOfSupply": "27",
    "rateBps": 1800,
    "sgstMinor": 9000
  },
  "taxMinor": 18000,
  "topUpId": "TOP_UP_ID",
  "totalMinor": 118000,
  "type": "tax_invoice"
}

List invoices

get/v1/invoices

Lists monthly statements of the prepaid ledger, newest first (the running month is open).

One statement per UTC calendar month, from the first month the ledger has an entry: 12 a page by default (at most 24), and nextCursor passed as before reads older months. Each is computed from the prepaid ledger as it stands and always balances (opening plus its lines is closing); the running month moves until it ends. paidFor breaks down what the wallet paid for other organizations (an integration’s organizations billed to it), by organization. A month’s CSV is at GET /v1/invoices/{period}/csv.

Access: an organization key with the billing:read scope.

Query parameters

  • limitinteger

  • beforestring

    Months strictly before this one (YYYY-MM): a nextCursor.

Response 200PublicInvoicePage

  • dataPublicInvoice[]Required

    Its fields are listed under Get invoice

  • nextCursorstring | nullRequired

    Pass as before for the next (older) page; null on the last page.

Errors

Request
curl 'https://api.trovacast.com/v1/invoices' \
  -H "Authorization: Bearer $TROVACAST_API_KEY"
Response 200 (json)
{
  "data": [
    {
      "closingBalanceMinor": 83125,
      "creditsMinor": 210000,
      "currency": "INR",
      "debitsMinor": 176875,
      "id": "2026-10",
      "lines": [
        {
          "amountMinor": -45500,
          "count": 1820,
          "description": "SMS usage",
          "kind": "top_up"
        }
      ],
      "object": "invoice",
      "openingBalanceMinor": 50000,
      "paidFor": [
        {
          "amountMinor": -45500,
          "count": 1,
          "externalReference": "biz_8c1f",
          "organizationId": "ORGANIZATION_ID"
        }
      ],
      "period": "2026-10",
      "periodEnd": "2026-11-05T10:00:00.000Z",
      "periodStart": "2026-11-05T10:00:00.000Z",
      "status": "open"
    }
  ],
  "nextCursor": "2026-05"
}

Get invoice

get/v1/invoices/{period}

Retrieves one month’s statement (YYYY-MM): opening and closing balance, credits, usage by channel, number and plan fees.

A UTC calendar month computed from the prepaid ledger: the opening balance (every entry before the month), credits, usage by channel, number and plan fees, and the closing balance — opening plus the lines always equals closing. The running month is open and changes until it ends; a past month before any activity reads zero. The same statement as CSV is at GET /v1/invoices/{period}/csv.

Access: an organization key with the billing:read scope.

Path parameters

  • periodstringRequired

Response 200PublicInvoice

The statement as JSON — or as a PDF with .pdf on the period (/v1/invoices/2026-10.pdf) or Accept: application/pdf — one A4 page, Content-Type: application/pdf.

Show the 13 fields
  • closingBalanceMinorintegerRequired

    Always openingBalanceMinor + the sum of lines.

  • creditsMinorintegerRequired

    The positive lines.

  • currencystringRequired

  • debitsMinorintegerRequired

    The negative lines, as a positive number.

  • idstringRequired

    The month, YYYY-MM.

  • linesPublicInvoiceLine[]Required

    4 fields of lines
    • amountMinorintegerRequired

      Signed minor units of currency: credits positive, spend negative.

    • countintegerRequired

      Ledger entries folded into the line.

    • descriptionstringRequired

    • kindstringRequired

      Credits by kind (top_up, trial_credit, adjustment, refund, plan_fee_credit), usage by channel (voice, sms, whatsapp, email; re-rating adjustments fold into their channel; messaging is usage whose message was since erased), fees (plan_fee, number_setup, number_rental), and credit moved between a parent organization and its subaccounts (transfer_in, transfer_out).

      One oftop_uptrial_creditadjustmentrefundplan_feeplan_fee_creditvoicesmswhatsappemailmessagingnumber_setupnumber_rentaltransfer_intransfer_out

  • objectstringRequired

    One ofinvoice

  • openingBalanceMinorintegerRequired

  • paidForPublicInvoicePaidFor[]Required

    P4: the part of lines this wallet paid for other organizations — an integration’s organizations billed to it — by organization, the largest spend first. Empty when the wallet paid for its own organization only.

    4 fields of paidFor
    • amountMinorintegerRequired

      Signed minor units: its charges (negative) net of what was credited back.

    • countintegerRequired

      Ledger entries attributed to it.

    • externalReferencestring | nullRequired

      The integration’s own reference for the organization; null once it is erased.

    • organizationIdstring (uuid)Required

  • periodstringRequired

    The UTC calendar month.

  • periodEndstring (date-time)Required

    Exclusive: the first instant of the next month.

  • periodStartstring (date-time)Required

  • statusstringRequired

    open while the month runs; closed once it has ended.

    One ofopenclosed

Errors

Request
curl 'https://api.trovacast.com/v1/invoices/PERIOD' \
  -H "Authorization: Bearer $TROVACAST_API_KEY"
Response 200 (json)
{
  "closingBalanceMinor": 83125,
  "creditsMinor": 210000,
  "currency": "INR",
  "debitsMinor": 176875,
  "id": "2026-10",
  "lines": [
    {
      "amountMinor": -45500,
      "count": 1820,
      "description": "SMS usage",
      "kind": "top_up"
    }
  ],
  "object": "invoice",
  "openingBalanceMinor": 50000,
  "paidFor": [
    {
      "amountMinor": -45500,
      "count": 1,
      "externalReference": "biz_8c1f",
      "organizationId": "ORGANIZATION_ID"
    }
  ],
  "period": "2026-10",
  "periodEnd": "2026-11-05T10:00:00.000Z",
  "periodStart": "2026-11-05T10:00:00.000Z",
  "status": "open"
}

Get pricing

get/v1/pricing

Retrieves the plan’s prices: the per-minute cells (by channel, call type and destination) and the per-message cells.

The rate card of the organization’s plan: per-minute voice rates by direction, carrier, call type and destination, and per-message rates by channel, category and country (an SMS is priced per segment). A null destination is the every-destination rate; otherwise the longest match prices a call (+447 beats GB beats +44), and a destination or SMS country no rate covers is not offered. An organization on no plan reads plan: null with empty lists.

Access: an organization key with the billing:read scope.

Response 200PublicPricing

  • messagesPublicMessageRate[]Required

    The plan’s per-message cells. A combination absent here is not offered (BILLING_RATE_UNAVAILABLE).

    5 fields of messages
    • categorystringRequired

      One ofmarketingutilityauthenticationserviceemail

    • channelstringRequired

      One ofwhatsappemailsms

    • countrystring | nullRequired

      SMS: the destination country this price is for — a country with no cell is not offered. Null on other channels.

    • ratePerMessageMinorintegerRequired

      Minor units per unit. 0 is a real, free price.

    • unitstringRequired

      SMS is priced per segment; everything else per message.

      One ofsegmentmessage

  • objectstringRequired

    One ofpricing

  • planPublicPricingPlan | nullRequired

    Null for an organization not enrolled on a plan yet.

    7 fields of plan
    • codestringRequired

    • currencystringRequired

    • includedMinutesintegerRequired

      Call minutes in each period’s bundle.

    • minimumTopUpMinorintegerRequired

      The smallest top-up accepted, minor units.

    • monthlyFeeMinorintegerRequired

      Minor units, debited at each period start.

    • namestringRequired

    • trialDaysintegerRequired

  • voicePublicVoiceRate[]Required

    The plan’s per-minute cells. A combination absent here is not offered on the plan: such a dial is refused (BILLING_RATE_UNAVAILABLE).

    5 fields of voice
    • callTypestringRequired

      How the call is run: by a person (manual), by an AI agent (full_ai), or both (hybrid).

      One ofmanualfull_aihybrid

    • destinationstring | nullRequired

      Null: every destination. Otherwise an ISO country (GB) or an E.164 prefix of up to six digits (+447). The longest match prices a call (+447 beats GB beats +44); a number no cell covers is not offered.

    • directionstringRequired

      One ofoutboundinbound

    • providerstringRequired

      The channel (carrier) the call goes over — as provider on a call. Only the channels this deployment runs, by their public names; a telecaller’s own handset is never priced here.

      One ofairtelexotelplivotelnyxtwilio

    • ratePerMinuteMinorintegerRequired

      Minor units per billed minute.

Errors

Request
curl 'https://api.trovacast.com/v1/pricing' \
  -H "Authorization: Bearer $TROVACAST_API_KEY"
Response 200 (json)
{
  "messages": [
    {
      "category": "marketing",
      "channel": "whatsapp",
      "country": "IN",
      "ratePerMessageMinor": 1,
      "unit": "segment"
    }
  ],
  "object": "pricing",
  "plan": {
    "code": "GROWTH",
    "currency": "INR",
    "includedMinutes": 1,
    "minimumTopUpMinor": 1,
    "monthlyFeeMinor": 1,
    "name": "Growth",
    "trialDays": 1
  },
  "voice": [
    {
      "callType": "manual",
      "destination": "+447",
      "direction": "outbound",
      "provider": "airtel",
      "ratePerMinuteMinor": 1
    }
  ]
}

List usage

get/v1/usage

Lists spend per UTC day, channel and destination over a window of at most 90 days.

One row per UTC day, channel (voice, sms, whatsapp, email, numbers, plan) and destination, oldest day first, over [from, to) — by default the last 30 UTC days, today included; filter by channel, and (a parent’s key, with subaccounts:read too) read one of your subaccounts’ spend with subaccountId — the answer names it. Each row counts the rated items, the billed and included units (minutes, SMS segments, messages or fees) and the amount charged; numbers carries number setup and rental fees, plan the plan fee net of any credit back. Refunded and unrated messages are not spend, and test-mode traffic is never rated, so it never appears. With breakdown=organization the rows cover everything your wallet paid for in the window — your own usage and that of every organization billed to it (an integration’s organizations, when yours is the integration’s billing organization) — each naming its organizationId.

Access: an organization key with the billing:read scope.

Query parameters

  • fromstring (date-time)

    Inclusive start (an ISO 8601 date — midnight UTC — or date-time). Default: the start of the UTC day 29 days before to (30 daily buckets).

  • tostring (date-time)

    Exclusive end. Default: now. At most 90 days after from.

  • channelstring

    Only this channel’s rows.

    One ofvoicesmswhatsappemailnumbersplan

  • subaccountIdstring (uuid)

    A parent’s key reads one of its subaccounts’ spend instead of its own (also needs subaccounts:read). Another organization’s id, or one that is not your subaccount, is 404.

  • breakdownstring

    P4: break the rows down by organization — your own usage and that of every organization your wallet paid for in the window (an integration’s organizations billed to it), each row naming its organizationId. Not with subaccountId.

    One oforganization

Response 200PublicUsage

  • breakdownstring

    P4: organization when the rows are broken down by organization.

    One oforganization

  • dataPublicUsageRow[]Required

    One row per UTC day × channel × destination × currency with any usage, oldest day first. Days with none are absent.

    10 fields of data
    • amountMinorintegerRequired

      Spent, in minor units of currency. A credit back (a plan change) is negative.

    • billedUnitsintegerRequired

      Minutes billed (whole minutes, one minimum once answered), SMS segments, messages, or fees.

    • channelstringRequired

      numbers: number setup fees and monthly rentals; plan: the plan’s monthly fee (net of the credit back a plan change gives).

      One ofvoicesmswhatsappemailnumbersplan

    • countintegerRequired

      Voice: calls rated (answered or not). Messages: messages charged. Numbers and plan: ledger entries.

    • currencystringRequired

    • datestringRequired

      The UTC day.

    • destinationstring | nullRequired

      Voice: the rate cell’s destination that priced the calls — an ISO country or a + prefix of up to six digits; SMS: the destination country. Null when the every-destination cell priced it, on WhatsApp, email, numbers and the plan, and for a message erased since.

    • includedUnitsintegerRequired

      Voice minutes the plan’s included bundle covered (not charged); 0 on every other channel.

    • organizationIdstring (uuid)

      P4: whose spend the row is — only when the read is broken down by organization (breakdown=organization).

    • unitstringRequired

      One ofminutesegmentmessagefee

  • fromstring (date-time)Required

    Inclusive.

  • objectstringRequired

    One ofusage

  • organizationIdstring (uuid)

    P4: the organization whose spend this is, on an integration’s read of one of its organizations.

  • subaccountIdstring (uuid) | nullRequired

    The subaccount whose spend this is (subaccountId was asked); null for your own.

  • tostring (date-time)Required

    Exclusive.

Errors

  • 400VALIDATION_FAILED — from/to is not an ISO 8601 date or date-time, to is not after from, the window spans more than 90 days, subaccountId is not a UUID, or breakdown is asked with subaccountId.
  • 401API_KEY_INVALID — missing, unknown, revoked or expired key.
  • 403API_KEY_SCOPE_MISSING — subaccountId needs subaccounts:read as well.
  • 404NOT_FOUND — subaccountId is not one of your organization’s subaccounts.
  • 429RATE_LIMITED — retry after Retry-After seconds.
  • 500INTERNAL_ERROR — our fault; retry with backoff (with the same Idempotency-Key on a write).
Request
curl 'https://api.trovacast.com/v1/usage?from=2026-10-01&to=2026-11-01&channel=voice' \
  -H "Authorization: Bearer $TROVACAST_API_KEY"
Response 200 (json)
{
  "breakdown": "organization",
  "data": [
    {
      "amountMinor": 1,
      "billedUnits": 1,
      "channel": "voice",
      "count": 1,
      "currency": "INR",
      "date": "2026-11-04",
      "destination": "GB",
      "includedUnits": 1,
      "organizationId": "ORGANIZATION_ID",
      "unit": "minute"
    }
  ],
  "from": "2026-11-05T10:00:00.000Z",
  "object": "usage",
  "organizationId": "ORGANIZATION_ID",
  "subaccountId": "SUBACCOUNT_ID",
  "to": "2026-11-05T10:00:00.000Z"
}