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

# Search for text content in files

> Searches for text content inside files using ripgrep. Returns matching lines with context.



## OpenAPI

````yaml https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /filesystem-content-search/{path}
openapi: 3.0.0
info:
  contact: {}
  description: API for manipulating filesystem, processes and network.
  title: Sandbox API
  version: 0.0.1
servers:
  - url: https://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run
    variables:
      sandbox_id:
        default: unknown
      workspace_id:
        default: unknown
      region:
        default: unknown
security:
  - BearerAuth: []
paths:
  /filesystem-content-search/{path}:
    get:
      tags:
        - filesystem
      summary: Search for text content in files
      description: >-
        Searches for text content inside files using ripgrep. Returns matching
        lines with context.
      parameters:
        - description: Directory path to search in
          in: path
          name: path
          required: true
          schema:
            type: string
        - description: Text to search for
          in: query
          name: query
          required: true
          schema:
            type: string
        - description: 'Case sensitive search (default: false)'
          in: query
          name: caseSensitive
          schema:
            type: boolean
        - description: 'Maximum number of results to return (default: 100)'
          in: query
          name: maxResults
          schema:
            type: integer
        - description: File pattern to include (e.g., *.go)
          in: query
          name: filePattern
          schema:
            type: string
        - description: >-
            Comma-separated directory names to skip (default:
            node_modules,vendor,.git,dist,build,target,__pycache__,.venv,.next,coverage)
          in: query
          name: excludeDirs
          schema:
            type: string
      responses:
        '200':
          description: Content search results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContentSearchResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ContentSearchResponse:
      properties:
        matches:
          items:
            $ref: '#/components/schemas/ContentSearchMatch'
          type: array
        query:
          example: searchText
          type: string
        total:
          example: 5
          type: integer
      required:
        - matches
        - query
        - total
      type: object
    ErrorResponse:
      properties:
        error:
          example: Error message
          type: string
      required:
        - error
      type: object
    ContentSearchMatch:
      properties:
        column:
          example: 10
          type: integer
        context:
          example: |-
            previous line
            current line
            next line
          type: string
        line:
          example: 42
          type: integer
        path:
          example: src/main.go
          type: string
        text:
          example: const searchText = 'example'
          type: string
      required:
        - column
        - line
        - path
        - text
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````