Sanity Library Reference Docs
    Preparing search index...

    Interface InitializedClientStegaConfig

    -- use InitializedClientConfig instead

    interface InitializedClientStegaConfig {
        projectId?: string;
        dataset?: string;
        token?: string;
        resource?: ClientConfigResource;
        perspective?: ClientPerspective;
        proxy?: string;
        requestTagPrefix?: string;
        ignoreBrowserTokenWarning?: boolean;
        ignoreWarnings?: string | RegExp | (string | RegExp)[];
        withCredentials?: boolean;
        allowReconfigure?: boolean;
        timeout?: number;
        maxRetries?: number;
        retryDelay?: (attemptNumber: number) => number;
        requester?: Requester;
        resultSourceMap?: boolean | "withKeyArraySelector";
        fetch?: boolean | { cache?: undefined; next?: undefined };
        lineage?: string;
        apiHost: string;
        apiVersion: string;
        useProjectHostname: boolean;
        useCdn: boolean;
        isDefaultApi: boolean;
        url: string;
        cdnUrl: string;
        stega: InitializedStegaConfig;
        headers?: Record<string, string>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    projectId?: string
    dataset?: string
    token?: string

    Configure the client to work with a specific Sanity resource (Media Library, Canvas, etc.)

    This allows the client to interact with resources beyond traditional project datasets. When configured, methods like fetch(), assets.upload(), and mutations will operate on the specified resource.

    createClient({
    resource: {
    type: 'media-library',
    id: 'your-media-library-id'
    }
    })
    perspective?: ClientPerspective

    What perspective to use for the client. See documentation

    As of API version v2025-02-19, the default perspective has changed from raw to published. https://www.sanity.io/changelog/676aaa9d-2da6-44fb-abe5-580f28047c10|Changelog

    'published'
    
    proxy?: string
    requestTagPrefix?: string

    Optional request tag prefix for all request tags

    ignoreBrowserTokenWarning?: boolean
    ignoreWarnings?: string | RegExp | (string | RegExp)[]

    Ignore specific warning messages from the client.

    • String values perform substring matching (not exact matching) against warning messages
    • RegExp values are tested against the full warning message
    • Array values allow multiple patterns to be specified
    // Ignore warnings containing "experimental"
    ignoreWarnings: 'experimental'

    // Ignore multiple warning types
    ignoreWarnings: ['experimental', 'deprecated']

    // Use regex for exact matching
    ignoreWarnings: /^This is an experimental API version$/

    // Mix strings and regex patterns
    ignoreWarnings: ['rate limit', /^deprecated/i]
    withCredentials?: boolean
    allowReconfigure?: boolean
    timeout?: number
    maxRetries?: number

    Number of retries for requests. Defaults to 5.

    retryDelay?: (attemptNumber: number) => number

    The amount of time, in milliseconds, to wait before retrying, given an attemptNumber (starting at 0).

    Defaults to exponential back-off, starting at 100ms, doubling for each attempt, together with random jitter between 0 and 100 milliseconds. More specifically the following algorithm is used:

    Delay = 100 * 2^attemptNumber + randomNumberBetween0and100

    requester?: Requester

    Don't use

    resultSourceMap?: boolean | "withKeyArraySelector"

    Adds a resultSourceMap key to the API response, with the type ContentSourceMap

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

    set cache and next options on client.fetch instead

    lineage?: string

    Lineage token for recursion control

    apiHost: string
    apiVersion: string
    useProjectHostname: boolean

    Don't use

    useCdn: boolean
    true
    
    isDefaultApi: boolean

    Internal, don't use

    url: string

    Internal, don't use

    cdnUrl: string

    Internal, don't use

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

    headers?: Record<string, string>

    Default headers to include with all requests

    request-specific headers will override any default headers with the same name.