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

# Search agent instructions

> Searches the main agent's routing instructions line by line with a JavaScript regular expression and returns one page of matching lines with surrounding context, up to `limit`; the match totals count the whole document.



## OpenAPI

````yaml /specs-prettified/realtime/openapi.stable.json post /v1/stable/agent/instructions/search
openapi: 3.0.0
info:
  title: Realtime
  description: Realtime gateway API service
  version: 1.0.0
  contact: {}
servers:
  - url: https://realtime-api.voiceflow.com
security: []
tags: []
paths:
  /v1/stable/agent/instructions/search:
    post:
      tags:
        - Agent
      summary: Search agent instructions
      description: Searches the main agent's routing instructions line by line with a
        JavaScript regular expression and returns one page of matching lines
        with surrounding context, up to `limit`; the match totals count the
        whole document.
      operationId: StableAgentController_searchInstructions
      parameters:
        - name: projectID
          required: true
          in: query
          schema:
            type: string
            description: The ID of the project to operate on.
        - name: environmentAlias
          required: true
          in: query
          schema:
            type: string
            description: The alias of the environment to operate on (e.g. `main`).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StableInstructionsSearchRequest"
      responses:
        "200":
          description: Returns the matching lines of the main agent's instructions, each
            with its line number, hit count and context lines, plus the total
            matches and matching lines across the whole document and whether the
            limit cut the list short.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StableInstructionsSearchResponse"
          x-vf-doc:
            description: Returns the matching lines of the main agent's instructions, each
              with its line number, hit count and context lines, plus the total
              matches and matching lines across the whole document and whether
              the limit cut the list short.
      security:
        - token: []
components:
  schemas:
    StableInstructionsSearchRequest:
      type: object
      properties:
        pattern:
          type: string
          minLength: 1
          maxLength: 256
          description: A JavaScript regular expression, evaluated against each line on its
            own.
        ignoreCase:
          default: false
          description: Match case-insensitively. Defaults to false, like grep.
          type: boolean
        contextLines:
          default: 0
          description: How many lines either side of each match to return.
          type: integer
          minimum: 0
          maximum: 5
        limit:
          default: 50
          description: The maximum number of matching LINES to return. The reported totals
            cover the whole document.
          type: integer
          minimum: 1
          maximum: 200
      required:
        - pattern
      additionalProperties: false
    StableInstructionsSearchResponse:
      type: object
      properties:
        matches:
          type: array
          items:
            $ref: "#/components/schemas/StableInstructionsSearchMatch"
        totalMatches:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Total occurrences across the whole document, not just this page.
        matchingLines:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Total lines with at least one occurrence, across the whole document.
        hasMore:
          type: boolean
          description: Whether matching lines were left out because of the limit.
      required:
        - matches
        - totalMatches
        - matchingLines
        - hasMore
    StableInstructionsSearchMatch:
      type: object
      properties:
        line:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: The 1-based line number of the match.
        count:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: How many times the pattern matched on this line.
        before:
          type: array
          items:
            type: string
          description: The requested lines of context above this one.
        text:
          type: string
          description: The matching line.
        after:
          type: array
          items:
            type: string
          description: The requested lines of context below this one.
      required:
        - line
        - count
        - before
        - text
        - after
  securitySchemes:
    token:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Voiceflow bearer token
````
