Headless Engine

The global headless engine. You should instantiate one HeadlessEngine class per application and share it. Every headless controller requires an instance of Engine as a parameter.


Creates a new HeadlessEngine instance.

new HeadlessEngine(options: HeadlessOptions) : HeadlessEngine


  • options: HeadlessOptions

Returns HeadlessEngine


configuration (HeadlessConfigurationOptions, required)

The global headless engine configuration options.

middlewares (Array of Middleware)

List of additional middlewares. A middleware is a higher-order function that composes a dispatch function to return a new dispatch function. It is useful for logging actions, performing side effects like routing, or turning an asynchronous API call into a series of synchronous actions.

type MiddlewareAPI = { dispatch: Dispatch, getState: () => State }
type Middleware = (api: MiddlewareAPI) => (next: Dispatch) => Dispatch

preloadedState (StateFromReducersMapObject)

The initial headless state. You may optionally specify it to hydrate the state from the server in universal apps, or to restore a previously serialized user session.

reducers (Reducers, required)

Map object of reducers. A reducer is a pure function that takes the previous state and an action, and returns the next state.

(previousState, action) => nextState



Disable analytics tracking


Enable analytics tracking


Returns Promise


Returns HeadlessConfigurationOptions


Returns void


Returns void


Returns void



accessToken (string, required)

The access token to use to authenticate requests against the Coveo Cloud endpoints. Typically, this will be an API key or search token that grants the privileges to execute queries and push usage analytics data in the target Coveo Cloud organization.

analytics (object)

organizationId (string, required)

The unique identifier of the target Coveo Cloud organization (e.g., mycoveocloudorganizationg8tp8wu3)

platformUrl (string)

The Plaform URL to use. (e.g., https://platform.cloud.coveo.com) The platformUrl() helper method can be useful to know what url is available.

renewAccessToken (object)

A function that fetches a new access token. The function must return a Promise that resolves to a string (the new access token).

search (object)

The global headless engine configuration options specific to the SearchAPI.

Recommended Articles