Sanity Library Reference Docs
    Preparing search index...
    interface StartInstanceArgs {
        ancestors?: GlobalDocumentReference<string>[];
        context?: StartContext;
        definition: string;
        grantsFromPath?: string;
        initialFields?: InitialFieldValue[];
        instanceId?: string;
        perspective?: WorkflowPerspective;
        version?: number;
    }
    Index

    Properties

    ancestors?: GlobalDocumentReference<string>[]
    context?: StartContext

    The instance's start seed — stable named values set once at start (or handed down by a parent's spawn.context) and never mutated after. Effect bindings and conditions read them as $context.<name>; the $effects bag is separate (completed effects' outputs only).

    Each value may be any JSON — a scalar, a GlobalDocumentReference, or an arbitrary object/array. Scalars and GDRs store as their typed context entries; anything else stores as one context.json entry, so all forms read back the same under $context.<name>.

    definition: string

    The definition's name — which deployed workflow to instantiate.

    grantsFromPath?: string

    URL path on the supplied client where the engine fetches the caller's ACL grants. Identity is always token-resolved — actor is resolved from the supplied client's token, never passed in — and grants feed the advisory $can.* params action conditions can read; omitting this leaves the rendered $can undefined (conditions referencing it fail closed, nothing else is gated engine-side — the real Sanity write boundary still enforces).

    Canvas-style: /canvases/<resourceId>/acl. Project/dataset: /projects/<id>/datasets/<ds>/acl.

    initialFields?: InitialFieldValue[]

    Initial values for input-sourced field entries declared on the workflow definition. Each value is a typed InitialFieldValue whose type + name must match an entry on definition.fields[]. Entries not present here resolve to their default (null for scalars, [] for arrays, or the entry's own initialValue resolution for query/working-memory entries).

    To start an instance "about" a specific document, declare a { type: "subject", name: "subject", initialValue: { type: "input" } } entry on the workflow and pass { type: "subject", name: "subject", value: { id, type } } here. Conditions then read it as $fields.subject, and document pickers key on the subject kind.

    instanceId?: string

    Caller-supplied id; auto-generated otherwise (mint one with instanceDocId). This is start's idempotency key: a retry carrying the same id resumes the earlier attempt's outstanding commits instead of creating a duplicate — the per-instance request ledger can't cover the create (it lives on the instance document), so id identity is the rail. Inputs bind on the create only; a resume never re-reads them.

    perspective?: WorkflowPerspective

    Optional read-side perspective for this instance. Threaded into field-entry query resolution and spawn forEach.groq discovery so a workflow can scope its reads to a Content Release stack. Child instances inherit the parent's perspective on spawn.

    Pass [releaseName] for a workflow whose subject is a release; pass [releaseName, "drafts"] to also include drafts; omit for the engine's default (no perspective override = "raw" on the test client).

    version?: number

    Optional explicit version. Defaults to the highest deployed version.