Interface InitializedClientConfig

interface InitializedClientConfig {
    allowReconfigure?: boolean;
    apiHost: string;
    apiVersion: string;
    cdnUrl: string;
    dataset?: string;
    fetch?: boolean | { cache?: undefined; next?: undefined };
    ignoreBrowserTokenWarning?: boolean;
    isDefaultApi: boolean;
    maxRetries?: number;
    perspective?: ClientPerspective;
    projectId?: string;
    proxy?: string;
    requester?: Requester;
    requestTagPrefix?: string;
    resultSourceMap?: boolean | "withKeyArraySelector";
    retryDelay?: (attemptNumber: number) => number;
    stega: InitializedStegaConfig;
    timeout?: number;
    token?: string;
    url: string;
    useCdn: boolean;
    useProjectHostname: boolean;
    withCredentials?: boolean;
}

Hierarchy (View Summary)

Properties

allowReconfigure?: boolean

Whether the client can be reconfigured after initialization

apiHost: string

API host to use. Defaults to 'api.sanity.io'

apiVersion: string

API version in YYYY-MM-DD format. Required to prevent breaking changes. Use current date to get latest features.

cdnUrl: string

Internal, don't use

dataset?: string

Dataset name to use

fetch?: boolean | { cache?: undefined; next?: undefined }

set cache and next options on client.fetch instead

ignoreBrowserTokenWarning?: boolean

Ignore warning about tokens in browser environments

isDefaultApi: boolean

Internal, don't use

maxRetries?: number

Number of times to retry failed requests

5
perspective?: ClientPerspective

The perspective to use when querying documents.

  • 'published': Only published documents (no drafts)
  • 'drafts': Published + draft documents (draft preferred if both exist)
  • 'raw': All documents including drafts and versions
'raw'
projectId?: string

Project ID to connect to

proxy?: string

HTTP/HTTPS proxy URL to use

requester?: Requester

Don't use

requestTagPrefix?: string

Optional prefix added to all request tags. Used to filter and aggregate log data in request logs.

resultSourceMap?: boolean | "withKeyArraySelector"

Whether to include Content Source Maps in API responses. Useful for visual editing and debugging.

retryDelay?: (attemptNumber: number) => number

Function to calculate retry delay in milliseconds. Default is exponential backoff with random jitter: delay = 100 * 2^attemptNumber + random(0,100)

The fully initialized stega config, can be used to check if stega is enabled

timeout?: number

Request timeout in milliseconds

token?: string

Token for authentication. Required for certain operations like mutations or accessing drafts

url: string

Internal, don't use

useCdn: boolean

Whether to use the Sanity CDN API. Set to true to use edge caching for better performance. Set to false to always use the live API for fresh data.

true
useProjectHostname: boolean

Don't use

withCredentials?: boolean

Whether to send credentials with requests