contentful.js
    Preparing search index...

    Interface CreateClientParams

    Client initialization parameters

    interface CreateClientParams {
        accessToken: string;
        adapter?: AxiosAdapterConfig | AxiosAdapterConfig[];
        alphaFeatures?: {
            includeContentSourceMaps?: boolean;
            timelinePreview?: TimelinePreview;
        };
        application?: string;
        basePath?: string;
        environment?: string;
        fetchOptions?: | Record<string, any>
        | Omit<RequestInit, "headers" | "method" | "signal" | "body">;
        headers?: Record<string, string>;
        host?: string;
        httpAgent?: any;
        httpsAgent?: any;
        includeContentSourceMaps?: boolean;
        insecure?: boolean;
        integration?: string;
        logHandler?: (level: string, data?: string | Record<string, any>) => void;
        proxy?: false | AxiosProxyConfig;
        requestLogger?: (request: Error | AxiosRequestConfig<any>) => unknown;
        responseLogger?: (response: Error | AxiosResponse<any, any, {}>) => unknown;
        retryLimit?: number;
        retryOnError?: boolean;
        space: string;
        timelinePreview?: TimelinePreview;
        timeout?: number;
    }
    Index
    accessToken: string

    Contentful CDA Access Token

    adapter?: AxiosAdapterConfig | AxiosAdapterConfig[]

    Optional axios request adapter (see axios docs )

    alphaFeatures?: {
        includeContentSourceMaps?: boolean;
        timelinePreview?: TimelinePreview;
    }

    Enable alpha features.

    Type Declaration

    • OptionalincludeContentSourceMaps?: boolean

      Use the includeContentSourceMaps option directly instead.

    • OptionaltimelinePreview?: TimelinePreview

      Enable Timeline Preview.

      This feature is only available when using the Content Preview API.

      Use the timelinePreview option directly instead.

    application?: string

    Application name and version e.g myApp/version

    basePath?: string

    Path appended to the host to support gateways/proxies with custom urls

    environment?: string

    Contentful Environment ID

    "master"
    
    fetchOptions?:
        | Record<string, any>
        | Omit<RequestInit, "headers" | "method" | "signal" | "body">

    Axios fetch options

    headers?: Record<string, string>

    Optional additional headers

    host?: string

    API host. Also usable with preview.contentful.com.

    "cdn.contentful.com"
    
    httpAgent?: any

    Optional Node.js HTTP agent for proxying (see Node.js docs and https-proxy-agent)

    httpsAgent?: any

    Optional Node.js HTTP agent for proxying (see Node.js docs and https-proxy-agent)

    includeContentSourceMaps?: boolean

    Enable Content Source Maps.

    This feature is only available when using the Content Preview API.

    insecure?: boolean

    Requests will be made over http instead of the default https

    true
    
    integration?: string

    Integration name and version e.g react/version

    logHandler?: (level: string, data?: string | Record<string, any>) => void

    A log handler function to process given log messages and errors. (The default can be found at: https://github.com/contentful/contentful-sdk-core/blob/master/src/create-http-client.ts)

    Type Declaration

      • (level: string, data?: string | Record<string, any>): void
      • Parameters

        • level: string

          Log level, e.g. error, warning, or info

        • Optionaldata: string | Record<string, any>

          Log data

        Returns void

    proxy?: false | AxiosProxyConfig

    Optional Axios proxy (see axios docs )

    requestLogger?: (request: Error | AxiosRequestConfig<any>) => unknown

    Interceptor called on every request. Takes Axios request config as an arg.

    responseLogger?: (response: Error | AxiosResponse<any, any, {}>) => unknown

    Interceptor called on every response. Takes Axios response object as an arg.

    retryLimit?: number

    Optional number of retries before failure.

    5
    
    retryOnError?: boolean

    If we should retry on errors and 429 rate limit exceptions

    true
    
    space: string

    Space ID

    timelinePreview?: TimelinePreview

    Enable Timeline Preview.

    This feature is only available when using the Content Preview API.

    timeout?: number

    connection timeout in milliseconds (default:30000)