Sanity Library Reference Docs
    Preparing search index...

    Interface ScheduledFunctionContextBeta

    The context object passed to the schedule function handler.

    interface ScheduledFunctionContext {
        clientOptions?: {
            apiHost?: string;
            dataset?: string;
            projectId?: string;
            token?: string;
        };
        local?: boolean;
    }
    Index

    Properties

    clientOptions?: {
        apiHost?: string;
        dataset?: string;
        projectId?: string;
        token?: string;
    }

    Options that can be passed to a @sanity/client constructor to configure it against the project and dataset which triggered the event. Note that you should always specify an explicit apiVersion in YYYY-MM-DD format (e.g. 2025-05-01).

    Constructing a client with the options from the context:

    const client = createClient({
    apiVersion: '2025-05-01',
    ...context.clientOptions,
    })
    local?: boolean

    local is set to true when testing your function locally. i.e. sanity function test func-name Otherwise, the property is not set.