Generate Client SDK
Run
frontic generate to produce the typed client for your project — see the CLI reference for the full command.Initialization
The generated client supports two initialization patterns.Direct import
For the simplest case — no proxy, no global config:Factory with configuration
For projects that need a global proxy URL (e.g. browser-side requests routed through your own server to avoid CORS):Configuration
createClient(config?)
Create a configured client instance.
Parameters
object
Global configuration options.
Returns
Client
A configured client instance with all client methods.
Methods
Every method below shares the sameconfig object as a final argument, used to override per-request behaviour. The shared options are listed once here and referenced from each method.
Shared config object
Every method takes an optional config object as its final argument. Not every field applies to every method — the table below in each method’s section calls out which ones are honoured.
object
Per-request overrides. Optional.
client.block
Fetch a Detail Block by its key.
Parameters
string
required
The block name. Example:
'ProductCard'.string
required
The record key. Example:
'sku-12345'.object
See shared
config object.Returns
Block<ApiName>
The block payload, fully typed against the project’s API surface.
Example
Client SDK
client.listing
Fetch a Search Listing with optional parameters and query options.
Parameters
string
required
The listing name. Example:
'CategoryListing'.object
Listing parameters. Shape depends on the listing’s parameter definition.
Example:
{ categoryId: '<category-id>' }.object
Per-request overrides plus listing-specific query options.
Returns
Listing<ApiName>
The listing payload — items, pagination metadata, applied filters, available facets.
Example
Client SDK
client.tree
Fetch a Menu Tree — a hierarchical collection of records assembled from a Data Storage and rendered through a Detail Block.
Parameters
string
required
The tree’s API name. Example:
'CategoryNavigation'.object
Tree-specific query options plus the shared
config object.Returns
Tree<ApiName>
An
items array of root-level nodes, each carrying its subtree on $items. Every node’s shape (beyond $items) is defined by the tree’s connected Detail Block.Example
Client SDK
client.page
Fetch a Page by its slug.
Parameters
string
required
The URL slug of the page (without protocol). Example:
demo-shop.com/uk/women/shoes/running.object
See shared
config object.Returns
Page
The page payload —
data, page type, and any alternate urls.Example
Client SDK
client.sitemap
Fetch a Sitemap. The Nuxt module can serve the sitemap route from your app automatically.
Parameters
string
required
The project domain for which you want the sitemap.
number
The index of a nested sitemap (only if the sitemap was split up).
object
The shared
config object.Returns
string
The XML content of the sitemap.
Example
Client SDK
client.context
Fetch a context by its token.
Parameters
string
required
The
contextKey to look up. Example: 'ae0d4981-c363-4d5a-a49e-1f053d49f2f7'.object
See shared
config object.Returns
Context
The context —
region, locale, scope, token.Example
Client SDK
client.contextList
List the available contexts (region + currency + locales) for the project, optionally filtered by an existing context token.
Parameters
string
The
contextKey whose project + scope context variations are returned. Optional.object
See shared
config object.Returns
Context[]
Array of context options (region, currency, supported locales with URLs).
string
The active
contextKey, returned in the fs-context response header.Example
Client SDK
client.contextUpdate
Update an existing context’s region and locale on the Frontic server. Subsequent requests using the same contextKey reflect the change.
Parameters
object
required
The context fields to update.
string
required
The
contextKey to update.object
See shared
config object.Returns
Context
The updated context.
Example
Client SDK
Response
Response