Buyer API Reference
Overview
Apostra Buyer API provides enhanced capabilities for brand advertisers to manage advertising campaigns through both REST and MCP (Model Context Protocol) interfaces. The API follows the SESOFI (Single Endpoint, Single Object, Full Intent) design principle:- Single Endpoint - One endpoint per high-level intent (update an advertiser, run a media buy, refine a discovery query)
- Single Object - The endpoint accepts one object describing the full intent
- Full Intent - That object carries every related decision so an agent can express what it wants in one call instead of orchestrating sub-resource updates
Connection Methods
- REST API
- MCP (AI Agents)
REST API (Recommended for traditional integrations)
Standard HTTP methods with JSON request/response bodies.Production:Hosted buyer-agent MCP edge
Apostra-hosted buyer-agent runtimes connect through an installation-scoped Streamable HTTP endpoint:/mcp/buyer endpoint.
See Buyer agent credentials for the
ordinary credential lifecycle. Send the hosted runtime token as a bearer
credential. Apostra authenticates the token, reads back the active
installation’s exact owner and lifecycle generation, resolves the ready runtime
through the deployment controller, and forwards the MCP stream with a fresh
deployment-signed caller assertion. The client credential itself is never
forwarded.
The edge supports GET, POST, and DELETE. Preserve the Mcp-Session-Id
header returned by the runtime on subsequent stateful MCP requests. A 401
means the bearer credential is missing or invalid, a 404 deliberately covers
both missing and unauthorized installation IDs, and a 503 means the hosted
runtime or its deployment control plane is unavailable. Other HTTP methods
return 405.
Hosted-runtime provisioning may temporarily send either installationId or
lifecycleGeneration alone to the internal binding endpoint until 7 September
2027. Apostra accepts those deprecated legacy requests but discards the
partial provenance, returns Deprecation and Sunset headers, and reports the
partial_ignored disposition. A complete noncanonical legacy pair is preserved
as a separate non-routable tuple and reports legacy_complete_bound; it never
becomes a hosted runtime target. Only a versioned UUID installationId paired
with a canonical non-negative lifecycle generation reports bound and is used
for routing.
OpenAPI Specification
Download the OpenAPI specification for SDK generation or API exploration:- Production: /api/v2/buyer/openapi.yaml
Authentication
All API requests require authentication using your Apostra API key:Get API Key
Request API credentials to get started
REST API Endpoints
Send a fax
See Agent fax lines for provisioning, inbound delivery, media hosting, retry behavior, and the complete error model. Send a PDF through a fax line provisioned for your account:interchange:write. to must use E.164 format.
mediaUrl must be a temporary HTTPS URL for the PDF, and mediaSha256 must
be the lowercase SHA-256 digest of the same file. Apostra does not retain
the URL or destination number in the fax command ledger.
Use a new UUID for each intended fax. Retrying the same requestId with the
same endpoint, destination, and PDF is safe. Changing any of those fields
while reusing the UUID returns 409.
A successful submission returns 202:
duplicate is true when the response comes from a completed submission
with the same requestId. A 503 with a submission state of
submission_unknown means the provider may have accepted the fax. Do not
retry it with a new UUID until the submission has been reconciled.
Agent activation
The public contract is the machine-readable entry point for an agent that starts with
no Apostra credential. The protected probe accepts the short-lived WorkOS bearer
token; ordinary user, API-key, and M2M credentials receive
AGENT_REGISTRATION_REQUIRED. See Authentication
for the registration exchange and full response shape.
The contract’s allowance.grants are effective sandbox capabilities derived by
Apostra from the verified Agent Registration credential and activation state.
They are not separate WorkOS permissions that an operator must create.
Discover the activation contract
The discovery endpoint is public and requires no bearer token:authInstructions for the current WorkOS registration and assertion-exchange
steps instead of hard-coding that protocol. The endpoint URLs in the contract are
environment-specific; the example above shows production.
Verify the registered workload
After exchanging the WorkOS assertion for an access token, make the authenticated activation call:activationId and workloadId on retries.
Apostra durably records the first successful authenticated activation before it
returns 2xx. Its first customer-local provider mapping changes the response to
state: "bound_free", clears anonymous cleanup, and preserves the zero-dollar spend
cap. Replaying that exact mapping is safe; a different second account is rejected.
Claiming the registration later is optional for recovery or named administration and
preserves activationId; the response then reports state: "customer_bound" and the
customer-authorized permissions. customer_bound describes identity attachment only.
Human and agent principals then read the same Buyer Setup capability verdicts; there is
no separate agent admission or Account lifecycle mode. Claiming does not create or
admit an Account, accept Terms, establish payment authority, or grant permission for
real operations.
For schema 1.2 compatibility, a customer_bound response may include the
deprecated account posture projection when the caller has claimed customer
authority. Free and unclaimed responses return account: null. Never use this
field for authorization; use the operation-specific Buyer Setup capabilities.
An unbound_free registration that never maps an account is retired automatically after
expiry.
Advertisers
Core advertiser management endpoints. Following SESOFI,GET returns full advertiser data including all nested configuration.
Query Parameters for
GET /advertisers:
includeAccounts- Whentrue, includes linked partner accounts in each advertiser response (avoids N+1 calls to/accounts)includeBrand- Whentrue, includes resolved brand information (logos, colors, industry)take/skip- Pagination
- Advertiser details (name, brand, sandbox, etc.)
- Event sources
- Test cohorts
- Measurement configuration
- Resolved brand (when
includeBrand=true)
linkedAccounts field (available on create and update):
storefrontId- Storefront the source lives onsourceId- Inventory source within the storefront whose account is being linkedaccountId- Source-assigned account identifier (must come fromGET /accounts/available)billingType- Billing arrangement type (e.g."brand","agency")
Event Sources
Register the channels (pixels, SDKs, CRM exports, MMPs) that send conversion events for an advertiser. Events sent against an unregisteredevent_source_id are rejected, so configure sources before turning on a pixel or feed.
Example - Sync event sources:
Test Cohorts
Manage test cohorts for A/B testing and incrementality measurement.
Example - Create Test Cohort:
name, cohortType, definition. Optional: role (TREATMENT | CONTROL, default TREATMENT), description, estimatedSize. The path param is :cohortId on the GET/PUT/DELETE routes.
Measurement Config
Configure measurement settings for an advertiser. This is a singleton resource per advertiser.
Example - Update Measurement Config:
mmmEnabled, mmmConfig, brandLiftEnabled, settings (key-value blob for additional vendor-specific settings). See the Measurement & incrementality guide for the full configuration shape.
Campaigns
Product discovery
See Get products across storefronts
for progressive polling and qualified product identity.
Creatives
Creatives are manifest-based and nested under campaigns rather than advertisers. The full lifecycle (formats, manifests, asset uploads) is documented in the Creative object guide.
For a creative sent through
sync_creatives, each platform_links entry names
the connected agent and may include its provider creative ID, latest sync state,
approval state, and UTC sync timestamp. Use that linkage to reconcile the saved
campaign creative with the object created on the platform. The field is optional
for unsynced and historical creatives.
Media Buys
View media buy execution status and delivery metrics. Media buy and package budgets are gross (fee-inclusive) — reads includebudget_denomination: "gross" and a read-only budget_breakdown showing the media/fee split at the fee terms locked when the buy was created (see Budgets and fees). Reduce budgets through the campaign update endpoint: when lowering budget.total below the live allocation, include the mediaBuys[] package reductions in the same atomic request.
Media Buy Statuses:
DRAFT- Initial state, not yet submittedPENDING_APPROVAL- Submitted, awaiting approvalINPUT_REQUIRED- Additional information neededACTIVE- Currently runningPAUSED- Temporarily pausedCOMPLETED- Successfully finishedFAILED- Execution failedREJECTED- Not approvedARCHIVED- Archived/deleted
Reporting
Access hierarchical reporting metrics for campaigns, media buys, and packages. The endpoint supports both summary and timeseries views, plus a CSV download mode.
Query Parameters:
advertiserId- Filter by advertiser IDcampaignId- Filter by campaign IDchannelGroupId- Filter to media buys in one saved campaign channel groupmediaBuyId- Filter by media buy IDstartDate/endDate- ISO 8601 datesview-summary(default — hierarchical advertiser → campaign → media buy → package) ortimeseries(rows by date)download- Passtrueto return a signed CSV download URL instead of JSON
GET /api/v2/buyer/advertisers/:advertiserId/events/summary in the Reporting overview guide.
Source Accounts
Discover and link advertiser accounts on inventory sources (e.g. a DSP seat). The flow is: discover available accounts viaGET .../accounts/available, then assign one to the advertiser via POST .../accounts.
Query Parameters for
GET .../accounts/available:
storefrontId(required) - Storefront the source lives on. Get fromGET /api/v2/buyer/storefronts.sourceId(required) - Inventory source withinstorefrontIdwhose accounts to list.credentialId- ID of a specific registered credential to use for account discovery. Required when the account has multiple credentials registered for this source. UseGET /api/v2/buyer/storefronts/credentialsto list credentials and their IDs.refresh- Defaults totrue, which refreshes live source state. Set tofalseonly for a read-only cached projection; cached results can be stale or empty and the request will not mirror accounts, call source discovery, or triggersync_accounts.
accountId- Source-assigned account identifiername- Human-readable account name (e.g."Acme c/o Pinnacle")advertiser- Advertiser name as recorded by the sourcebillingProxy- Agency or proxy buying on behalf of the advertiserhouse- Domain or house identifierbilling- Billing arrangement type (e.g."brand")sources- Array of{ storefrontId, storefrontName, sourceId, sourceName }showing every storefront source through which this account is reachable
Storefronts
Browse storefronts (publisher inventory marketplaces) and register credentials per inventory source. See the Storefront object guide for the full data model and end-to-end flow.
Query Parameters for
GET /storefronts:
name- Case-insensitive partial match on storefront namelimit- 1..50 (default 20)offset- Pagination offset (default 0)
requiresOperatorAuth, billingOptions, accountResolution) appear on the Sales Agents endpoints, not on storefronts — see the Sales Agents section below.
The
advertiserId field has been removed from the register account body. Use the Partner Accounts endpoints to link accounts to specific advertisers after registration.Catalogs
Manage product and offering catalogs that can be synced to partner platforms.
Supported catalog types:
product, offering, hotel, flight, destination, home_listing, vehicle, job, local, retail, travel, education
Example - Create a catalog:
Offerings
Manage individual offerings (products, listings, etc.) within a catalog.
Example - Create an offering:
MCP Tools
The Buyer MCP server exposes dedicated tools for session-level actions and a genericapi_call tool for REST operations. Use the dedicated MCP tool when one exists. Use api_call for buyer REST operations that do not have a more specific tool. Every api_call requires a named operation; the legacy raw method + endpoint form is no longer supported and is rejected.
Required workflow for AI agents: Choose the most specific MCP tool first. For account context, call
customer_switch directly instead of routing through api_call. For REST operations, call ask_about_capability first when unsure of the exact interface, then call api_call with an operation name. Field names are camelCase (e.g. advertiserId, not advertiser_id).Switch Account
Account switching is session state. It is not a per-call REST parameter and is not available throughapi_call.
To operate on a different account in the same MCP session, call the dedicated customer_switch MCP tool:
api_call without customerId in params or body. If the target account is not available to the current MCP session, re-authenticate with that account’s credentials.
Using api_call
The api_call tool dispatches a named buyer operation. It handles authentication automatically and derives the HTTP method and endpoint from the operation, so you never write a URL. Pass params (query), pathParams, and body as the operation requires.
MCP Example - List Advertisers:
Supported Endpoint Families
Theapi_call tool allows access to: