> This page is for version v2025-04-21.
> For other versions, use one of these documentation indexes:
> - v2026-02-09 (default): https://docs.extend.ai/2026-02-09/llms.txt
> - v2025-04-21: https://docs.extend.ai/2025-04-21/llms.txt
> - v2024-12-23: https://docs.extend.ai/2024-12-23/llms.txt

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.extend.ai/llms.txt
> Use this file to discover all available pages before exploring further.
>
> ## API version
> The current API version is `2026-02-09`, served at the site root (no version prefix in URLs).
> If this page URL contains `/2025-04-21/` or `/2024-12-23/`, you are reading an older API version.
> Prefer the current docs at https://docs.extend.ai/llms.txt unless the user explicitly needs that older version.
> Do not treat older-version pages as the source of truth for new integrations.

# List Files

GET https://api.extend.ai/files

List files in your account. Files represent documents that have been uploaded to Extend. This endpoint returns a paginated response. You can use the `nextPageToken` to fetch subsequent results.

Reference: https://docs.extend.ai/2025-04-21/developers/api-reference/file-endpoints/list-files

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `nameContains` (string, optional) — Filters files to only include those that contain the given string in the name. Example: `"invoice"`
- `sortDir` (enum, optional, default: desc) — Sorts the files in ascending or descending order. Ascending order means the earliest file is returned first.
  - Allowed values: `asc`, `desc`
- `nextPageToken` (string, optional) — The token used to fetch the page of results from a previous request. We use cursor based pagination and will return a `nextPageToken` in the response if there are more results. Note that if other parameters are changed in subsequent requests, you may receive inconsistent data. example: `"xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="`
- `maxPageSize` (integer, optional, default: 10) — The maximum number of results to return in the response. You may receive less than this number if there are fewer results than the maximum.

### Headers

- `x-extend-api-version` ("2025-04-21", optional, default: 2025-04-21) — API version to use for the request. If you do not specify a version, you will either receive a `400 Bad Request` or be set to a previous legacy version. See [API Versioning](https://docs.extend.ai/2025-04-21/developers/api-versioning) for more details.
- `x-extend-workspace-id` (string, optional) — The workspace ID to target. **Required** when using an organization-scoped API key; optional for workspace-scoped keys (the key is already tied to a workspace). See [Authentication](https://docs.extend.ai/2025-04-21/developers/authentication) for details on API key scopes.

## Response

### 200

Successfully retrieved files

- `success` (boolean, required)
- `files` (list of File, required)
- `nextPageToken` (string, optional) — The token used to fetch the page of results from a previous request. We use cursor based pagination and will return a `nextPageToken` in the response if there are more results. Note that if other parameters are changed in subsequent requests, you may receive inconsistent data. example: `"xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="`

## Errors

### 400 Bad Request Error

Bad Request

- `success` (boolean, optional)
- `error` (string, optional) — Error message

### 401 Unauthorized Error

Unauthorized

- `success` (boolean, optional)
- `error` (string, optional) — Error message

## Types

### File

- `object` (string, required) — The type of response. In this case, it will always be "file".
- `id` (string, required) — Extend's internal ID for the file. It will always start with `"file_"`. Example: `"file_xK9mLPqRtN3vS8wF5hB2cQ"`
- `name` (string, required) — The name of the file Example: `"Invoices.pdf"`
- `metadata` (FileMetadata, required)
- `createdAt` (string, required) — The time (in UTC) at which the file was created. Will follow the RFC 3339 format. Example: `"2024-03-21T15:30:00Z"`
- `updatedAt` (string, required) — The time (in UTC) at which the file was last updated. Will follow the RFC 3339 format. Example: `"2024-03-21T16:45:00Z"`
- `type` (enum, optional) — The type of the file
  - Allowed values: `PDF`, `CSV`, `IMG`, `TXT`, `DOCX`, `EXCEL`, `XML`, `HTML`
- `presignedUrl` (string, optional) — A presigned URL to download the file. Expires after 15 minutes.
- `parentFileId` (string, optional) — The ID of the parent file. Only included if this file is a derivative of another file, for instance if it was created via a Splitter in a workflow.
- `contents` (FileContents, optional)
- `usage` (FileCredits, optional) — These are usage credits for parsing the file. This field will not be returned for files processed before October 7, 2025, or for customers on legacy billing systems. For more details on how credits work, see our [Credits Guide](https://docs.extend.ai/general/how-credits-work).

### FileMetadata

- `pageCount` (double, optional) — The number of pages in the file. This is only set for PDF/DOCX files.
- `parentSplit` (FileMetadataParentSplit, optional) — The split metadata details. Only included if this file is a derivative of another file, for instance if it was created via a Splitter in a workflow.

### FileContents

- `rawText` (string, optional) — The raw text content of the file. This is included for all file types if the `rawText` query parameter is set to true in the endpoint request.
- `markdown` (string, optional) — Cleaned and structured markdown content of the entire file. Available for PDF and IMG file types. Only included if the `markdown` query parameter is set to true in the endpoint request.
- `pages` (list of FileContentsPagesItems, optional)
- `sheets` (list of FileContentsSheetsItems, optional)

### FileCredits

These are usage credits for parsing the file. This field will not be returned for files processed before October 7, 2025, or for customers on legacy billing systems. For more details on how credits work, see our [Credits Guide](https://docs.extend.ai/general/how-credits-work).

- `credits` (double, required) — The number of credits consumed specifically for parsing this file.

### FileMetadataParentSplit

The split metadata details. Only included if this file is a derivative of another file, for instance if it was created via a Splitter in a workflow.

- `id` (string, required) — The ID of the split.
- `type` (string, required) — The type of the split.
- `identifier` (string, required) — The identifier of the split.
- `startPage` (integer, required) — The start page of the split.
- `endPage` (integer, required) — The end page of the split.

### FileContentsPagesItems

- `pageNumber` (integer, required) — The page number of this page in the document.
- `pageHeight` (double, optional)
- `pageWidth` (double, optional)
- `rawText` (string, optional) — The raw text content extracted from this page.
- `markdown` (string, optional) — Cleaned and structured markdown content of this page.
- `html` (string, optional) — Cleaned and structured html content of the page. Available for DOCX file types (that were not auto-converted to PDFs). Only included if the `html` query parameter is set to true in the endpoint request.

### FileContentsSheetsItems

- `sheetName` (string, required) — The name of the sheet.
- `rawText` (string, optional) — The raw text content of the sheet.

## Examples

**Response**

```json
{
  "success": true,
  "files": [
    {
      "object": "file",
      "id": "file_xK9mLPqRtN3vS8wF5hB2cQ",
      "name": "Invoices.pdf",
      "metadata": {
        "pageCount": 30,
        "parentSplit": {
          "id": "string",
          "type": "Invoice",
          "identifier": "other_2_9",
          "startPage": 1,
          "endPage": 10
        }
      },
      "createdAt": "2024-03-21T15:30:00Z",
      "updatedAt": "2024-03-21T16:45:00Z",
      "type": "PDF",
      "presignedUrl": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
      "parentFileId": "file_Zk9mNP12Qw4yTv8BdR3H",
      "contents": {
        "rawText": "string",
        "markdown": "string",
        "pages": [
          {
            "pageNumber": 1,
            "pageHeight": 10,
            "pageWidth": 10,
            "rawText": "This is the raw text of the page.",
            "markdown": "# Heading\n\nThis is a paragraph with **bold** and *italic* text.\n\n- List item 1\n- List item 2\n\n> This is a blockquote",
            "html": "<div>This is the html of the page.</div>"
          }
        ],
        "sheets": [
          {
            "sheetName": "Sheet1",
            "rawText": "This is the raw text of the sheet."
          }
        ]
      },
      "usage": {
        "credits": 10
      }
    }
  ],
  "nextPageToken": "xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="
}
```