Skip to main content
Query financial status for an operator-billed account — spend summary, credit or prepay balance, payment status, and invoice history. This gives budget-aware agents the context they need to make spend decisions without leaving the protocol. get_account_financials is only available when the seller declares account_financials: true in get_adcp_capabilities. It applies to operator-billed accounts only. For agent-billed accounts, the agent’s own billing system is the source of truth. Response Time: ~1s. Request Schema: /schemas/latest/account/get-account-financials-request.json Response Schema: /schemas/latest/account/get-account-financials-response.json

Quick start

Check remaining credit before launching a campaign:
import { testAgent } from "@adcp/client/testing";

const result = await testAgent.getAccountFinancials({
  account: { account_id: "acc_acme_001" },
});

if (!result.success) {
  throw new Error(`Request failed: ${result.error}`);
}

if ("errors" in result.data && result.data.errors) {
  throw new Error(`Operation failed: ${JSON.stringify(result.data.errors)}`);
}

const { spend, credit, payment_status } = result.data;
console.log(`Spent: $${spend?.total_spend} this period`);

if (credit) {
  console.log(`Available credit: $${credit.available_credit} of $${credit.credit_limit}`);
}

if (payment_status === "past_due") {
  console.log("Warning: payment is past due — campaigns may be paused");
}

Request parameters

ParameterTypeRequiredDescription
accountobjectYesAccount reference — by account_id or natural key (brand + operator + optional sandbox). Must be an operator-billed account.
periodobjectNoDate range for spend summary: start and end as ISO 8601 dates. Defaults to the current billing cycle if omitted.

Response

Success response: Returns financial data for the account. Only account, currency, period, and timezone are guaranteed — everything else depends on what the seller exposes.
FieldDescription
accountAccount reference, echoed from the request.
currencyISO 4217 currency code for all monetary amounts.
periodActual period covered (start, end). May differ from requested period if adjusted to billing cycle boundaries.
timezoneIANA timezone of the seller’s billing day boundaries (e.g., America/New_York). All dates in the response are calendar dates in this timezone.
spendSpend summary: total_spend (amount in currency) and optional media_buy_count.
creditPresent for credit-based accounts. Contains credit_limit, available_credit, and optional utilization_percent (0-100).
balancePresent for prepay accounts. Contains available balance and optional last_top_up (amount, date).
payment_statuscurrent, past_due, or suspended.
payment_termsPayment terms in effect: net_15, net_30, net_45, net_60, net_90, or prepay.
invoicesArray of recent invoices: invoice_id, amount, status (draft, issued, paid, past_due, void), optional period, due_date, paid_date.
Error response:
  • errors — Array of operation-level errors. No financial data is present.
Note: Responses use discriminated unions — you get either financial data OR errors, never both.

Common scenarios

Budget check before campaign launch

import { testAgent } from "@adcp/client/testing";

const financials = await testAgent.getAccountFinancials({
  account: { account_id: "acc_acme_001" },
});

if (!financials.success || "errors" in financials.data) {
  throw new Error("Could not check financials");
}

const campaignBudget = 15000;
const { credit } = financials.data;

if (credit && credit.available_credit < campaignBudget) {
  console.log(
    `Insufficient credit: $${credit.available_credit} available, ` +
    `$${campaignBudget} needed. ` +
    `Credit utilization: ${credit.utilization_percent}%`
  );
} else {
  console.log("Budget check passed — proceeding with campaign");
}

Prepay balance monitoring

import { testAgent } from "@adcp/client/testing";

const financials = await testAgent.getAccountFinancials({
  account: {
    brand: { domain: "acme-corp.com" },
    operator: "acme-corp.com",
  },
});

if (!financials.success || "errors" in financials.data) {
  throw new Error("Could not check financials");
}

const { balance } = financials.data;
if (balance && balance.available < 2000) {
  console.log(
    `Low balance warning: $${balance.available} remaining. ` +
    `Consider topping up before launching new campaigns.`
  );
}

Error handling

Error CodeDescriptionResolution
UNSUPPORTED_FEATUREAccount uses agent billing — financials not available from sellerQuery your own billing system for agent-billed accounts
UNSUPPORTED_FEATURESeller doesn’t have financial data for this account or periodVerify account_financials capability is true
ACCOUNT_NOT_FOUNDAccount does not exist or is not accessibleCheck account reference or re-sync

Next steps