> 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 single document file

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

Upload a single document file with metadata for processing.

Allowed formats are:
- Images: .jpeg, .jpg, .png, .tiff (.tif)
- PDFs: .pdf

The API accepts a single file with optional JSON metadata. A DocumentId is pre-assigned and returned immediately.

Note: This endpoint does not use splitter functionality.

**DEPRECATED:** This endpoint will be removed. Use the batch upload endpoint (`/upload-direct`) instead, which supports single or multiple files.

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

## 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 containing a file.

- `file` (file, required) — Single binary document file to upload via multipart/form-data. **Supported formats:** - **Images:** .jpeg, .jpg, .png, .tiff (.tif) - **PDFs:** .pdf **Note:** Upload actual binary file data, not file path or string. 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.
- `info` (V1IngestSinglePostRequestBodyContentMultipartFormDataSchemaInfo, optional) — JSON object containing file metadata

## Response

### 201

Document uploaded successfully with pre-assigned DocumentId

- `accountId` (string, required) — Account ID
- `environmentId` (string, required) — Environment ID
- `importId` (string, required) — Import ID for tracking the upload process
- `fileId` (string, required) — File ID for the uploaded file
- `filename` (string, required) — Original filename
- `documentId` (string, required, deprecated) — Pre-assigned Document ID. DEPRECATED: This field will be removed. Instead, use webhooks to receive processing notifications, then retrieve documentIds from the file details endpoint.

## Errors

### 400 Bad Request Error

Bad Request - Validation errors

- `message` (V1IngestSinglePostResponsesContentApplicationJsonSchemaMessage, 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

### V1IngestSinglePostResponsesContentApplicationJsonSchemaMessage

## Examples

**Request**

```json
{
  "file": "<file: string>"
}
```

**Response**

```json
{
  "accountId": "000000000000000000000007",
  "environmentId": "000000000000000000000008",
  "importId": "000000000000000000000009",
  "fileId": "00000000000000000000000b",
  "filename": "document.pdf",
  "documentId": "00000000000000000000000a"
}
```

**SDK Code**

```python
import requests

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

files = { "file": "open('string', 'rb')" }
payload = { "info":  }
headers = {"x-api-key": "<apiKey>"}

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

print(response.json())
```

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

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/single"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"info\"\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/single")

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=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"info\"\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/single")
  .header("x-api-key", "<apiKey>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"info\"\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/single', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => 'string',
        'contents' => null
    ]
  ]
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.invofox.com/v1/ingest/single");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"info\"\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": "file",
    "fileName": "string"
  ],
  [
    "name": "info",
    "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/single")! 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()
```