Skip to content
Last updated

Upload files directly to vector stores using base64-encoded content in a single API call.

POSThttps://api.aitronos.com/v1/organizations/{organization_id}/vector-stores/{vector_store_id}/files/upload-base64

Upload files directly to a vector store using base64-encoded content. This method allows you to upload files without first uploading them to the file storage system.

Path Parameters

organization_id string required

The unique identifier of the organization (format: org_*).

vector_store_id string required

The unique identifier of the vector store (format: vs_*).

Request Body

files array required

Array of file objects to upload (max 10 files per request).

files[].filename string required

Original filename with extension.

files[].content string required

Base64-encoded file content (without data URL prefix).

files[].mime_type string required

MIME type of the file.

Supported File Types

TypeMIME TypeMax Size
PDFapplication/pdf50 MB
Texttext/plain10 MB
Markdowntext/markdown10 MB
CSVtext/csv10 MB
JSONapplication/json10 MB
Wordapplication/vnd.openxmlformats-officedocument.wordprocessingml.document50 MB
PowerPointapplication/vnd.openxmlformats-officedocument.presentationml.presentation50 MB
Excelapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet50 MB

Returns

A success response with uploaded file details including processing status.

Bash
# Read file and encode to base64
FILE_CONTENT=$(base64 -i document.pdf)

curl -X POST "https://api.aitronos.com/v1/organizations/org_abc123/vector-stores/vs_xyz789/files/upload-base64" \
  -H "X-API-Key: $FREDDY_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"files\": [
      {
        \"filename\": \"document.pdf\",
        \"content\": \"$FILE_CONTENT\",
        \"mime_type\": \"application/pdf\"
      }
    ]
  }"

Response:

{
  "success": true,
  "message": "1 file(s) uploaded successfully",
  "files": [
    {
      "id": "vsf_abc123def456",
      "file_id": "file_xyz789ghi012",
      "filename": "document.pdf",
      "size": 28042,
      "mime_type": "application/pdf",
      "processing_status": "pending",
      "created_at": "2025-01-14T10:12:01.850Z"
    }
  ]
}

Processing Status

After upload, files are queued for processing:

  1. pending - File uploaded, waiting in queue
  2. processing - File being chunked and embedded
  3. completed - File ready for search (typically 2-5 seconds)
  4. failed - Processing error occurred

Check processing status:

GET /v1/organizations/{org_id}/vector-stores/{vector_store_id}/files/{file_id}/status

Using Uploaded Files

Method 1: Direct Vector Store Attachment

Attach vector stores directly to chat requests:

{
  "inputs": [
    {
      "role": "user",
      "content": "What is in the uploaded document?"
    }
  ],
  "vector_store_ids": ["vs_abc123"],
  "stream": false
}

Method 2: Via Assistant

  1. Create assistant with file_search tool enabled
  2. Attach vector stores to assistant
  3. Use assistant in chat requests

Rate Limits

  • Max files per request: 10
  • Max file size: 50 MB (PDFs, Office docs), 10 MB (text files)
  • Max concurrent uploads: 100 per organization
  • Processing queue: Files processed in order, typically 2-5 seconds per file

Best Practices

  1. Batch uploads: Upload multiple files in a single request when possible
  2. Check status: Poll status endpoint after upload to confirm processing completion
  3. Handle errors: Implement retry logic for transient failures
  4. File naming: Use descriptive filenames for better organization
  5. MIME types: Always provide accurate MIME types for proper processing
  6. Base64 encoding: Remove data URL prefix (data:application/pdf;base64,) before sending

Security

  • Files are scoped to organizations - users can only access files in their organization
  • Files are stored securely with encryption at rest
  • Vector embeddings are isolated per organization
  • API keys and bearer tokens provide authentication
  • All uploads are validated for file type and size

Limitations

  • Maximum 10 files per request
  • Files must be base64-encoded
  • Processing is asynchronous (2-5 seconds typical)
  • Vector stores have a maximum capacity (contact support for limits)
  • Some file types require specific processing (OCR for images, parsing for Office docs)