agentic-endpoints
Feature-flagged catalog and checkout-prep API contracts for external agents.
Document Metadata
- title: Agentic Commerce API Endpoints
- description: Feature-flagged catalog and checkout-prep API contracts for external agents.
- status: evolving
- lastUpdated: "2026-04-09 14:11 ET (America/New_York)"
- owner: Engineering
Agentic Commerce API Endpoints These endpoints provide a controlled API surface for external agents to retrieve catalog context and
Agentic Commerce API Endpoints
These endpoints provide a controlled API surface for external agents to retrieve catalog context and prepare checkout handoff.
Runtime Gates
SHOPIFY_AGENTIC_ENABLED:trueenables/api/agents/*routesfalsereturns403(AGENTIC_DISABLED).
SHOPIFY_AGENTIC_CATALOG_MODE:readonlyallows catalog retrieval onlycheckoutallows checkout preparation route.
SHOPIFY_AGENTIC_ALLOWED_ORIGINS:- comma-separated origin allowlist (for example:
https://agent.example.com,https://partner.example.com) - when set, non-allowlisted origins receive
403(AGENTIC_ORIGIN_FORBIDDEN).
- comma-separated origin allowlist (for example:
SHOPIFY_AGENTIC_STOREFRONT_ACCESS_TOKEN(optional):- if set, agent routes use this token for Storefront API calls
- if empty, routes fall back to
SHOPIFY_STOREFRONT_ACCESS_TOKEN.
Buyer IP Forwarding
When using a private Storefront token (shpat_), the Storefront client forwards buyer IP using incoming request headers in this priority order:
Shopify-Storefront-Buyer-IPx-forwarded-for(first value)x-real-ipcf-connecting-ipfly-client-ipx-vercel-forwarded-for
This aligns agent requests with Shopify guidance for private token traffic attribution and throttling behavior.
GET /api/agents/catalog
Read-only catalog and policy context for agent retrieval.
Query params:
queryorq(optional): search query stringlimit(optional): max products returned (1-50, default10)pathname(optional): explicit storefront pathname used to resolve the approved Shopify Markets launch contract for localized pricing/context (for example/en-fr/search)
Market-context rules:
- External callers may localize catalog responses by supplying a supported storefront
pathnameor by sending a referer on a supported localized storefront path. - Internal Shopify routing headers such as
x-market-locale-prefixandx-market-original-pathnameare ignored on/api/agents/*requests and must not be treated as a public API contract. - Unsupported locale-like path hints (for example
/en-ca/search), whether supplied explicitly aspathnameor inferred fromreferer, return400 / INVALID_PATHNAMEinstead of silently falling back to the primary market.
Success response (200):
modequerycountproducts[]:id,handle,title,descriptionproductType,vendoravailableForSaleprice(minAmount,maxAmount,hasRange,displayLabel,currencyCode)productUrl(resolved against the approved localized market path when a supported localizedpathnameorrefereris supplied)imagevariants[](id/title/availability/price/options/url, preserving the same localized product base URL)
policies[](title/handle/url, preserving the same localized market path when applicable)generatedAt
Error responses:
400-INVALID_QUERY,INVALID_PATHNAME403-AGENTIC_DISABLED,AGENTIC_ORIGIN_FORBIDDEN500-AGENT_CATALOG_UNAVAILABLE
POST /api/agents/checkout
Creates a checkout-ready Shopify cart from agent-selected line items.
Request body:
{
"pathname": "/en-fr/products/example-product",
"lines": [
{
"merchandiseId": "gid://shopify/ProductVariant/1234567890",
"quantity": 1
}
]
}
Validation:
linesis required.- Line count must be
1to25. merchandiseIdmust be non-empty.quantitymust be an integer between1and25.pathnameis optional, but when supplied it must either be a primary-domain path (for example/search) or one of the supported localized path families under the approved Shopify Markets launch contract.
Market-context rules:
- Localized checkout preparation uses the same path-based market-resolution contract as the catalog route.
- Unsupported locale-like path hints, whether explicit
pathnamevalues or localizedrefererfallbacks, return400 / INVALID_PATHNAMEinstead of silently falling back to the primary market. - Internal Shopify routing headers are ignored on external
/api/agents/*calls.
Success response (200):
mode(checkout)checkout:cartIdcheckoutUrltotalQuantitysubtotalAmounttotalAmount
generatedAt
Error responses:
400-INVALID_JSON,INVALID_LINES,INVALID_PATHNAME403-AGENTIC_DISABLED,AGENTIC_ORIGIN_FORBIDDEN,AGENTIC_CHECKOUT_DISABLED500-AGENT_CHECKOUT_UNAVAILABLE
Provenance
- Source file:
docs/api/agentic-endpoints.md - Source URL: https://github.com/maggielerman/shopify-headless/blob/main/docs/api/agentic-endpoints.md