> This documentation belongs to Invofox, an AI-powered document processing
> platform. The API extracts structured data (fields) from unstructured
> documents (invoices, contracts, forms, bank statements, and more).
> Key concepts: Account, Environment, Document Type, Field, File, Import,
> and Document. When answering, prefer the exact terminology defined in the
> Glossary and cite the relevant API Reference endpoint when applicable.

# Upload files

POST https://api.invofox.com/v1/ingest/uploads
Content-Type: multipart/form-data

Upload a file or a group of files of the same type (invoice, deliveryNote... or one of your custom types) to your environment. Each file is then processed asynchronously.
Allowed formats are
- images: .jpeg, .jpg, .png, .tiff
- PDFs: .pdf
- Compressed files: .zip

One of the parameters files or urls must be provided and can also be combined.

Reference: https://developers.invofox.com/api-reference/ingest-reference/files/upload-direct-controller-upload-direct

## Authentication

- `x-api-key` header (required) — API key authentication for programmatic access. Used by server-to-server integrations and API clients.
- `x-access-token` header (required) — Access token authentication for web users. Used by browser-based applications and authenticated user sessions.

## Request

### Body (multipart/form-data)

This endpoint expects a multipart form with multiple files.

- `files` (files, optional) — Binary files to upload via multipart/form-data. **Supported formats:** - **Images:** .jpeg, .jpg, .png, .tiff - **PDFs:** .pdf - **Compressed files:** .zip (for bulk uploads) **Note:** Upload actual binary file data, not file paths or strings. Use standard HTML file input or equivalent HTTP multipart upload. **Filename Encoding Limitation:** Due to RFC 2388 multipart/form-data specification, filenames are limited to Latin-1 (ISO-8859-1) character encoding. Non-ASCII characters (e.g., UTF-8 Unicode) in filenames will appear corrupted. For best compatibility, use ASCII-safe characters in filenames or implement client-side filename encoding.
- `urls` (list of string, optional) — **DEPRECATED:** Use the `/v1/ingest/by-url` endpoint instead for URL-based uploads. Array of URLs from which files will be downloaded and processed. This field is maintained for backward compatibility but should not be used in new integrations.
- `info` (V1IngestUploadsPostRequestBodyContentMultipartFormDataSchemaInfo, optional) — Information to map to the uploaded files in JSON format

## Response

### 201

URL to upload created

- `accountId` (string, required) — Account ID that the files were uploaded to
- `environmentId` (string, required) — Environment ID that the files were uploaded to
- `importId` (string, required) — Import ID that was registered
- `files` (list of FileUploadInfo, required) — Array of uploaded files information

## Errors

### 400 Bad Request Error

Bad Request - Validation errors

- `message` (list of string, optional)
- `error` (string, optional)
- `statusCode` (double, optional)

### 413 Content Too Large Error

Payload Too Large - File exceeds size limit (100MB)

- `message` (string, optional)
- `error` (string, optional)
- `statusCode` (double, optional)

## Types

### FileUploadInfo

- `filename` (string, required) — Filename of the file
- `id` (string, required) — File ID associated with the uploaded file
- `documentId` (string, optional, deprecated) — Pre-assigned Document ID, only available if file is imported as a single document. DEPRECATED: This field will be removed. Instead, use webhooks to receive processing notifications, then retrieve documentIds from the file details endpoint.

## Examples

**Request**

```json
{
  "files": []
}
```

**Response**

```json
{
  "accountId": "66d721ec7edc0baa3794eec1",
  "environmentId": "66d721f5ee90270bfac654a0",
  "importId": "66d711d737c788ba24e17734",
  "files": [
    {
      "filename": "file.pdf",
      "id": "66d721ec7edc0baa3794eec1",
      "documentId": "66d71d63c9d0d2adc038b076"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.invofox.com/v1/ingest/uploads"

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"info\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"urls\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "multipart/form-data; boundary=---011000010111000001101001"
}

response = requests.post(url, data=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.invofox.com/v1/ingest/uploads';
const form = new FormData();
form.append('info', '');
form.append('urls', '');

const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

options.body = form;

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.invofox.com/v1/ingest/uploads"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"info\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"urls\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.invofox.com/v1/ingest/uploads")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"info\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"urls\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.invofox.com/v1/ingest/uploads")
  .header("x-api-key", "<apiKey>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"info\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"urls\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.invofox.com/v1/ingest/uploads', [
  'headers' => [
    'Content-Type' => 'multipart/form-data; boundary=---011000010111000001101001',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.invofox.com/v1/ingest/uploads");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"info\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"urls\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["x-api-key": "<apiKey>"]
let parameters = [
  [
    "name": "info",
    "value": 
  ],
  [
    "name": "urls",
    "value": 
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api.invofox.com/v1/ingest/uploads")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```