> 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.

# Get File

GET https://api.extend.ai/files/{id}

Fetch a file by its ID to obtain additional details and the raw file content.

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

## Authentication

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

## Request

### Path parameters

- `id` (string, required) — Extend's ID for the file. It will always start with `"file_"`. This ID is returned when creating a new File, or the value on the `fileId` field in a WorkflowRun. Example: `"file_Xj8mK2pL9nR4vT7qY5wZ"`

### Query parameters

- `rawText` (boolean, optional, default: false) — If set to true, the raw text content of the file will be included in the response. This is useful for indexing text-based files like PDFs, Word Documents, etc.
- `markdown` (boolean, optional, default: false) — If set to true, the markdown content of the file will be included in the response. This is useful for indexing very clean content into RAG pipelines for files like PDFs, Word Documents, etc. Only available for files with a type of PDF, IMG, or .doc/.docx files that were auto-converted to PDFs.
- `html` (boolean, optional, default: false) — If set to true, the html content of the file will be included in the response. This is useful for indexing html content into RAG pipelines. Only available for files with a type of DOCX.

### 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 file

- `success` (boolean, required)
- `file` (File, required)

## Errors

### 401 Unauthorized Error

Unauthorized

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

### 404 Not Found Error

Not Found

- `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,
  "file": {
    "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
    }
  }
}
```