> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search gateway policies by subject value set

> Batch variant of GET /v1/platform/gateway-policies for
fetching policies that match a set of subject_matcher_values
under one subject_matcher_key. Accepts the values in a JSON
body so callers can include hundreds of subject ids without
bumping into per-server URL-length limits.

Visibility, response shape, and matcher semantics are
identical to the GET list. With `subject_matcher_values`
empty (or omitted) this returns the same result as GET
with only `policy_type` set.



## OpenAPI

````yaml /langsmith/langsmith-platform-openapi.json post /v1/platform/gateway-policies/search
openapi: 3.1.0
info:
  title: LangSmith
  description: >+
    The LangSmith API is used to programmatically create and manage LangSmith
    resources.


    ## Host

    https://api.smith.langchain.com


    ## Authentication

    To authenticate with the LangSmith API, set the `X-Api-Key` header

    to a valid [LangSmith API
    key](https://docs.langchain.com/langsmith/create-account-api-key#create-an-api-key).

  version: 0.1.0
servers:
  - url: /
security: []
tags:
  - name: run
    x-group: Tracing
  - name: runs
    x-group: Tracing
  - name: sessions
    x-group: Tracing
  - name: tracer-sessions
    x-group: Tracing
  - name: datasets
    x-group: Datasets
  - name: examples
    x-group: Datasets
  - name: evaluators
    x-group: Evaluation
  - name: experiment-view-overrides
    x-group: Evaluation
  - name: experiments
    x-group: Evaluation
  - name: annotation-queues
    x-group: Feedback & Annotation
  - name: annotation_queues
    x-group: Feedback & Annotation
  - name: feedback
    x-group: Feedback & Annotation
  - name: feedback-configs
    x-group: Feedback & Annotation
  - name: alert_rules
    x-group: Monitoring
  - name: bulk-exports
    x-group: Monitoring
  - name: charts
    x-group: Monitoring
  - name: commits
    x-group: Prompts & Playground
  - name: directories
    x-group: Prompts & Playground
  - name: hub_environments
    x-group: Prompts & Playground
  - name: playground-settings
    x-group: Prompts & Playground
  - name: prompt-webhooks
    x-group: Prompts & Playground
  - name: prompts
    x-group: Prompts & Playground
  - name: tag-transitions
    x-group: Prompts & Playground
  - name: comments
    x-group: Prompt Hub
  - name: likes
    x-group: Prompt Hub
  - name: optimization-jobs
    x-group: Prompt Hub
  - name: ownerships
    x-group: Prompt Hub
  - name: repos
    x-group: Prompt Hub
  - name: settings
    x-group: Prompt Hub
  - name: tags
    x-group: Prompt Hub
  - name: integrations
    x-group: Integrations & Tools
  - name: mcp
    x-group: Integrations & Tools
  - name: mcp_vendors
    x-group: Integrations & Tools
  - name: oauth
    x-group: Integrations & Tools
  - name: tools
    x-group: Integrations & Tools
  - name: gateway-policies
    x-group: LLM Gateway
  - name: sandboxes
    x-group: Sandboxes
  - name: issues
    x-group: Issues
  - name: issues-agent
    x-group: Issues
  - name: Organizations
    x-group: Administration
  - name: SCIM Tokens
    x-group: Administration
  - name: TTL Settings
    x-group: Administration
  - name: access_policies
    x-group: Administration
  - name: api-key
    x-group: Administration
  - name: audit-logs
    x-group: Administration
  - name: auth
    x-group: Administration
  - name: aws_marketplace
    x-group: Administration
  - name: data_planes
    x-group: Administration
  - name: me
    x-group: Administration
  - name: orgs
    x-group: Administration
  - name: service-accounts
    x-group: Administration
  - name: tenant
    x-group: Administration
  - name: ttl-settings
    x-group: Administration
  - name: usage-limits
    x-group: Administration
  - name: workspaces
    x-group: Administration
  - name: ace
    x-group: System
  - name: backfills
    x-group: System
  - name: features
    x-group: System
  - name: info
    x-group: System
  - name: model-price-map
    x-group: System
  - name: public
    x-group: System
  - name: threads
    x-group: System
  - name: fleet orgs
  - name: fleet secrets
  - name: fleet tenants
  - name: fleet users
paths:
  /v1/platform/gateway-policies/search:
    post:
      tags:
        - gateway-policies
      summary: Search gateway policies by subject value set
      description: |-
        Batch variant of GET /v1/platform/gateway-policies for
        fetching policies that match a set of subject_matcher_values
        under one subject_matcher_key. Accepts the values in a JSON
        body so callers can include hundreds of subject ids without
        bumping into per-server URL-length limits.

        Visibility, response shape, and matcher semantics are
        identical to the GET list. With `subject_matcher_values`
        empty (or omitted) this returns the same result as GET
        with only `policy_type` set.
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/gateway_policies.SearchGatewayPoliciesRequest
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/gateway_policies.GatewayPolicyRecord'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/gateway_policies.errorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/gateway_policies.errorResponse'
        '403':
          description: LLM Gateway not enabled, or caller lacks OrganizationRead
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/gateway_policies.errorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/gateway_policies.errorResponse'
      security:
        - API Key: []
        - Bearer Auth: []
components:
  schemas:
    gateway_policies.SearchGatewayPoliciesRequest:
      type: object
      properties:
        policy_type:
          type: string
        subject_matcher_key:
          type: string
        subject_matcher_values:
          items:
            type: string
          type: array
    gateway_policies.GatewayPolicyRecord:
      type: object
      properties:
        action:
          type: string
        config:
          type: object
        created_at:
          type: string
        created_by:
          type: string
        current_spend_usd:
          description: |-
            CurrentSpendUSD is the spend in the policy's current window. Set for
            any spend_cap policy regardless of enabled state — disabled policies
            still surface usage so users can see what would have been counted.
            Nil for non-spend_cap policies or when the spend lookup failed.
          type: number
        description:
          type: string
        enabled:
          type: boolean
        id:
          type: string
        is_system_generated:
          type: boolean
        name:
          type: string
        organization_id:
          type: string
        parent_policy_id:
          description: >-
            ParentPolicyID is set on materialized children of a
            default_spend_cap

            to the default's id, and cleared (NULL) only when an admin Create

            with the same matchers takes over the materialized row. Update on a

            child preserves the link; Delete on the parent cascade-soft-deletes

            every child rather than detaching them.
          type: string
        policy_type:
          type: string
        priority:
          type: integer
        subject_matchers:
          type: array
          items:
            $ref: '#/components/schemas/gateway_policies.SubjectMatcher'
        updated_at:
          type: string
    gateway_policies.errorResponse:
      type: object
      properties:
        error:
          type: string
    gateway_policies.SubjectMatcher:
      type: object
      properties:
        key:
          type: string
        value:
          type: string
  securitySchemes:
    API Key:
      type: apiKey
      in: header
      name: X-API-Key
    Bearer Auth:
      type: http
      description: >-
        Bearer tokens are used to authenticate from the UI. Must also specify
        x-tenant-id or x-organization-id (for org scoped apis).
      scheme: bearer

````