Sanity Library Reference Docs
    Preparing search index...

    Type Alias components

    type components = {
        headers: never;
        parameters: never;
        pathItems: never;
        requestBodies: never;
        responses: {
            BadRequest: {
                content: {
                    "application/json": components["schemas"]["ErrorResponse"];
                };
                headers: { [name: string]: unknown };
            };
            InternalServerError: {
                content: {
                    "application/json": components["schemas"]["ErrorResponse"];
                };
                headers: { [name: string]: unknown };
            };
            Unauthorized: {
                content: {
                    "application/json": components["schemas"]["ErrorResponse"];
                };
                headers: { [name: string]: unknown };
            };
        };
        schemas: {
            Application: {
                bundleVersion?: string;
                intentBaseUrl?: string;
                key?: string;
                name?: string;
                resource?: { id?: string; type?: "dataset" };
                schemaDescriptorId?: string;
                title?: string;
            };
            Capabilities: {
                features?: components["schemas"]["FeatureOverrides"];
                read?: components["schemas"]["Capability"];
                write?: components["schemas"]["Capability"];
            };
            Capability: boolean
            | components["schemas"]["CapabilityPreset"];
            CapabilityPreset: { preset: "minimal" | "standard" };
            ChatRequest: {
                application?: components["schemas"]["Application"];
                config?: components["schemas"]["Config"];
                format: "markdown" | "directives";
                messages: components["schemas"]["Message"][];
                stream: boolean;
            };
            ChatResponse: { applicationKey?: string; text?: string };
            Config: {
                capabilities?: components["schemas"]["Capabilities"];
                filter?: components["schemas"]["Filter"];
                instruction?: string;
                perspectives?: components["schemas"]["Perspectives"];
                userMessageContext?: { [key: string]: string };
            };
            ErrorResponse: {
                details?: string;
                error: string;
                issues?: components["schemas"]["ValidationIssue"][];
            };
            FeatureOverrides: { webSearch?: boolean };
            Filter: { read?: string; write?: string };
            Message: {
                content: string;
                id?: string;
                name?: string;
                role: "user" | "assistant" | "system";
            };
            Perspectives: { read?: string[]; write?: string };
            PromptRequest: {
                config?: components["schemas"]["Config"];
                format: "markdown" | "directives";
                instructions?: string;
                message: string;
                organizationId: string;
            };
            ValidationIssue: { code?: string; message?: string; path?: string[] };
        };
    }
    Index

    Properties

    headers: never
    parameters: never
    pathItems: never
    requestBodies: never
    responses: {
        BadRequest: {
            content: { "application/json": components["schemas"]["ErrorResponse"] };
            headers: { [name: string]: unknown };
        };
        InternalServerError: {
            content: { "application/json": components["schemas"]["ErrorResponse"] };
            headers: { [name: string]: unknown };
        };
        Unauthorized: {
            content: { "application/json": components["schemas"]["ErrorResponse"] };
            headers: { [name: string]: unknown };
        };
    }

    Type declaration

    • BadRequest: {
          content: { "application/json": components["schemas"]["ErrorResponse"] };
          headers: { [name: string]: unknown };
      }

      Bad Request - Request validation failed

      • content: { "application/json": components["schemas"]["ErrorResponse"] }
        • application/json: components["schemas"]["ErrorResponse"]
          {
          * "error": "Invalid request",
          * "details": "Request body validation failed",
          * "issues": [
          * {
          * "code": "invalid_type",
          * "path": [
          * "messages"
          * ],
          * "message": "Required"
          * }
          * ]
          * }
      • headers: { [name: string]: unknown }
    • InternalServerError: {
          content: { "application/json": components["schemas"]["ErrorResponse"] };
          headers: { [name: string]: unknown };
      }

      Internal Server Error

      • content: { "application/json": components["schemas"]["ErrorResponse"] }
        • application/json: components["schemas"]["ErrorResponse"]
          {
          * "error": "Internal Server Error",
          * "details": "An unexpected error occurred"
          * }
      • headers: { [name: string]: unknown }
    • Unauthorized: {
          content: { "application/json": components["schemas"]["ErrorResponse"] };
          headers: { [name: string]: unknown };
      }

      Unauthorized - Missing or invalid authentication token

      • content: { "application/json": components["schemas"]["ErrorResponse"] }
        • application/json: components["schemas"]["ErrorResponse"]
          {
          * "error": "Unauthorized",
          * "details": "Missing authorization token"
          * }
      • headers: { [name: string]: unknown }
    schemas: {
        Application: {
            bundleVersion?: string;
            intentBaseUrl?: string;
            key?: string;
            name?: string;
            resource?: { id?: string; type?: "dataset" };
            schemaDescriptorId?: string;
            title?: string;
        };
        Capabilities: {
            features?: components["schemas"]["FeatureOverrides"];
            read?: components["schemas"]["Capability"];
            write?: components["schemas"]["Capability"];
        };
        Capability: boolean
        | components["schemas"]["CapabilityPreset"];
        CapabilityPreset: { preset: "minimal" | "standard" };
        ChatRequest: {
            application?: components["schemas"]["Application"];
            config?: components["schemas"]["Config"];
            format: "markdown" | "directives";
            messages: components["schemas"]["Message"][];
            stream: boolean;
        };
        ChatResponse: { applicationKey?: string; text?: string };
        Config: {
            capabilities?: components["schemas"]["Capabilities"];
            filter?: components["schemas"]["Filter"];
            instruction?: string;
            perspectives?: components["schemas"]["Perspectives"];
            userMessageContext?: { [key: string]: string };
        };
        ErrorResponse: {
            details?: string;
            error: string;
            issues?: components["schemas"]["ValidationIssue"][];
        };
        FeatureOverrides: { webSearch?: boolean };
        Filter: { read?: string; write?: string };
        Message: {
            content: string;
            id?: string;
            name?: string;
            role: "user" | "assistant" | "system";
        };
        Perspectives: { read?: string[]; write?: string };
        PromptRequest: {
            config?: components["schemas"]["Config"];
            format: "markdown" | "directives";
            instructions?: string;
            message: string;
            organizationId: string;
        };
        ValidationIssue: { code?: string; message?: string; path?: string[] };
    }

    Type declaration

    • Application: {
          bundleVersion?: string;
          intentBaseUrl?: string;
          key?: string;
          name?: string;
          resource?: { id?: string; type?: "dataset" };
          schemaDescriptorId?: string;
          title?: string;
      }

      Target Sanity application configuration

      • OptionalbundleVersion?: string

        Bundle version

      • OptionalintentBaseUrl?: string

        Format: uri

        Base URL for the Sanity Studio

        https://your-studio.sanity.studio
        
      • Optionalkey?: string

        Application key in format "projectId.datasetName"

        abc123.production
        
      • Optionalname?: string

        Application name

      • Optionalresource?: { id?: string; type?: "dataset" }
        • Optionalid?: string

          Resource ID in format "projectId.datasetName"

          abc123.production
          
        • Optionaltype?: "dataset"

          Resource type

      • OptionalschemaDescriptorId?: string

        Schema descriptor ID

      • Optionaltitle?: string

        Application title

    • Capabilities: {
          features?: components["schemas"]["FeatureOverrides"];
          read?: components["schemas"]["Capability"];
          write?: components["schemas"]["Capability"];
      }

      Agent capabilities that control what operations are allowed. Each capability can be a boolean or an object with a preset.

      {
      * "read": true,
      * "write": false
      * }
    • Capability: boolean | components["schemas"]["CapabilityPreset"]

      A capability can be: - true: Full access (standard preset) - false: No access - { preset: 'minimal' | 'standard' }: Explicit preset selection

    • CapabilityPreset: { preset: "minimal" | "standard" }
      • preset: "minimal" | "standard"

        For read capability: - minimal: Basic queries only (no bulk document analysis) - standard: All read tools including bulk analysis

        For write capability:
        - minimal: Basic mutations only (no bulk mutations)
        - standard: All write tools including bulk mutations
        
    • ChatRequest: {
          application?: components["schemas"]["Application"];
          config?: components["schemas"]["Config"];
          format: "markdown" | "directives";
          messages: components["schemas"]["Message"][];
          stream: boolean;
      }
      • Optionalapplication?: components["schemas"]["Application"]
      • Optionalconfig?: components["schemas"]["Config"]
      • format: "markdown" | "directives"

        Controls how directives in the response are formatted. - markdown (default): Directives are resolved server-side into standard markdown (e.g., links with titles). - directives: Raw directive syntax is preserved (e.g., ::document{id="doc-id"}), useful for clients that render custom UI components.

        markdown
        @enum {string}
      • messages: components["schemas"]["Message"][]

        Array of message objects

      • stream: boolean

        Enable or disable streaming responses

        true
        
    • ChatResponse: { applicationKey?: string; text?: string }

      JSON response when streaming is disabled

      • OptionalapplicationKey?: string

        The application key used for this conversation

      • Optionaltext?: string

        The agent's response text

    • Config: {
          capabilities?: components["schemas"]["Capabilities"];
          filter?: components["schemas"]["Filter"];
          instruction?: string;
          perspectives?: components["schemas"]["Perspectives"];
          userMessageContext?: { [key: string]: string };
      }

      Agent configuration. Controls behavior, capabilities, and document access.

      • Optionalcapabilities?: components["schemas"]["Capabilities"]
      • Optionalfilter?: components["schemas"]["Filter"]
      • Optionalinstruction?: string

        Custom instruction string to include in the system prompt

        You are a helpful content assistant.
        
      • Optionalperspectives?: components["schemas"]["Perspectives"]
      • OptionaluserMessageContext?: { [key: string]: string }

        Key-value pairs appended to each user message as XML tags. Each key becomes an XML tag with the value as content. Example: { "slack-channel": "#marketing" } renders as #marketing

        {
        * "slack-channel": "#marketing",
        * "user-role": "editor"
        * }
    • ErrorResponse: {
          details?: string;
          error: string;
          issues?: components["schemas"]["ValidationIssue"][];
      }
      • Optionaldetails?: string

        Human-readable error description

        Request body validation failed
        
      • error: string

        Error type

        Invalid request
        
      • Optionalissues?: components["schemas"]["ValidationIssue"][]

        Validation issues (when applicable)

    • FeatureOverrides: { webSearch?: boolean }

      Explicit feature overrides applied on top of capability-derived defaults. When not specified, features use values derived from read/write capability presets.

      • OptionalwebSearch?: boolean

        Override web search availability. By default, web search is enabled when read capability is 'standard'.

    • Filter: { read?: string; write?: string }

      GROQ filter expressions for document access control

      • Optionalread?: string

        GROQ boolean expression for document visibility. Documents matching this filter are visible to the agent.

        _type in ['post', 'author']
        
      • Optionalwrite?: string

        GROQ boolean expression for mutation permissions. Documents matching this filter can be mutated.

        _type == 'post'
        
    • Message: {
          content: string;
          id?: string;
          name?: string;
          role: "user" | "assistant" | "system";
      }
      • content: string

        The message content

      • Optionalid?: string

        Optional unique identifier for the message

      • Optionalname?: string

        Optional name for the message sender

      • role: "user" | "assistant" | "system"

        The role of the message sender

    • Perspectives: { read?: string[]; write?: string }

      Perspective locking configuration. Controls which document perspectives the agent can read from and write to. Values are Sanity perspective IDs: 'drafts', 'published', 'raw', or release/bundle IDs.

      • Optionalread?: string[]

        Allowed read perspectives. When set, query tools can only use these perspectives. If the agent tries to use a disallowed perspective, the request is rejected with an error.

        [
        "drafts",
        "published"
        ]
      • Optionalwrite?: string

        The write perspective. When set, new documents are created in this perspective and mutations are restricted to documents whose ID matches it.

        drafts
        
    • PromptRequest: {
          config?: components["schemas"]["Config"];
          format: "markdown" | "directives";
          instructions?: string;
          message: string;
          organizationId: string;
      }
      • Optionalconfig?: components["schemas"]["Config"]
      • format: "markdown" | "directives"

        Controls how directives in the response are formatted. - markdown (default): Directives are resolved server-side into standard markdown. - directives: Raw directive syntax is preserved for clients that render custom UI.

        markdown
        @enum {string}
      • Optionalinstructions?: string

        Custom instructions for the agent

        Be concise and use bullet points
        
      • message: string

        The prompt message

        Summarize my latest blog posts
        
      • organizationId: string

        Your Sanity organization ID

        abc123
        
    • ValidationIssue: { code?: string; message?: string; path?: string[] }
      • Optionalcode?: string

        Error code

        invalid_type
        
      • Optionalmessage?: string

        Error message

        Required
        
      • Optionalpath?: string[]

        Path to the invalid field

        [
        "messages"
        ]