> 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.

# OCR a file from URL

POST https://api.sandbox.monite.com/v1/ocr_tasks
Content-Type: application/json

Reference: https://docs.monite.com/api/ocr/post-ocr-tasks

## 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)
- `x-monite-entity-id` (string, optional) — The ID of the entity that owns the requested resource.

### Body (application/json)

This endpoint expects an object.

- `file_url` (string, required)
- `document_type` (enum, optional)
  - Allowed values: `invoice`, `credit_note`, `receipt`

## Response

### 202

OCR task has been accepted for execution.

- `id` (string, required)
- `created_at` (datetime, required)
- `updated_at` (datetime, required)
- `status` (enum, required)
  - Allowed values: `processing`, `success`, `error`
- `document_type` (enum, optional)
  - Allowed values: `invoice`, `credit_note`, `receipt`
- `recognized_data` (OcrTaskResponseSchemaRecognizedData, optional)

## Errors

### 400 Post OCR Tasks Request Bad Request Error

OCR previously tried to recognize this file and failed.

- `any`

### 401 Post OCR Tasks 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`

### 413 Post OCR Tasks Request Content Too Large Error

File size exceeds the limit for OCR processing.

- `any`

### 415 Post OCR Tasks Request Unsupported Media Type Error

Unsupported file format. OCR supports only PNG, JPG, and PDF.

- `any`

### 421 Post OCR Tasks Request Misdirected Request Error

The specified file URL is not reachable.

- `any`

### 422 Post OCR Tasks Request Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 424 Post OCR Tasks Request Failed Dependency Error

The specified file URL is reachable but returned an HTTP error status code.

- `any`

### 429 Post OCR Tasks Request Too Many Requests Error

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

- `any`

## Types

### OcrTaskResponseSchemaRecognizedData

- `type`: `invoice`
  - `recipient` (OcrCounterpartDetails, required)
  - `sender` (OcrCounterpartDetails, required)
  - `amount_paid` (double, optional)
  - `currency` (enum, optional)
    - Allowed values: `AED`, `AFN`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SEK`, `SGD`, `SHP`, `SLE`, `SOS`, `SRD`, `SSP`, `SVC`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VND`, `VUV`, `WST`, `XAF`, `XCD`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`
  - `document_number` (string, optional)
  - `due_date` (string, optional)
  - `issue_date` (string, optional)
  - `line_items` (list of OcrLineItem, optional)
  - `payment_terms` (string, optional)
  - `subtotal` (double, optional)
  - `tax_amount` (double, optional)
  - `tax_rate` (double, optional)
  - `total_amount` (double, optional)
- `type`: `credit_note`
  - `line_items` (list of OcrLineItem, required)
  - `recipient` (OcrCounterpartDetails, required)
  - `sender` (OcrCounterpartDetails, required)
  - `currency` (enum, optional)
    - Allowed values: `AED`, `AFN`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SEK`, `SGD`, `SHP`, `SLE`, `SOS`, `SRD`, `SSP`, `SVC`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VND`, `VUV`, `WST`, `XAF`, `XCD`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`
  - `document_number` (string, optional)
  - `issue_date` (string, optional)
  - `original_invoice_number` (string, optional)
  - `subtotal` (double, optional)
  - `tax_amount` (double, optional)
  - `tax_rate` (double, optional)
  - `total_amount` (double, optional)
- `type`: `receipt`
  - `line_items` (list of OcrReceiptLineItem, required)
  - `sender` (OcrCounterpartDetails, required)
  - `currency` (enum, optional)
    - Allowed values: `AED`, `AFN`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SEK`, `SGD`, `SHP`, `SLE`, `SOS`, `SRD`, `SSP`, `SVC`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VND`, `VUV`, `WST`, `XAF`, `XCD`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`
  - `discount` (double, optional)
  - `document_number` (string, optional)
  - `issued_at` (datetime, optional)
  - `subtotal` (double, optional)
  - `tax_amount` (double, optional)
  - `tax_rate` (double, optional)
  - `tax_type` (string, optional)
  - `total_amount` (double, optional)

### ValidationError

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

### OcrCounterpartDetails

- `address` (OcrAddressDetails, required)
- `bank_account` (OcrBankDetails, required)
- `email` (string, optional)
- `name` (string, optional)
- `tax_number` (string, optional)
- `vat_number` (string, optional)

### OcrLineItem

- `description` (string, optional)
- `line_reference` (string, optional)
- `name` (string, optional)
- `quantity` (double, optional)
- `subtotal` (double, optional)
- `tax_amount` (double, optional)
- `tax_rate` (double, optional)
- `total_amount` (double, optional)
- `unit` (string, optional)
- `unit_price` (double, optional)

### OcrReceiptLineItem

- `description` (string, optional)
- `discount_amount` (double, optional)
- `line_reference` (string, optional)
- `name` (string, optional)
- `quantity` (double, optional)
- `subtotal` (double, optional)
- `tax_amount` (double, optional)
- `tax_rate` (double, optional)
- `total_amount` (double, optional)
- `unit` (string, optional)
- `unit_price` (double, optional)

### ValidationErrorLocItem

### OcrAddressDetails

- `city` (string, optional)
- `country` (enum, optional)
  - Allowed values: `AF`, `AX`, `AL`, `DZ`, `AS`, `AD`, `AO`, `AI`, `AQ`, `AG`, `AR`, `AM`, `AW`, `AU`, `AT`, `AZ`, `BS`, `BH`, `BD`, `BB`, `BY`, `BE`, `BZ`, `BJ`, `BM`, `BT`, `BO`, `BA`, `BW`, `BV`, `BR`, `IO`, `BN`, `BG`, `BF`, `BI`, `KH`, `CM`, `CA`, `IC`, `CV`, `KY`, `CF`, `EA`, `TD`, `CL`, `CN`, `CX`, `CC`, `CO`, `KM`, `CG`, `CD`, `CK`, `CR`, `CI`, `HR`, `CU`, `CY`, `CZ`, `DK`, `DJ`, `DM`, `DO`, `EC`, `EG`, `SV`, `GQ`, `ER`, `EE`, `SZ`, `ET`, `FK`, `FO`, `FJ`, `FI`, `FR`, `GF`, `PF`, `TF`, `GA`, `GM`, `GE`, `DE`, `GH`, `GI`, `GR`, `GL`, `GD`, `GP`, `GU`, `GT`, `GG`, `GN`, `GW`, `GY`, `HT`, `HM`, `VA`, `HN`, `HK`, `HU`, `IS`, `IN`, `ID`, `IR`, `IQ`, `IE`, `IM`, `IL`, `IT`, `JM`, `JP`, `JE`, `JO`, `KZ`, `KE`, `KI`, `KP`, `KR`, `KW`, `KG`, `LA`, `LV`, `LB`, `LS`, `LR`, `LY`, `LI`, `LT`, `LU`, `MO`, `MG`, `MW`, `MY`, `MV`, `ML`, `MT`, `MH`, `MQ`, `MR`, `MU`, `YT`, `MX`, `FM`, `MD`, `MC`, `MN`, `ME`, `MS`, `MA`, `MZ`, `MM`, `NA`, `NR`, `NP`, `NL`, `AN`, `NC`, `NZ`, `NI`, `NE`, `NG`, `NU`, `NF`, `MP`, `MK`, `NO`, `OM`, `PK`, `PW`, `PS`, `PA`, `PG`, `PY`, `PE`, `PH`, `PN`, `PL`, `PT`, `PR`, `QA`, `RE`, `RO`, `RU`, `RW`, `SH`, `KN`, `LC`, `PM`, `VC`, `WS`, `SM`, `ST`, `SA`, `SN`, `RS`, `SC`, `SL`, `SG`, `SK`, `SI`, `SB`, `SO`, `ZA`, `SS`, `GS`, `ES`, `LK`, `SD`, `SR`, `SJ`, `SE`, `CH`, `SY`, `TW`, `TJ`, `TZ`, `TH`, `TL`, `TG`, `TK`, `TO`, `TT`, `TN`, `TR`, `TM`, `TC`, `TV`, `UG`, `UA`, `AE`, `GB`, `US`, `UM`, `UY`, `UZ`, `VU`, `VE`, `VN`, `VG`, `VI`, `WF`, `EH`, `YE`, `ZM`, `ZW`, `BL`, `BQ`, `CW`, `MF`, `SX`
- `postal_code` (string, optional)
- `state` (string, optional)
- `street_and_number` (string, optional)

### OcrBankDetails

- `bank_account_number` (string, optional)
- `iban` (string, optional)
- `swift_bic` (string, optional)

## Examples

**Request**

```json
{
  "file_url": "file_url"
}
```

**Response**

```json
{
  "id": "id",
  "created_at": "2024-01-15T09:30:00Z",
  "updated_at": "2024-01-15T09:30:00Z",
  "status": "processing",
  "document_type": "invoice",
  "recognized_data": {
    "type": "invoice",
    "recipient": {
      "address": {
        "city": "city",
        "country": "AF",
        "postal_code": "postal_code",
        "state": "state",
        "street_and_number": "street_and_number"
      },
      "bank_account": {
        "bank_account_number": "bank_account_number",
        "iban": "iban",
        "swift_bic": "swift_bic"
      },
      "email": "email",
      "name": "name",
      "tax_number": "tax_number",
      "vat_number": "vat_number"
    },
    "sender": {
      "address": {
        "city": "city",
        "country": "AF",
        "postal_code": "postal_code",
        "state": "state",
        "street_and_number": "street_and_number"
      },
      "bank_account": {
        "bank_account_number": "bank_account_number",
        "iban": "iban",
        "swift_bic": "swift_bic"
      },
      "email": "email",
      "name": "name",
      "tax_number": "tax_number",
      "vat_number": "vat_number"
    },
    "amount_paid": 1.1,
    "currency": "AED",
    "document_number": "document_number",
    "due_date": "due_date",
    "issue_date": "issue_date",
    "line_items": [
      {
        "description": "description",
        "line_reference": "line_reference",
        "name": "name",
        "quantity": 1.1,
        "subtotal": 1.1,
        "tax_amount": 1.1,
        "tax_rate": 1.1,
        "total_amount": 1.1,
        "unit": "unit",
        "unit_price": 1.1
      }
    ],
    "payment_terms": "payment_terms",
    "subtotal": 1.1,
    "tax_amount": 1.1,
    "tax_rate": 1.1,
    "total_amount": 1.1
  }
}
```

**SDK Code**

```python
import requests

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

payload = { "file_url": "file_url" }
headers = {
    "x-monite-version": "2024-05-25",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.sandbox.monite.com/v1/ocr_tasks';
const options = {
  method: 'POST',
  headers: {
    'x-monite-version': '2024-05-25',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"file_url":"file_url"}'
};

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

	payload := strings.NewReader("{\n  \"file_url\": \"file_url\"\n}")

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

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

	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/ocr_tasks")

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["Content-Type"] = 'application/json'
request.body = "{\n  \"file_url\": \"file_url\"\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/ocr_tasks")
  .header("x-monite-version", "2024-05-25")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"file_url\": \"file_url\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.sandbox.monite.com/v1/ocr_tasks', [
  'body' => '{
  "file_url": "file_url"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'x-monite-version' => '2024-05-25',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.sandbox.monite.com/v1/ocr_tasks");
var request = new RestRequest(Method.POST);
request.AddHeader("x-monite-version", "2024-05-25");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"file_url\": \"file_url\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-monite-version": "2024-05-25",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["file_url": "file_url"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sandbox.monite.com/v1/ocr_tasks")! 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()
```