> This page is for version v2024-12-23.
> 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.

# Upload File

This endpoint accepts file contents and registers them as a File in Extend, which can be used for [running workflows](/2024-12-23/developers/workflow-endpoints/run-workflow), [creating evaluation sets](/2024-12-23/developers/evaluation-set-endpoints/bulk-create-evaluation-set-item), [parsing](/2024-12-23/developers/parse-endpoints/parse-file), etc.

If an uploaded file is detected as a Word or PowerPoint document, it will be automatically converted to a PDF.

Supported file types can be found [here](/2024-12-23/developers/guides/supported-file-types).

This endpoint requires multipart form encoding. Most HTTP clients will handle this encoding automatically (see the examples).

### Headers

**`Content-Type`** `string`

A `multi-part/form-data` header containing the boundary, such as
`multi-part/form-data; boundary="..."`.

---

### Body

A `multipart/form-data` body containing a single `file` field and its binary data. For more information, see [the MDN documenation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST#multipart_form_submission).

The `Content-Type` field header is currently ignored and Extend will infer the type automatically based on the field's `Content-Disposition` and the file's contents.

### Response

**`success`** `boolean`

A true or false value for whether the file was processed successfully or not.

---

**`file`** `File`

A File object representing the newly created file. See the [File object](/2024-12-23/developers/objects/file) for more details.
**Note:** Since the file is not parsed, it will not contain `contents` nor `metadata`.

---

**`cURL`**

```bash cURL
curl --request POST \
  --url https://api-prod.extend.app/files/upload \
  --header 'Authorization: Bearer <token>' \
  --form 'file=@/path/to/document.pdf'
  
```

**`Python`**

```python Python
import requests

url = "https://api-prod.extend.app/files/upload"

headers = {"Authorization": "Bearer <token>"}

with open("document.pdf", "rb") as f:
    response = requests.post(
        url,
        files={"file": f},
        headers=headers
    )

print(response.text)
```

**`JavaScript`**

```javascript JavaScript
const formData = new FormData();
formData.append("file", file);

const options = {
    method: 'POST',
    headers: {'Authorization": 'Bearer <token>'},
    body: formData
};

fetch("https://api-prod.extend.app/files/upload", options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
```

**`PHP`**

```php PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api-prod.extend.app/files/upload",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => [
    "file" => new CURLFile("/path/to/document.pdf")
  ],
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

**`Go`**

```go Go
package main

import (
	"bytes"
	"fmt"
	"io"
	"io/ioutil"
	"mime/multipart"
	"net/http"
	"os"
)

func main() {
	file, _ := os.Open("document.pdf")
	defer file.Close()

	var requestBody bytes.Buffer
	writer := multipart.NewWriter(&requestBody)
	part, _ := writer.CreateFormFile("file", "document.pdf")
	io.Copy(part, file)
	writer.Close()

	url := "https://api-prod.extend.app/files/upload"
	req, _ := http.NewRequest("POST", url, &requestBody)

	req.Header.Set("Authorization", "Bearer <token>")
	req.Header.Set("Content-Type", writer.FormDataContentType())

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
}
```

**`Java`**

```java Java
HttpResponse<String> response = Unirest.post("https://api-prod.extend.app/files/upload")
    .header("Authorization", "Bearer <token>")
    .field("file", new File("document.pdf"))
    .asString();
```

**`Example File`**

```json Example File
{
  "object": "file",
  "id": "file_1234",
  "name": "example_file",
  "type": "PDF",
  "presignedUrl": "https://s3.example.com/file_1234.pdf",
  "parentFileId": "file_5678", // Optional, only set if this file is a derivative of another file
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-01T00:00:00Z"
}
```