> ## Documentation Index
> Fetch the complete documentation index at: https://docs.invaro.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload Documents

> The file upload endpoint is the first step in processing documents. It accepts multiple files and returns document IDs that you can use for processing.

<Warning>
  This /upload endpoint is now considered legacy but remains fully functional for backward compatibility. We recommend migrating to the new [Files API](/api-reference/endpoints/new-files-api/upload-files) for enhanced features and better file management.
</Warning>

{/* ## Usage Examples

### Upload a Single File

<CodeGroup>

```bash cURL
curl -X POST "https://api.invaro.ai/api/v1/parse/upload" \
-H "Authorization: Bearer your_api_key" \
-F "files=@statement.pdf"
```

```python Python
import requests

url = "https://api.invaro.ai/api/v1/parse/upload"
headers = {
  "Authorization": "Bearer your_api_key"
}
files = {
  "files": ("statement.pdf", open("statement.pdf", "rb"))
}

response = requests.post(url, headers=headers, files=files)
print(response.json())
```

```javascript JavaScript
const form = new FormData();
form.append('files', fileInput.files[0]);

const response = await fetch('https://api.invaro.ai/api/v1/parse/upload', {
method: 'POST',
headers: {
  'Authorization': 'Bearer your_api_key'
},
body: form
});

const data = await response.json();
console.log(data);
```

</CodeGroup>

### Upload Multiple Files

<CodeGroup>

```bash cURL
curl -X POST "https://api.invaro.ai/api/v1/parse/upload" \
-H "Authorization: Bearer your_api_key" \
-F "files=@statement1.pdf" \
-F "files=@statement2.pdf"
```

```python Python
import requests

url = "https://api.invaro.ai/api/v1/parse/upload"
headers = {
  "Authorization": "Bearer your_api_key"
}
files = [
  ("files", ("statement1.pdf", open("statement1.pdf", "rb"))),
  ("files", ("statement2.pdf", open("statement2.pdf", "rb")))
]

response = requests.post(url, headers=headers, files=files)
print(response.json())
```

```javascript JavaScript
const form = new FormData();
form.append('files', fileInput.files[0]);
form.append('files', fileInput.files[1]);

const response = await fetch('https://api.invaro.ai/api/v1/parse/upload', {
method: 'POST',
headers: {
  'Authorization': 'Bearer your_api_key'
},
body: form
});

const data = await response.json();
console.log(data);
```

</CodeGroup>

## Response Examples

### Successful Upload

```json
{
"success": true,
"data": {
  "files": [
    {
      "file_id": "1234567890_statement.pdf",
      "document_id": "doc_abc123",
      "file_url": "https://storage.invaro.ai/files/1234567890_statement.pdf",
      "error": null
    }
  ],
  "status": "done"
}
}
```

<Note>
The `document_id` in the response is what you'll use for processing the document. This ID is required for all subsequent API calls related to the document.
</Note>

### Validation Error

```json
{
"success": false,
"error": {
  "code": "VALIDATION_ERROR",
  "message": "Invalid file type",
  "details": "Only PDF, JPG, JPEG, and PNG files are allowed"
}
}
```

## Next Steps

After successfully uploading your documents, use the returned `document_id` to:
- [Process Bank Statements](/api-reference/endpoints/process-statements)
- [Process Invoices](/api-reference/endpoints/process-invoices)
- Learn about [Best Practices](/api-reference/best-practices/file-uploads)  */}


## OpenAPI

````yaml POST /parse/upload
openapi: 3.0.0
info:
  title: Invaro Document Processing API
  description: API for processing bank statements and invoices using OCR and AI
  version: 1.0.0
  contact:
    name: Invaro Support
    email: support@invaro.ai
    url: https://docs.invaro.ai
servers:
  - url: https://api.invaro.ai/api/v1
    description: Production API
security:
  - bearerAuth: []
paths:
  /parse/upload:
    post:
      tags:
        - File Upload
      summary: Upload Documents
      description: Upload one or more documents for processing
      operationId: uploadDocuments
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - files
              properties:
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                  description: Documents to upload (PDF, JPG, JPEG, PNG)
      responses:
        '200':
          description: Files uploaded successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      files:
                        type: array
                        items:
                          type: object
                          properties:
                            file_id:
                              type: string
                              example: 1739260380783576729_invoice3.pdf
                            file_url:
                              type: string
                              example: >-
                                https://wssbebkqiavijahjhako.supabase.co/storage/v1/object/public/invoices/1739260380783576729_invoice3.pdf
                            doc_id:
                              type: string
                              example: f663d9ac-6d5b-4cfe-bf30-ac19ad9429e4
                      status:
                        type: string
                        example: done
        '400':
          description: Bad request - Invalid file type or missing files
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: 'Invalid file type. Supported types: PDF, JPG, JPEG, PNG'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````