Skip to content

ContentClientOptions

@ebitex/content-sdk — the framework-agnostic half.

  • Low-level: createDeliveryClient — one method per Content Delivery API endpoint, the delivered vocabulary as types (types.ts) and runtime guards (guards.ts), typed errors.
  • High-level: createContentClientresolveLocation(location) for router changes: site from the page’s own host, locale from the browser’s languages against the organization’s tree, the context bag, a full/normalized resolve strategy, caching and cancellation.

Nothing here imports React; the rendering layer is @ebitex/content-sdk/react. Both clients run in a browser (with a browser-safe delivery key) and in Node (any key).

apiKey: string

A Content delivery key, created on the Content app’s Delivery page. A key with an allowed-origins or allowed-IP-ranges restriction is browser-safe and may ship in a bundle; a key with neither is a server-side key and must never reach a browser — it works from any origin and any address. The SDK cannot tell the two apart; only the Delivery page can, so decide where this client runs before choosing a key.

DeliveryClientOptions.apiKey


optional baseUrl?: string

Defaults to ebitex’s production API. Override for a self-hosted or local deployment.

DeliveryClientOptions.baseUrl


optional cache?: false | CacheOptions

In-memory cache of resolved results (default 50 entries, LRU); false disables it.


optional context?: ContextBag | (() => ContextBag | Promise<ContextBag>)

The personalization context bag, or a (possibly async) function producing it per resolve. Always sent — {} by default — so the server resolves personalization and tokens.


optional env?: string

The delivery environment id, known ahead of time (e.g. a build-time constant) — sent as env= on the very first /sites//locales request of the session, not only on requests made after a live /sites response has revealed it. Doesn’t suppress either call (both still fire on every load) — it only lets them carry env= sooner, which is what makes them edge-cache-eligible from a session’s first request rather than only its second.


optional fetch?: {(input, init?): Promise<Response>; (input, init?): Promise<Response>; }

Injectable for testing or for a runtime with a non-global fetch.

(input, init?): Promise<Response>

MDN Reference

URL | RequestInfo

RequestInit

Promise<Response>

(input, init?): Promise<Response>

MDN Reference

string | URL | Request

RequestInit

Promise<Response>

DeliveryClientOptions.fetch


optional locale?: string | ((locales) => string | undefined)

The locale code to request: a string, or a function choosing from GET /locales. Omitted: the first of the browser’s languages (each region tag followed by its base language) present in the organization’s locale tree; nothing in Node, or when none matches (the server’s default).


optional referencePaths?: boolean

Ask every read to attach each reference descriptor’s own published address(es) (paths), so a document that references another page can link to it with no second query. Off by default; with it off, responses and persisted cache keys are unaffected.

Deliberately a client-level option rather than a per-call one: the resolved shape is part of the cache key, so a per-call flag would split two callers resolving the same location into two requests. A site either wants linkable references or does not.


optional resolve?: ResolveStrategy

Default { strategy: 'adaptive' }full for the first location this client instance resolves (and every later resolve of it), normalized (depth 1) for any other. In Node, always full: normalized trades depth for on-demand fetches that only a browser can make, and one server-side client instance serves every path for the life of the process.


optional site?: string | ((sites) => SiteSummary | undefined)

The site to resolve paths against: a rootNodeId, or a function choosing from GET /sites. Omitted: the sole published site, else the one whose hosts contains this page’s hostname. Required in Node when more than one site is published.