> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.monite.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.monite.com/_mcp/server.

# Upload a file

POST https://api.sandbox.monite.com/v1/files
Content-Type: multipart/form-data

Upload files for use as:

 * supplementary attachments for invoices, quotes, and credit notes,
 * [entity verification documents](https://docs.monite.com/payments/onboarding/via-api/documents) for payments onboarding.

Maximum file size is 15 MB. Each uploaded file is assigned a unique `id` that you can use to reference this file elsewhere.

Both partner tokens and entity user tokens can be used for authentication.

Reference: https://docs.monite.com/api/files/post-files

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api.sandbox.monite.com/v1` (sandbox, default)
- `https://api.monite.com/v1` (eu_production)
- `https://us.api.monite.com/v1` (na_production)

## Request

### Headers

- `x-monite-version` (string, required)

### Body (multipart/form-data)

This endpoint expects a multipart form containing a file.

- `file` (file, required) — The file to upload.
- `file_type` (enum, required) — The intended purpose of the file. Possible values: * `attachments` - supplemental attachments for accounts receivable invoices, quotes, and credit notes. * `identity_documents` - company registration documents or a person's identity documents for payments onboarding. * `additional_identity_documents` - documents that verify a person's address. Other enum values are not supposed to be used directly.

## Response

### 201

Successful Response

- `id` (string, required) — A unique ID assigned to this file.
- `created_at` (datetime, required) — Date and time when this file was uploaded to or created in Monite. Timestamps follow the ISO 8601 format.
- `updated_at` (datetime, required) — Date and time when this file was last updated in Monite. Timestamps follow the ISO 8601 format.
- `file_type` (string, required) — Possible values: * `additional_identity_documents` and `identity_documents` - [entity verification documents](https://docs.monite.com/payments/onboarding/via-api/documents) uploaded for payments onboarding. * `attachments` - supplementary attachments for accounts receivable invoices, quotes, and credit notes. * `delivery_notes` - auto-generated PDF versions of delivery notes. * `einvoices_xml` - e-invoice XML generated when sending e-invoices. * `payables` - payables (bills) received via email or uploaded via API. * `receivable_signatures` - images of customer signatures provided during quote acceptance. * `receivables` - auto-generated PDF versions of invoices, quotes, and credit notes. * `zip` - data export archives created by `POST /data_exports`.
- `md5` (string, required) — The MD5 hash of the file.
- `mimetype` (string, required) — The file's media type, for example, `application/pdf` or `image/png`.
- `name` (string, required) — The original file name (if available).
- `region` (string, required) — Geographical region of the data center where the file is stored.
- `s3_bucket` (string, required) — Unused.
- `s3_file_path` (string, required) — Unused.
- `size` (integer, required) — The file size in bytes.
- `url` (string, required) — The URL to download the file.

## Errors

### 401 Post Files Request Unauthorized Error

The `Authorization` header is missing or contains an invalid or expired access token. See [Authentication](https://docs.monite.com/api/concepts/authentication) to learn how to authenticate API calls.

- `any`

### 422 Post Files Request Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 429 Post Files Request Too Many Requests Error

API rate limit has been exceeded. Check the response headers for the rate limit information.

- `any`

## Types

### ValidationError

- `loc` (list of ValidationErrorLocItem, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItem

## Examples

**Request**

```json
{
  "file": "<file: <file1>>",
  "file_type": "ocr_results"
}
```

**Response**

```json
{
  "id": "id",
  "created_at": "2024-01-15T09:30:00Z",
  "updated_at": "2024-01-15T09:30:00Z",
  "file_type": "file_type",
  "md5": "60997cbcc1a6fb2ec37d389ffa8588db",
  "mimetype": "application/pdf",
  "name": "timesheet.pdf",
  "region": "eu-central-1",
  "s3_bucket": "s3_bucket",
  "s3_file_path": "s3_file_path",
  "size": 120101,
  "url": "https://bucketname.s3.amazonaws.com/path/to/timesheet.pdf"
}
```

**SDK Code**

```python
import requests

url = "https://api.sandbox.monite.com/v1/files"

files = { "file": "open('<file1>', 'rb')" }
payload = { "file_type": "ocr_results" }
headers = {
    "x-monite-version": "2024-05-25",
    "Authorization": "Bearer <token>"
}

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

print(response.json())
```

```javascript
const url = 'https://api.sandbox.monite.com/v1/files';
const form = new FormData();
form.append('file', '<file1>');
form.append('file_type', 'ocr_results');

const options = {
  method: 'POST',
  headers: {'x-monite-version': '2024-05-25', Authorization: 'Bearer <token>'}
};

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.sandbox.monite.com/v1/files"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_type\"\r\n\r\nocr_results\r\n-----011000010111000001101001--\r\n")

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

	req.Header.Add("x-monite-version", "2024-05-25")
	req.Header.Add("Authorization", "Bearer <token>")

	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.sandbox.monite.com/v1/files")

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

request = Net::HTTP::Post.new(url)
request["x-monite-version"] = '2024-05-25'
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_type\"\r\n\r\nocr_results\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.sandbox.monite.com/v1/files")
  .header("x-monite-version", "2024-05-25")
  .header("Authorization", "Bearer <token>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_type\"\r\n\r\nocr_results\r\n-----011000010111000001101001--\r\n")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.sandbox.monite.com/v1/files', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => '<file1>',
        'contents' => null
    ],
    [
        'name' => 'file_type',
        'contents' => 'ocr_results'
    ]
  ]
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'x-monite-version' => '2024-05-25',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.sandbox.monite.com/v1/files");
var request = new RestRequest(Method.POST);
request.AddHeader("x-monite-version", "2024-05-25");
request.AddHeader("Authorization", "Bearer <token>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_type\"\r\n\r\nocr_results\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-monite-version": "2024-05-25",
  "Authorization": "Bearer <token>"
]
let parameters = [
  [
    "name": "file",
    "fileName": "<file1>"
  ],
  [
    "name": "file_type",
    "value": "ocr_results"
  ]
]

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.sandbox.monite.com/v1/files")! 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()
```