# Upload file to store Upload a file directly to a knowledge store for processing and embedding. Uploads a file to the specified store using multipart form data. Files up to ~31 MB can be uploaded directly. For larger files, use the [chunked upload flow](/docs/api-reference/knowledge/upload-url). The file is validated, stored, and automatically queued for processing (chunking and embedding). #### Path Parameters **`organization_id`** string required The unique identifier of the organization (format: `org_*`). **`store_id`** string required The unique identifier of the vector store. #### Request Body (multipart/form-data) **`file`** file required The file to upload. See [File config](/docs/api-reference/knowledge/file-config) for supported types and size limits. **`relative_path`** string optional A relative path within the store, useful for preserving folder structure in bulk uploads. ## Returns The uploaded file object with processing status set to `pending` (HTTP 201). Request ```bash cURL curl -X POST "https://api.aitronos.com/v1/organizations/org_xyz789/stores/vs_abc123/files/upload" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -F "file=@document.pdf" \ -F "relative_path=reports/2025" ``` ```python Python SDK from aitronos import Aitronos client = Aitronos(api_key="your-api-key") result = client.knowledge.upload_file( organization_id="org_xyz789", store_id="vs_abc123", file=open("document.pdf", "rb"), relative_path="reports/2025", ) print(result) ``` ```python Python import requests org_id = "org_xyz789" store_id = "vs_abc123" url = f"https://api.aitronos.com/v1/organizations/{org_id}/stores/{store_id}/files/upload" headers = { "Authorization": "Bearer YOUR_ACCESS_TOKEN", } with open("document.pdf", "rb") as f: files = {"file": ("document.pdf", f, "application/pdf")} data = {"relative_path": "reports/2025"} response = requests.post(url, headers=headers, files=files, data=data) print(response.json()) ``` ```javascript JavaScript const orgId = "org_xyz789"; const storeId = "vs_abc123"; const formData = new FormData(); formData.append("file", fileInput.files[0]); formData.append("relative_path", "reports/2025"); const response = await fetch( `https://api.aitronos.com/v1/organizations/${orgId}/stores/${storeId}/files/upload`, { method: "POST", headers: { Authorization: `Bearer ${accessToken}`, }, body: formData, } ); const data = await response.json(); console.log(data); ``` Response ```json 201 Created { "file_id": "file_abc123def456", "name": "document.pdf", "size": 1048576, "mime_type": "application/pdf", "relative_path": "reports/2025", "status": "pending", "created_at": "2025-06-15T10:00:00Z" } ``` ```json 404 Error { "success": false, "error": { "code": "VECTOR_STORE_NOT_FOUND", "message": "We couldn't find the requested resource.", "system_message": "Vector store not found", "type": "client_error", "status": 404, "details": { "store_id": "vs_abc123", "organization_id": "org_xyz789" }, "trace_id": "abc-123-def", "timestamp": "2025-06-15T10:00:00Z" } } ``` ## Related Resources - [Get Upload URL](/docs/api-reference/knowledge/upload-url) - [Register Upload](/docs/api-reference/knowledge/register-upload) - [List Files](/docs/api-reference/knowledge/list-files) - [Get File](/docs/api-reference/knowledge/get-file) - [Delete File](/docs/api-reference/knowledge/delete-file) - [Bulk Remove Files](/docs/api-reference/knowledge/bulk-remove) - [Processing Status](/docs/api-reference/knowledge/processing-status) - [Processing Logs](/docs/api-reference/knowledge/processing-logs) - [Retry Processing](/docs/api-reference/knowledge/retry-processing) - [File Config](/docs/api-reference/knowledge/file-config) - [Storage Usage](/docs/api-reference/knowledge/storage-usage)