> ## 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 project text

> Finds a word, phrase, ID or regular expression across the text of the whole environment and returns where each match is. Results are paged with limit and offset: pass the previous response's nextOffset as offset to get the next page.



## OpenAPI

````yaml /specs-prettified/realtime/openapi.stable.json post /v1/stable/environment/{environmentAlias}/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/environment/{environmentAlias}/search:
    post:
      tags:
        - Environment
      summary: Search project text
      description: "Finds a word, phrase, ID or regular expression across the text of
        the whole environment and returns where each match is. Results are paged
        with limit and offset: pass the previous response's nextOffset as offset
        to get the next page."
      operationId: StableEnvironmentController_searchText
      parameters:
        - name: environmentAlias
          required: true
          in: path
          schema:
            type: string
          x-vf-doc:
            description: The alias of the environment to search (e.g. `main`).
          description: The alias of the environment to search (e.g. `main`).
        - name: projectID
          required: true
          in: query
          schema:
            type: string
            description: The ID of the project to operate on.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StableEnvironmentSearchTextRequest"
      responses:
        "200":
          description: Returns one page of matches with the resource, field and line of
            each, the total match count, a count per resource type, whether more
            pages exist, and the kinds of text that are never searched.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StableEnvironmentSearchTextReadResponse"
          x-vf-doc:
            description: Returns one page of matches with the resource, field and line of
              each, the total match count, a count per resource type, whether
              more pages exist, and the kinds of text that are never searched.
      security:
        - token: []
components:
  schemas:
    StableEnvironmentSearchTextRequest:
      type: object
      properties:
        pattern:
          type: string
          minLength: 1
          maxLength: 256
          description: The word, phrase or ID to find. With regex, a JavaScript regular
            expression.
        regex:
          description: "Read pattern as a regular expression. Default false: literal text."
          type: boolean
        ignoreCase:
          description: Ignore case. Default true.
          type: boolean
        wholeWord:
          description: Match only where no letter, digit or underscore touches the match
            on either side. Default false.
          type: boolean
        resourceTypes:
          description: "Search only these kinds of resource. Default: all of them."
          minItems: 1
          type: array
          items:
            $ref: "#/components/schemas/StableSearchResourceType"
        limit:
          description: Hits per page. Default 50.
          type: integer
          minimum: 1
          maximum: 200
        offset:
          description: "Hits to skip: nextOffset from the previous page."
          type: integer
          minimum: 0
          maximum: 9007199254740991
      required:
        - pattern
      additionalProperties: false
    StableSearchResourceType:
      type: string
      enum:
        - agent
        - playbook
        - workflow
        - message
        - prompt
        - agent_tool
        - function
        - api_tool
        - integration_tool
        - mcp_tool
        - mcp_server
        - variable
        - entity
        - intent
        - event
        - test
        - evaluation
        - persona
        - attachment
        - folder
        - initialization_workflow
        - canvas
        - project
      x-enumNames:
        - AGENT
        - PLAYBOOK
        - WORKFLOW
        - MESSAGE
        - PROMPT
        - AGENT_TOOL
        - FUNCTION
        - API_TOOL
        - INTEGRATION_TOOL
        - MCP_TOOL
        - MCP_SERVER
        - VARIABLE
        - ENTITY
        - INTENT
        - EVENT
        - TEST
        - EVALUATION
        - PERSONA
        - ATTACHMENT
        - FOLDER
        - INITIALIZATION_WORKFLOW
        - CANVAS
        - PROJECT
    StableEnvironmentSearchTextReadResponse:
      type: object
      properties:
        hits:
          type: array
          items:
            $ref: "#/components/schemas/StableSearchTextHit"
        totalMatches:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Matches in everything searched, not only this page.
        byResourceType:
          type: object
          additionalProperties:
            type: integer
            minimum: -9007199254740991
            maximum: 9007199254740991
          description: Matching lines per resource type, in everything searched.
        hasMore:
          type: boolean
        nextOffset:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        incomplete:
          description: "Present when the search did not read everything: it stopped at its
            time limit, or a regular expression read only the first 1,000
            characters of a longer line. The counts cover only what it read."
          type: boolean
          enum:
            - true
          x-enumNames:
            - "TRUE"
        notSearched:
          type: array
          items:
            type: string
          description: What this search never reads.
      required:
        - hits
        - totalMatches
        - byResourceType
        - hasMore
        - notSearched
    StableSearchTextHit:
      type: object
      properties:
        resourceType:
          $ref: "#/components/schemas/StableSearchResourceType"
        resourceID:
          type: string
          description: "The ID to read the resource with. For a workflow, the workflow ID.
            A canvas no workflow owns carries its diagram ID and the
            Initialization Workflow its own ID; no workflow read takes either.
            When ownerID is set, the row lives inside that owner: read the
            owner."
        resourceName:
          type: string
        ownerID:
          description: "For a row inside another resource, such as a function path, a tool
            attachment or a test assertion: the owner to read it with."
          type: string
        blockID:
          description: "For a hit on a workflow canvas: the block."
          type: string
        stepID:
          description: "For a hit on a workflow canvas: the step or action."
          type: string
        stepKind:
          type: string
        field:
          type: string
          description: Where in the resource the text is, as a path such as instructions,
            data.name or variants[0].text.
        line:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: The 1-based line within that field.
        count:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Matches on that line.
        snippet:
          type: string
          description: The line around the first match, at most 120 characters.
        usedBy:
          description: "For a message or prompt: the steps and resources that hold its ID,
            at most 20. A holder inside another resource carries ownerID."
          type: array
          items:
            $ref: "#/components/schemas/StableSearchTextHolder"
      required:
        - resourceType
        - resourceID
        - field
        - line
        - count
        - snippet
    StableSearchTextHolder:
      type: object
      properties:
        resourceType:
          $ref: "#/components/schemas/StableSearchResourceType"
        resourceID:
          type: string
        resourceName:
          type: string
        ownerID:
          description: "For a row inside another resource, such as a tool attachment: the
            owner to read it with."
          type: string
        blockID:
          type: string
        stepID:
          type: string
      required:
        - resourceType
        - resourceID
  securitySchemes:
    token:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Voiceflow bearer token
````
