Eden AI Docs
Search…
OCR Invoice
The OCR Invoice API enables customers to take invoices in a variety of formats and return structured data to automate the invoice processing.
post
https://api.edenai.run/v1/pretrained
/ocr/ocr_invoice
OCR Invoice
Supported languages:
Name
Type
Value
English(US)
string
en-US
French
string
fr-FR
Spanish
string
es-ES
Here is the list of available providers, the associated parameter values and engines version:
Name
Value
Version
Mindee
mindee
v2
Base64
base64
latest
Dataleon
dataleon
v3.1.0
Microsoft Azure
microsoft
v2.1-preview.3
If you want to use Eden AI SDK for OCR Invoice, you can just copy paste this code:
Python
PHP
JavaScript
C#
1
# pip install edenai
2
3
from edenai import OCR
4
5
# Get your API key here: https://app.edenai.run/admin/account
6
ocr_apis = OCR("Your_API_key")
7
8
result = ocr_apis.invoice(
9
# Available providers, languages and formats here: https://api.edenai.run/v1/redoc/#operation/OCR%20Invoice
10
providers=["microsoft", "mindee"],
11
language="en-US",
12
file="your_invoice.pdf")
13
14
print(result)
Copied!
1
<?php
2
require_once(__DIR__ . '/vendor/autoload.php');
3
// Configure API key authorization: Bearer
4
$config = edenai\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
5
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
6
// $config = edenai\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
7
8
$apiInstance = new edenai\Api\OCRApi(
9
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
10
// This is optional, `GuzzleHttp\Client` will be used as default.
11
new GuzzleHttp\Client(),
12
$config
13
);
14
$files = "files_example"; // string |
15
$providers = "providers_example"; // string |
16
$language = "language_example"; // string |
17
18
try {
19
$result = $apiInstance->ocrInvoice($files, $providers, $language);
20
print_r($result);
21
} catch (Exception $e) {
22
echo 'Exception when calling OCRApi->ocrInvoice: ', $e->getMessage(), PHP_EOL;
23
}
24
?>
Copied!
1
import {EdenAiApiDocumentation} from 'eden_ai_api_documentation';
2
let defaultClient = EdenAiApiDocumentation.ApiClient.instance;
3
4
// Configure API key authorization: Bearer
5
let Bearer = defaultClient.authentications['Bearer'];
6
Bearer.apiKey = 'YOUR API KEY';
7
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
8
//Bearer.apiKeyPrefix = 'Token';
9
10
let apiInstance = new EdenAiApiDocumentation.OCRApi();
11
let files = "files_example"; // Blob |
12
let providers = "providers_example"; // String |
13
let language = "language_example"; // String |
14
15
apiInstance.ocrInvoice(files, providers, language, (error, data, response) => {
16
if (error) {
17
console.error(error);
18
} else {
19
console.log('API called successfully. Returned data: ' + data);
20
}
21
});
Copied!
1
using System;
2
using System.Diagnostics;
3
using EdenAI.Api;
4
using EdenAI.Client;
5
using EdenAI.Model;
6
7
namespace Example
8
{
9
public class OcrInvoiceExample
10
{
11
public void main()
12
{
13
// Configure API key authorization: Bearer
14
Configuration.Default.AddApiKey("Authorization", "YOUR_API_KEY");
15
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
16
// Configuration.Default.AddApiKeyPrefix("Authorization", "Bearer");
17
18
var apiInstance = new OCRApi();
19
var files = new System.IO.Stream(); // System.IO.Stream | File Image to analyse (ex: pdf, jpg, jpeg, png)
20
var providers = providers_example; // string | Provider to compare (ex: [ 'mindee', 'microsoft'])
21
var language = language_example; // string | Language code of invoice (ex: fr-FR (French), en-US (English), es-ES (Spanish))
22
23
try
24
{
25
InlineResponse2002 result = apiInstance.OcrInvoice(files, providers, language);
26
Debug.WriteLine(result);
27
}
28
catch (Exception e)
29
{
30
Debug.Print("Exception when calling OCRApi.OcrInvoice: " + e.Message );
31
}
32
}
33
}
34
}
Copied!
Copy link