Skip to main content
Every fetch helper, component, factory, and route in the SDK accepts an optional SeoClientConfig. Anything you don’t pass falls back to environment variables.
apiKey
string
Your store’s API key (ask_…), from the dashboard under Settings → API Keys. Sent as Authorization: Bearer. Falls back to process.env.AGENTSHOP_API_KEY (on Hydrogen/Oxygen: context.env.AGENTSHOP_API_KEY, resolved by the adapter). It’s a secret — server-side only, never in a client bundle. See Security.
baseUrl
string
Base URL of the AgentShop headless-SEO endpoint, e.g. https://api.useagentshop.com/api/v1/headless-seo. Falls back to process.env.AGENTSHOP_SEO_URL (Hydrogen: context.env). Trailing slashes are stripped.
timeoutMs
number
default:"3000"
Per-request fetch timeout in milliseconds, applied via AbortSignal.timeout (feature-detected). The 3-second default suits the warm endpoint; raise it (e.g. 15000) when testing against a cold or local backend.
fetchOptions
Record<string, unknown>
Extra options merged into the underlying fetch call. The main use is framework caching, e.g. Next.js ISR: { next: { revalidate: 60 } }. The Next.js helpers already default this to { next: { revalidate: 3600 } }; anything you pass here overrides it.

Environment variables

Set both locally and on your deploy platform (Vercel, Oxygen storefront environment, etc.) — “works locally, empty in production” is almost always a missing deploy-time variable. Because AGENTSHOP_API_KEY is a secret, use a server-side/secret env var — never a NEXT_PUBLIC_* (or otherwise client-exposed) variable.

Failure behavior

The fetch helpers never throw. On any failure — missing config, missing/invalid key (401), 404, timeout, network error — they return null. A missing base URL additionally logs a single warning:
(A missing API key doesn’t warn — the helpers just return null.)

resolveConfig

The throwing variant, for callers that want explicit validation (startup checks, health endpoints). Throws with a descriptive message when the base URL is missing; the fetch helpers use the non-throwing path internally.