# Upload a file div strong 🔨 In Development — This section is still being developed and may change. Upload a file to an organization for use in vector stores, file search, or other AI features. Upload files in formats like PDF, TXT, DOCX, CSV, JSON, and more. Uploaded files can be attached to vector stores for semantic search or used directly in conversations. #### Path Parameters **`organization_id`** string required The unique identifier of the organization. #### Request Body (multipart/form-data) **`file`** file required The file to upload. Maximum file size: 100MB. **`purpose`** string optional · Defaults to `vector_store` Purpose of the file. Common values: `vector_store`, `user_upload`, `assistant`. ## Returns A [File object](/docs/api-reference/objects/file-object) representing the uploaded file. Request ```bash curl -X POST "https://api.freddy.aitronos.com/v1/organizations/org_abc123/files/upload" \ -H "X-API-Key: $FREDDY_API_KEY" \ -F "file=@document.pdf" \ -F "purpose=vector_store" ``` ```python from freddy import FreddyClient with FreddyClient(api_key="your-api-key") as client: file = client.files.upload( organization_id="org_abc123", file="document.pdf", purpose="vector_store" ) print(f"Uploaded: {file.name}") print(f"File ID: {file.id}") print(f"Size: {file.size} bytes") ``` ```python import requests with open("document.pdf", "rb") as f: response = requests.post( "https://api.freddy.aitronos.com/v1/organizations/org_abc123/files/upload", headers={"X-API-Key": api_key}, files={"file": f}, data={"purpose": "vector_store"} ) file_data = response.json() print(f"File ID: {file_data['id']}") ``` ## Response 200 OK ```json { "id": "file_abc123", "name": "document.pdf", "organizationId": "org_abc123", "size": 2457600, "mimeType": "application/pdf", "purpose": "vector_store", "status": "uploaded", "createdAt": "2025-01-20T15:30:00Z", "createdBy": "uid_user123" } ``` Errors **400 Bad Request** ```json { "error": { "message": "File size exceeds maximum limit of 100MB", "type": "validation_error", "code": "file_too_large" } } ``` **401 Unauthorized** ```json { "error": { "message": "Authentication required", "type": "authentication_error", "code": "missing_authentication" } } ``` **415 Unsupported Media Type** ```json { "error": { "message": "File type not supported", "type": "validation_error", "code": "unsupported_file_type" } } ``` ## Supported File Types - **Documents**: PDF, TXT, DOCX, DOC, RTF, MD - **Spreadsheets**: CSV, XLSX, XLS - **Data**: JSON, XML, YAML - **Code**: PY, JS, TS, JAVA, CPP, and more - **Images**: PNG, JPG, JPEG, WEBP (for vision models) ## Related Resources - [List Files](/docs/api-reference/files/list) - [Retrieve File](/docs/api-reference/files/retrieve) - [Delete File](/docs/api-reference/files/delete) - [File Object](/docs/api-reference/objects/file-object)