# pip install --upgrade pinecone
import os
from pinecone import Pinecone
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
file = pc.assistants.upload_file(
assistant_name="example-assistant",
file_path="/Users/jdoe/Downloads/example_file.txt",
metadata={"published": "2024-01-01", "document_type": "manuscript"},
)
print(file.id, file.status)
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone';
// Reads PINECONE_API_KEY from the environment
const pc = new Pinecone();
const assistant = pc.assistant({ name: 'example-assistant' });
const operation = await assistant.uploadFile({
path: '/Users/jdoe/Downloads/example_file.txt',
metadata: { published: '2024-01-01', document_type: 'manuscript' },
});
console.log(operation);
PINECONE_API_KEY="YOUR_API_KEY"
ASSISTANT_NAME="example-assistant"
LOCAL_FILE_PATH="/Users/jdoe/Downloads/example_file.txt"
curl -X POST "https://prod-1-data.ke.pinecone.io/assistant/files/$ASSISTANT_NAME" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2026-07" \
-F "file=@$LOCAL_FILE_PATH" \
-F 'metadata={"published": "2024-01-01", "document_type": "manuscript"}'
{
"id": "op-1234-abcd-5678",
"operation_type": "upload_file",
"status": "Processing",
"created_on": "2025-10-01T12:30:00.000Z",
"file_id": "my-file-id-123",
"completed_on": "2025-10-01T12:35:00.000Z",
"percent_complete": 42,
"error_message": "File processing failed: unsupported file format.",
"ingestion_units": 50
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Uploaded file can only currently be either a pdf or txt file"
},
"status": 400
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Invalid API key."
},
"status": 401
}{
"error": {
"code": "NOT_FOUND",
"message": "Assistant \"example-assistant\" not found."
},
"status": 404
}{
"error": {
"code": "UNKNOWN",
"message": "Internal server error"
},
"status": 500
}Upload a file
Upload a file to the specified assistant.
An identifier will be generated. To specify a file identifier or to replace file content, use the upsert endpoint (PUT /files/{assistant_name}/{assistant_file_id}).
This operation is asynchronous. The response includes an operation ID that can be used to poll for completion via the describe operation endpoint.
For guidance and examples, see Manage files.
# pip install --upgrade pinecone
import os
from pinecone import Pinecone
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
file = pc.assistants.upload_file(
assistant_name="example-assistant",
file_path="/Users/jdoe/Downloads/example_file.txt",
metadata={"published": "2024-01-01", "document_type": "manuscript"},
)
print(file.id, file.status)
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone';
// Reads PINECONE_API_KEY from the environment
const pc = new Pinecone();
const assistant = pc.assistant({ name: 'example-assistant' });
const operation = await assistant.uploadFile({
path: '/Users/jdoe/Downloads/example_file.txt',
metadata: { published: '2024-01-01', document_type: 'manuscript' },
});
console.log(operation);
PINECONE_API_KEY="YOUR_API_KEY"
ASSISTANT_NAME="example-assistant"
LOCAL_FILE_PATH="/Users/jdoe/Downloads/example_file.txt"
curl -X POST "https://prod-1-data.ke.pinecone.io/assistant/files/$ASSISTANT_NAME" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2026-07" \
-F "file=@$LOCAL_FILE_PATH" \
-F 'metadata={"published": "2024-01-01", "document_type": "manuscript"}'
{
"id": "op-1234-abcd-5678",
"operation_type": "upload_file",
"status": "Processing",
"created_on": "2025-10-01T12:30:00.000Z",
"file_id": "my-file-id-123",
"completed_on": "2025-10-01T12:35:00.000Z",
"percent_complete": 42,
"error_message": "File processing failed: unsupported file format.",
"ingestion_units": 50
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Uploaded file can only currently be either a pdf or txt file"
},
"status": 400
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Invalid API key."
},
"status": 401
}{
"error": {
"code": "NOT_FOUND",
"message": "Assistant \"example-assistant\" not found."
},
"status": 404
}{
"error": {
"code": "UNKNOWN",
"message": "Internal server error"
},
"status": 500
}# pip install --upgrade pinecone
import os
from pinecone import Pinecone
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
file = pc.assistants.upload_file(
assistant_name="example-assistant",
file_path="/Users/jdoe/Downloads/example_file.txt",
metadata={"published": "2024-01-01", "document_type": "manuscript"},
)
print(file.id, file.status)
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone';
// Reads PINECONE_API_KEY from the environment
const pc = new Pinecone();
const assistant = pc.assistant({ name: 'example-assistant' });
const operation = await assistant.uploadFile({
path: '/Users/jdoe/Downloads/example_file.txt',
metadata: { published: '2024-01-01', document_type: 'manuscript' },
});
console.log(operation);
PINECONE_API_KEY="YOUR_API_KEY"
ASSISTANT_NAME="example-assistant"
LOCAL_FILE_PATH="/Users/jdoe/Downloads/example_file.txt"
curl -X POST "https://prod-1-data.ke.pinecone.io/assistant/files/$ASSISTANT_NAME" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2026-07" \
-F "file=@$LOCAL_FILE_PATH" \
-F 'metadata={"published": "2024-01-01", "document_type": "manuscript"}'
Query Parameters
Body
The desired file to be uploaded and processed into the assistant.
Optional metadata associated with the file. This metadata can be used to filter files when listing them or to restrict search results when querying the assistant. Maximum size is 16KB.
{
"created_by": "Jane Doe",
"published": "2025-10-01T00:00:00.000Z",
"tags": ["report", "Q4", "analytics"]
}
Response
File upload accepted. Processing has started.
Describes the status of an ongoing or completed server operation.
Was this page helpful?