Type Alias ClientConfig

ClientConfig: {
    allowReconfigure?: boolean;
    apiHost?: string;
    apiVersion?: string;
    dataset?: string;
    fetch?:
        | {
            cache?: ResponseQueryOptions["cache"];
            next?: ResponseQueryOptions["next"];
        }
        | boolean;
    ignoreBrowserTokenWarning?: boolean;
    maxRetries?: number;
    perspective?: ClientPerspective;
    projectId?: string;
    proxy?: string;
    requester?: Requester;
    requestTagPrefix?: string;
    resultSourceMap?: boolean
    | "withKeyArraySelector";
    retryDelay?: (attemptNumber: number) => number;
    stega?: StegaConfig | boolean;
    timeout?: number;
    token?: string;
    useCdn?: boolean;
    useProjectHostname?: boolean;
    withCredentials?: boolean;
}

Type declaration

  • OptionalallowReconfigure?: boolean

    Whether the client can be reconfigured after initialization

  • OptionalapiHost?: string

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

  • OptionalapiVersion?: string

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

  • Optionaldataset?: string

    Dataset name to use

  • Optionalfetch?:
        | {
            cache?: ResponseQueryOptions["cache"];
            next?: ResponseQueryOptions["next"];
        }
        | boolean

    set cache and next options on client.fetch instead

  • OptionalignoreBrowserTokenWarning?: boolean

    Ignore warning about tokens in browser environments

  • OptionalmaxRetries?: number

    Number of times to retry failed requests

    5
    
  • Optionalperspective?: 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'
    
  • OptionalprojectId?: string

    Project ID to connect to

  • Optionalproxy?: string

    HTTP/HTTPS proxy URL to use

  • Optionalrequester?: Requester

    Don't use

  • OptionalrequestTagPrefix?: string

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

  • OptionalresultSourceMap?: boolean | "withKeyArraySelector"

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

  • OptionalretryDelay?: (attemptNumber: number) => number

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

  • Optionalstega?: StegaConfig | boolean

    Options for encoding Content Source Maps using steganography. Used for visual editing features.

  • Optionaltimeout?: number

    Request timeout in milliseconds

  • Optionaltoken?: string

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

  • OptionaluseCdn?: 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
    
  • OptionaluseProjectHostname?: boolean

    Don't use

  • OptionalwithCredentials?: boolean

    Whether to send credentials with requests