# Upsert a file

This operation is asynchronous. The file processing will occur in the background.

For guidance and examples, see [Manage files](/guides/upload-your-data-manage-files#upload-a-local-file).

```bash curl theme={null}
PINECONE_API_KEY="YOUR_API_KEY"
ASSISTANT_NAME="example-assistant"
FILE_ID="my-custom-file-id"
LOCAL_FILE_PATH="/Users/jdoe/Downloads/example_file.txt"

curl -X PUT "https://prod-1-data.ke.pinecone.io/assistant/files/$ASSISTANT_NAME/$FILE_ID" \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H "X-Pinecone-Api-Version: 2026-04" \
  -F "file=@$LOCAL_FILE_PATH"
```

```json curl theme={null}
{
  "id": "op-1234-abcd-5678",
  "operation_type": "upsert_file",
  "file_id": "my-custom-file-id",
  "status": "Processing",
  "created_on": "2025-10-01T12:30:00Z",
  "percent_complete": 0
}
```

:::callout{intent="note"}
This example shows a `Processing` operation. The `error_message` field is present only when the operation status is `Failed`.
:::

`PUT /files/{assistant_name}/{assistant_file_id}`

:::code-group
```bash title="cURL"
curl --request PUT \
  --url https://{assistant_host}/files/{assistant_name}/{assistant_file_id} \
  --header 'Authorization: Bearer <token>'
```

```json title="202"
{
  "id": "op-1234-abcd-5678",
  "operation_type": "upload_file",
  "file_id": "my-file-id-123",
  "status": "Processing",
  "created_on": "2025-10-01T12:30:00.000Z",
  "completed_on": "2025-10-01T12:35:00.000Z",
  "percent_complete": 42,
  "error_message": "File processing failed: unsupported file format.",
  "ingestion_units": 50
}
```
:::

## Authorizations

- `Authorization` (header, string, required) — Bearer authentication header of the form `Bearer <token>`.

## Path Parameters

- `assistant_name` (path, string, required) — The name of the assistant to upload files to.
- `assistant_file_id` (path, string, required) — The identifier of the file to be created or replaced. Must be 1-128 characters long and consist only of alphanumeric characters, hyphens (-), or underscores (\_).

## Query Parameters

- `multimodal` (query, string) — Optional flag to opt in to multimodal file processing (PDFs only). Can be either `true` or `false`. Default is `false`.

## Headers

- `X-Pinecone-Api-Version` (header, string, required) — Required date-based version header

## Response

- `202` — File upload has been accepted for processing. The file will be created if it doesn't exist, or replaced if it already exists. The operation will complete asynchronously.
- `400` — Bad request. The request body included invalid request parameters.
- `401` — Unauthorized. Possible causes: Invalid API key.
- `404` — Assistant not found.
- `500` — Internal server error.

## Related pages

- [Account management](./account-management-index.md)
- [Admin](./admin-2-index.md)
- [Admin](./admin-index.md)
- [APIs](./apis-index.md)
- [Architecture](./architecture-index.md)
- [Assistants](./assistants-index.md)
- [Bring Your Own Cloud](./bring-your-own-cloud-index.md)
- [Build an assistant](./build-an-assistant-index.md)
- [Build an integration](./build-an-integration-index.md)
- [Changelog](./changelog-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
