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

# Read a file

> Read the text Parley extracted from a file, one window at a time. Scanned pages are OCRed, and paged documents mark each page with <document-page number="N" />. When nextOffset is not null there is more text: pass it back as offset to keep reading. Returns 409 FILE_NOT_READY until the text has been extracted, or if it could not be extracted.



## OpenAPI

````yaml https://api.parley.so/openapi.json get /files/{id}/text
openapi: 3.1.1
info:
  title: Parley API
  version: 1.0.0
  description: >-
    Manage Parley's projects (matters or cases), accounts (client
    organizations), contacts (people), tasks, custom fields, notes, files,
    activity, automations, and skills. Records refer to each other as { type,
    id, name } references; writes take IDs. Errors are { error: { code, message,
    details } }, where code names what went wrong and each operation lists the
    codes it can return. In a query string, write a timestamp's offset as Z or
    %2B, because a raw + arrives as a space. The MCP server at /mcp offers the
    same data as a smaller set of tools.
servers:
  - url: https://api.parley.so/v1
security:
  - bearerAuth: []
tags:
  - name: Projects
    description: >-
      A project is a matter or case: it groups the files, notes, activity, and
      tasks for one engagement, and links to the accounts and contacts it
      involves.
  - name: Accounts
    description: >-
      An account is a client organization. Contacts belong to it, and projects
      link to it.
  - name: Contacts
    description: >-
      A contact is a person, optionally belonging to one account and linked to
      projects.
  - name: Tasks
    description: >-
      A task is a to-do with a status, assignee, and due date, optionally about
      one project, account, or contact.
  - name: Fields
    description: >-
      Custom fields defined for projects, accounts, contacts, or tasks. Records
      carry their values in fields, keyed by field name.
  - name: Notes
    description: >-
      Markdown notes on a project, account, or contact. Updates take the version
      you last read, so concurrent edits fail with 409 VERSION_CONFLICT instead
      of overwriting.
  - name: Files
    description: >-
      Files and folders of a project, account, contact, or intake, or the
      organization's Library. Add a file by creating an upload, PUTting its
      bytes, and adding the upload to a location.
  - name: Activity
    description: >-
      What happened across the organization or on one record: changes, links,
      notes, files, USCIS case updates, and synced emails and meetings. Each
      item's kind says which details it carries.
  - name: Sessions
    description: >-
      Conversations with Parley's assistant, from the web app, Word, Outlook,
      automation runs, and the API. Start one with a message, follow up or steer
      it while it works, and read its replies.
  - name: Automations
    description: >-
      Instructions Parley's assistant carries out on a schedule, as the person
      who created them, with nobody present.
  - name: Skills
    description: >-
      Reusable playbooks for Parley's assistant: a SKILL.md plus optional
      bundled documents, addressed by slug.
  - name: Users
    description: The people in your organization, and the caller.
paths:
  /files/{id}/text:
    get:
      tags:
        - Files
      summary: Read a file
      description: >-
        Read the text Parley extracted from a file, one window at a time.
        Scanned pages are OCRed, and paged documents mark each page with
        <document-page number="N" />. When nextOffset is not null there is more
        text: pass it back as offset to keep reading. Returns 409 FILE_NOT_READY
        until the text has been extracted, or if it could not be extracted.
      operationId: readFile
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            minLength: 1
            description: The file or folder ID.
        - name: offset
          in: query
          schema:
            type: integer
            minimum: 0
            maximum: 9007199254740991
            default: 0
            description: >-
              Where to start reading, in characters. Pass the previous
              nextOffset to continue.
          allowEmptyValue: true
          allowReserved: true
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1000
            maximum: 100000
            default: 60000
            description: >-
              Maximum number of characters to return, at about 4 characters per
              token.
          allowEmptyValue: true
          allowReserved: true
        - name: toEnd
          in: query
          schema:
            type: boolean
            default: false
            description: >-
              Return everything from offset to the end in one response, ignoring
              limit. A long file's text can run to millions of characters, far
              more than fits in a model's context, so leave this false unless
              the result is written to a file rather than read.
          allowEmptyValue: true
          allowReserved: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                    description: The file or folder ID.
                  name:
                    type: string
                    description: The file name.
                  offset:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: Where this window starts, in characters.
                  nextOffset:
                    anyOf:
                      - type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                      - type: 'null'
                    description: >-
                      Pass as offset to read the next window, or null when this
                      window reaches the end.
                  totalLength:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: The length of the whole text, in characters.
                  text:
                    type: string
                    description: The text in this window.
                required:
                  - id
                  - name
                  - offset
                  - nextOffset
                  - totalLength
                  - text
        '400':
          description: The request was invalid. VALIDATION_FAILED, NOT_A_FILE.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ValidationFailedError'
                  - $ref: '#/components/schemas/NotAFileError'
        '401':
          description: Missing or invalid credentials. UNAUTHORIZED.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '403':
          description: You don't have permission. FORBIDDEN.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: Not found. NOT_FOUND.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
        '409':
          description: The request conflicts with the current state. FILE_NOT_READY.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileNotReadyError'
        '429':
          description: Too many requests, or a usage limit was reached. TOO_MANY_REQUESTS.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsError'
components:
  schemas:
    ValidationFailedError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              const: VALIDATION_FAILED
            message:
              type: string
              examples:
                - The request is invalid.
            details:
              type: object
              properties:
                issues:
                  type: array
                  items:
                    type: object
                    properties:
                      path:
                        type: string
                        description: >-
                          Where the problem is, as a dotted path into the input
                          such as accountIds.add.0 or reminder.remindAt. Empty
                          for the input as a whole.
                      message:
                        type: string
                        description: What is wrong with the value.
                    required:
                      - path
                      - message
                  description: Each problem with the input.
              required:
                - issues
          required:
            - code
            - message
            - details
      required:
        - error
    NotAFileError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              const: NOT_A_FILE
            message:
              type: string
              examples:
                - This is a folder, not a file.
          required:
            - code
            - message
      required:
        - error
    UnauthorizedError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              const: UNAUTHORIZED
            message:
              type: string
              examples:
                - Missing or invalid credentials.
          required:
            - code
            - message
      required:
        - error
    ForbiddenError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              const: FORBIDDEN
            message:
              type: string
              examples:
                - You don't have permission to do this.
          required:
            - code
            - message
      required:
        - error
    NotFoundError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              const: NOT_FOUND
            message:
              type: string
              examples:
                - Not found.
          required:
            - code
            - message
      required:
        - error
    FileNotReadyError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              const: FILE_NOT_READY
            message:
              type: string
              examples:
                - The file isn't ready.
            details:
              type: object
              properties:
                status:
                  enum:
                    - pending
                    - processing
                    - failed
                  type: string
                  description: Where Parley is in processing the file.
              required:
                - status
          required:
            - code
            - message
            - details
      required:
        - error
    TooManyRequestsError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              const: TOO_MANY_REQUESTS
            message:
              type: string
              examples:
                - Too many requests.
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A Parley API key.

````

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