Skip to main content
POST /api/v2/storefront/inventory-sources Creates an inventory source and registers its backing agent. External AGENT sources are created here. A pilot-enabled seller can also create a linked storefront source with LINKED_STOREFRONT that selects an approved storefront. That linked storefront source is always created PENDING; it cannot receive requests, book media, or be activated through this endpoint. MANAGED_SALES_AGENT and MODULAR_SOURCE rows use dedicated provisioning flows.

Request

Parameters

OAuth client credentials

Some agents accept only short-lived OAuth access tokens, which a client gets from the agent operator’s token endpoint with the OAuth 2.0 client-credentials grant (RFC 6749 §4.4). For these agents, set authenticationType to OAUTH_CLIENT_CREDENTIALS and send the client ID and secret the operator issued. Apostra requests an access token before it calls the agent and reuses it for up to five minutes, requesting a new one sooner if the token is about to expire. If the operator revokes a token early, calls can fail for up to five minutes until the next one is issued. No person needs to sign in, and there is no refresh token to manage. The auth object takes these fields:
  • type (required): oauth_client_credentials.
  • token_endpoint (required): the operator’s token endpoint. Must be a public HTTPS URL.
  • client_id (required): client ID issued by the agent operator.
  • client_secret (required): client secret issued by the agent operator. Stored encrypted and never returned.
  • scope (optional): space-separated scopes, when the operator requires them.
  • resource (optional): the protected resource the token is for (RFC 8707), as one URI or a list, when the operator’s authorization server requires it.
  • audience (optional): audience to request, when the operator’s authorization server requires one.
  • auth_method (optional): how the client ID and secret reach the token endpoint, either basic (HTTP Basic header, the default) or body (form fields). Use body only if the operator says its server does not accept basic.
You can also create the source without auth and enter the credentials in the secure credential form in chat. It asks for the token endpoint, client ID, client secret and client-authentication method, plus an optional scope and audience; resource can only be set through the API. To change any of these settings later, send the complete auth object again with update inventory source, or save them again in the credential form. Either way the new settings replace the stored ones, so saving from the form clears a resource that was set through the API.
Treat auth.token, client secrets, and JWT private keys as production secrets. They are encrypted at rest, referenced only by an opaque ref, and never echoed back — responses surface authConfigured: true. Never log or commit raw credentials.
For external-sales-agent:v1, use bearer_token with auth.type: "bearer", basic_auth with auth.type: "basic", or none without auth. The shared contract schema also has typed API-key, OAuth 2.0, JWT, and platform-service-account methods for integrations that register those methods. Authentication is a closed platform-owned set; requests cannot install executable header or request templates.

Response

201 Created with the new InventorySourceResponse:
Every external AGENT source is created in status: "PENDING", including a NO_AUTH source, and proceeds through the normal registration and readiness workflow before activation. Reachability is reported independently by source health and connectivity checks. For a newly registered OAUTH identity, the response includes oauth.authorizationUrl when authorization discovery and flow storage succeed; redirect the operator there to complete consent. Complete authorization even when oauthAudience was supplied—the override selects the token resource; it is not a credential. If the endpoint reuses an existing identity, create reuses its OAuth configuration and does not reinitialize consent; update an existing source first when the audience or authorization must change. For an enabled LINKED_STOREFRONT pilot, send only its execution type and approved partner target:
The response returns one durable pending relationship when the same target is submitted again. Missing, self, cross-account, or no-longer-approved targets fail without revealing the target’s state. A linked Source can be disabled with the normal update endpoint, but this release does not expose activation, selection, request forwarding, or booking. When attachToAgentId is supplied, Apostra creates the Source and attaches it to that exact organization-owned Sales Agent as one operation. The response returns the attached Agent in agentCapabilityUid. If the request response is interrupted, return to that Agent’s Inventory sources section and refresh before sending another create request: a committed Source appears there already. Do not blindly resubmit an ambiguous request. If the Agent declares both product paths, agentProductMode records how this Source participates: Storefront-built catalog (WHOLESALE), Agent-supplied products (COMPOSING), or both (BOTH). The Agent declaration is re-read by the server; the launch payload is only presentation guidance. Connecting checks that the agent’s endpointUrl is registered with the AAO registry. If the agent is not registered, the request is rejected with 400 VALIDATION_ERROR. If the registry cannot be reached to perform the check, the request returns 503 SERVICE_UNAVAILABLE — a transient connectivity problem, not a rejection of the agent, so retrying usually succeeds.
An adagents.json file identifies which agents a publisher authorizes; it is not an agent endpoint. When starting from a publisher domain, resolve its file through AAO and copy the selected agent’s authorized_agents[].url. Do not copy the publisher well-known URL, AAO hosting.resolved_url, or the document’s authoritative_location into endpointUrl.

After connection

Once connected, an external AGENT source can either answer buyer briefs live on the Agent-supplied path — available on any account, including an account with Listing + Distribution that keeps routing briefs through its own agent — or provide cached components for the Storefront-built path, which requires a Merchandising plan (or the custom modular sources add-on) and a source that supports component caching. To support component caching, the agent’s product response must expose stable raw products: ids, names/descriptions, pricing options, formats, publisher properties or other inventory selectors, delivery type, and enough execution metadata to route a selected product later. Apostra reports component-cache problems separately from live source-call failures.
Registering the agent is not the same as authorizing it to sell a publisher’s inventory. This connect-time check only confirms the agent is registered in the AAO registry. Whether a publisher’s adagents.json authorizes that agent to sell their inventory is a separate question, surfaced later as an advisory setup/product signal today — not at connect time. A registered agent can be connected and still be unauthorized for a given publisher’s inventory.

Errors

  • 400 VALIDATION_ERROR — missing required field, a non-public endpoint or oauthAudience, auth supplied for an OAUTH/NO_AUTH agent, auth missing for a JWT agent, a new NO_AUTH agent from an account that is not a Developer account, a malformed attachToAgentId, or the agent’s endpoint is not registered with the AAO registry. An adagents.json or authoritative_location document is also rejected as endpointUrl. (Agent registration is distinct from publisher authorization — see the note above.)
  • 401 UNAUTHORIZED — missing or invalid API key.
  • 403 ACCESS_DENIED — attachToAgentId identifies an Agent owned by another organization or one the caller cannot administer.
  • 404 NOT_FOUND — attachToAgentId is unavailable in this organization, or the Agent workspace is not enabled for the account. A linked target that is absent, unauthorised, or otherwise unavailable also returns this generic result.
  • 503 SERVICE_UNAVAILABLE — the AAO registry could not be reached to verify the agent’s registration. This is transient; retry the request.
See Errors for the full error contract.

Inventory source tasks

All operations

Inventory sources overview

Concepts and lifecycle

Update inventory source

Change fields or rotate auth

Storefront onboarding

End-to-end seller setup