---
title: "Read a file"
method: GET
path: "/files/{id}/text"
tags: ["Files"]
---

# Read a file

`GET /files/{id}/text`

## Request

- Base URL: `https://api.parley.so/v1`
- URL: `https://api.parley.so/v1/files/{id}/text`
- Auth: HTTP bearer

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.

## Path parameters

- `id` string, required: The file or folder ID.

## Query parameters

- `offset` integer: Where to start reading, in characters. Pass the previous nextOffset to continue.
- `limit` integer: Maximum number of characters to return, at about 4 characters per token.
- `toEnd` boolean: 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.

## Response `200`

OK

- object
  - `id` string, required: The file or folder ID.
  - `name` string, required: The file name.
  - `offset` integer, required: Where this window starts, in characters.
  - `nextOffset` integer, nullable, required: Pass as offset to read the next window, or null when this window reaches the end.
  - `totalLength` integer, required: The length of the whole text, in characters.
  - `text` string, required: The text in this window.

## Other responses

- `400`: The request was invalid. VALIDATION_FAILED, NOT_A_FILE.
- `401`: Missing or invalid credentials. UNAUTHORIZED.
- `403`: You don't have permission. FORBIDDEN.
- `404`: Not found. NOT_FOUND.
- `409`: The request conflicts with the current state. FILE_NOT_READY.
- `429`: Too many requests, or a usage limit was reached. TOO_MANY_REQUESTS.

---

[API](https://skmtc.dev/parley/apis/parley-api.md) - [All operations](https://skmtc.dev/parley/apis/parley-api/llms.txt) - [OpenAPI document](https://skmtc.dev/parley/apis/parley-api/revisions/6b78aeee07bc?raw)
