> ## Documentation Index
> Fetch the complete documentation index at: https://cognitio-agent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Read file

> Read the content of a specified file.



## OpenAPI

````yaml /openapi.json get /file/content
openapi: 3.1.1
info:
  title: cognitio
  description: cognitio api
  version: 1.0.0
servers: []
security: []
paths:
  /file/content:
    get:
      summary: Read file
      description: Read the content of a specified file.
      operationId: file.read
      parameters:
        - in: query
          name: directory
          schema:
            type: string
        - in: query
          name: workspace
          schema:
            type: string
        - in: query
          name: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: File content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileContent'
      x-codeSamples:
        - lang: js
          source: |-
            import { createCognitioClient } from "@cognitio/sdk

            const client = createCognitioClient()
            await client.file.read({
              ...
            })
components:
  schemas:
    FileContent:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
            - binary
        content:
          type: string
        diff:
          type: string
        patch:
          type: object
          properties:
            oldFileName:
              type: string
            newFileName:
              type: string
            oldHeader:
              type: string
            newHeader:
              type: string
            hunks:
              type: array
              items:
                type: object
                properties:
                  oldStart:
                    type: number
                  oldLines:
                    type: number
                  newStart:
                    type: number
                  newLines:
                    type: number
                  lines:
                    type: array
                    items:
                      type: string
                required:
                  - oldStart
                  - oldLines
                  - newStart
                  - newLines
                  - lines
            index:
              type: string
          required:
            - oldFileName
            - newFileName
            - hunks
        encoding:
          type: string
          const: base64
        mimeType:
          type: string
      required:
        - type
        - content

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.