Extract data
Read the nine values taken from an invoice, accept the ones that are right and correct the others until the invoice can be submitted.
On this page
Create the invoice with extract set to true, as in Upload and classify, then read its extraction. Only a document of class invoice is read; for any other document the answer is extraction_not_found.
curl
curl "$RDC_BASE_URL/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"documentId": "ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6",
"channel": "email",
"receivedAt": "2026-11-23T06:58:00Z",
"pages": 1,
"fields": [
{
"field": "supplier",
"value": "Moara Vadului SRL",
"confidence": 99,
"state": "accepted",
"partnerValue": null
},
{
"field": "taxCode",
"value": "RO51603473",
"confidence": 98,
"state": "accepted",
"partnerValue": null
},
{
"field": "invoiceNumber",
"value": "MV-2026-03117",
"confidence": 97,
"state": "accepted",
"partnerValue": null
},
{
"field": "issueDate",
"value": "2026-11-20",
"confidence": 96,
"state": "accepted",
"partnerValue": null
},
{
"field": "dueDate",
"value": "2026-12-20",
"confidence": 84,
"state": "to-review",
"partnerValue": null
},
{
"field": "net",
"value": "11247.00",
"confidence": 99,
"state": "accepted",
"partnerValue": null
},
{
"field": "vat",
"value": "1255.17",
"confidence": 98,
"state": "accepted",
"partnerValue": null
},
{
"field": "gross",
"value": "12302.17",
"confidence": 61,
"state": "to-review",
"partnerValue": null
},
{
"field": "iban",
"value": "RO65ZZZZ5160347002219999",
"confidence": 96,
"state": "differs",
"partnerValue": "RO87ZZZZ5160347002210000"
}
],
"revision": 1
} Read the values
The extraction has one entry for each of the nine values: supplier, taxCode, invoiceNumber, issueDate, dueDate, net, vat, gross, iban. Each entry has the value that was read, its confidence from 0 to 100, its state and the partnerValue. The revision of the extraction is 1 until a person settles a value.
| state | When | What to do |
|---|---|---|
accepted | The value was read with a confidence of at least 90, or a person confirmed it, and it does not differ from the partner record. | Nothing. |
to-review | The confidence is under 90, or the gross is not the net plus the vat. | Compare it with the invoice. Accept it when it is right, correct it when it is not. |
differs | The value is not the one in the partner record, which partnerValue holds. | Correct it to partnerValue. Accepting it is refused. |
Read a difference first, then the values to review from the lowest confidence. In this invoice the order is iban, gross, dueDate; the entries themselves come in the order the invoice prints them.
Step 1: Accept a value that is right
The dueDate was read as 2026-12-20 with a confidence of 84. It matches the invoice, so confirm it. Send the revision of the extraction, 1, as expectedRevision.
Accept the due date
curl
curl -X POST "$RDC_BASE_URL/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/dueDate/accept" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "f8f0cbc1-bb9c-44ce-909c-51837d6fceb2",
"expectedRevision": 1,
"by": "sorin-avram"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/dueDate/accept`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "f8f0cbc1-bb9c-44ce-909c-51837d6fceb2",
"expectedRevision": 1,
"by": "sorin-avram"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/dueDate/accept',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': 'f8f0cbc1-bb9c-44ce-909c-51837d6fceb2',
'expectedRevision': 1,
'by': 'sorin-avram',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "f8f0cbc1-bb9c-44ce-909c-51837d6fceb2",
"expectedRevision": 1,
"by": "sorin-avram"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/dueDate/accept');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/dueDate/accept");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "f8f0cbc1-bb9c-44ce-909c-51837d6fceb2",
"expectedRevision": 1,
"by": "sorin-avram"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "f8f0cbc1-bb9c-44ce-909c-51837d6fceb2",
"status": "accepted",
"aggregateRevision": 2
} Every accepted or corrected value adds one to the revision of the extraction, so the next change sends 2.
Step 2: Correct a value that is wrong
The net 11247.00 plus the vat 1255.17 is 12502.17, but the gross was read as 12302.17. Accepting it is refused with totals_do_not_add, so correct it. A corrected value is kept with a confidence of 100.
curl
curl -X POST "$RDC_BASE_URL/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/gross/correct" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "0a211494-7f4a-4d1a-938a-1e50e1bd95b8",
"expectedRevision": 2,
"value": "12502.17",
"by": "sorin-avram"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/gross/correct`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "0a211494-7f4a-4d1a-938a-1e50e1bd95b8",
"expectedRevision": 2,
"value": "12502.17",
"by": "sorin-avram"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/gross/correct',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '0a211494-7f4a-4d1a-938a-1e50e1bd95b8',
'expectedRevision': 2,
'value': '12502.17',
'by': 'sorin-avram',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "0a211494-7f4a-4d1a-938a-1e50e1bd95b8",
"expectedRevision": 2,
"value": "12502.17",
"by": "sorin-avram"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/gross/correct');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/gross/correct");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "0a211494-7f4a-4d1a-938a-1e50e1bd95b8",
"expectedRevision": 2,
"value": "12502.17",
"by": "sorin-avram"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "0a211494-7f4a-4d1a-938a-1e50e1bd95b8",
"status": "accepted",
"aggregateRevision": 3
} Step 3: Correct a difference to the partner value
The iban on the invoice is not the one in the record of the supplier. Accepting it is refused with value_differs.
Accepting a value that differs
curl
curl -X POST "$RDC_BASE_URL/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/iban/accept" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "b1000343-e53f-42a9-bace-c4911922eb8e",
"expectedRevision": 1,
"by": "sorin-avram"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/iban/accept`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "b1000343-e53f-42a9-bace-c4911922eb8e",
"expectedRevision": 1,
"by": "sorin-avram"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/iban/accept',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': 'b1000343-e53f-42a9-bace-c4911922eb8e',
'expectedRevision': 1,
'by': 'sorin-avram',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "b1000343-e53f-42a9-bace-c4911922eb8e",
"expectedRevision": 1,
"by": "sorin-avram"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/iban/accept');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/iban/accept");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "b1000343-e53f-42a9-bace-c4911922eb8e",
"expectedRevision": 1,
"by": "sorin-avram"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"code": "value_differs",
"message": "The value differs from the partner record.",
"requestId": "722ecbad-fcbf-49a0-a408-736a8d2de3a9"
} Correct it to the partnerValue, RO87ZZZZ5160347002210000. An amount is kept with two decimals, and an IBAN without spaces, in capitals. The answer sends the revision on to 4.
Correct the IBAN
curl
curl -X POST "$RDC_BASE_URL/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/iban/correct" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "6d4be7c2-cedf-4fba-96de-d256a0b8c72d",
"expectedRevision": 3,
"value": "RO87ZZZZ5160347002210000",
"by": "sorin-avram"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/iban/correct`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "6d4be7c2-cedf-4fba-96de-d256a0b8c72d",
"expectedRevision": 3,
"value": "RO87ZZZZ5160347002210000",
"by": "sorin-avram"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/iban/correct',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '6d4be7c2-cedf-4fba-96de-d256a0b8c72d',
'expectedRevision': 3,
'value': 'RO87ZZZZ5160347002210000',
'by': 'sorin-avram',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "6d4be7c2-cedf-4fba-96de-d256a0b8c72d",
"expectedRevision": 3,
"value": "RO87ZZZZ5160347002210000",
"by": "sorin-avram"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/iban/correct');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/iban/correct");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "6d4be7c2-cedf-4fba-96de-d256a0b8c72d",
"expectedRevision": 3,
"value": "RO87ZZZZ5160347002210000",
"by": "sorin-avram"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "6d4be7c2-cedf-4fba-96de-d256a0b8c72d",
"status": "accepted",
"aggregateRevision": 4
} Step 4: Submit the invoice
Read the extraction again: 3 values were settled, every value is accepted and the revision is 4. Submit the invoice as in the Quickstart. While a value is not accepted, the answer is a 422 that names each one in fields, and nothing changes.
Submit before every value is accepted
curl
curl -X POST "$RDC_BASE_URL/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/submit" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "14be55c6-fd5a-400e-adf3-4b4fc39ec4d4",
"expectedRevision": 1,
"by": "sorin-avram"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/submit`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "14be55c6-fd5a-400e-adf3-4b4fc39ec4d4",
"expectedRevision": 1,
"by": "sorin-avram"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/submit',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '14be55c6-fd5a-400e-adf3-4b4fc39ec4d4',
'expectedRevision': 1,
'by': 'sorin-avram',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "14be55c6-fd5a-400e-adf3-4b4fc39ec4d4",
"expectedRevision": 1,
"by": "sorin-avram"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/submit');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/submit");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "14be55c6-fd5a-400e-adf3-4b4fc39ec4d4",
"expectedRevision": 1,
"by": "sorin-avram"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"code": "extraction_unresolved",
"message": "Some extracted values need a person.",
"fields": [
{
"field": "dueDate",
"problem": "is to review"
},
{
"field": "gross",
"problem": "is to review"
},
{
"field": "iban",
"problem": "differs from the partner record"
}
],
"requestId": "722ecbad-fcbf-49a0-a408-736a8d2de3a9"
} Codes and what to do
| Code | Status | Cause | What to do |
|---|---|---|---|
value_differs | 409 | The value differs from the partner record. | Correct it to partnerValue. Do not send the accept again. |
totals_do_not_add | 422 | The gross is not the net plus the vat. | Correct the value that is wrong, then accept or correct the gross. |
value_already_accepted | 409 | The value is accepted already. | Read the extraction again. Correct the value only if it is wrong. |
nothing_to_change | 422 | The corrected value is the one already kept. | Do not send it. Accept the value if it is right. |
value_required | 422 | The value is empty or longer than 120 characters. | Send a shorter value. |
date_not_valid | 422 | A date is not a real day in the form YYYY-MM-DD. | Correct the date and send it with a new operationId. |
amount_not_valid | 422 | An amount is not a decimal string above zero. | Send it as a decimal string such as 12502.17. |
account_not_valid | 422 | The IBAN has the wrong shape. | Send two letters, two digits, then 10 to 30 letters or digits. |
field_not_found | 404 | The name is not one of the nine values. | Use a name from the field of the extraction. |
extraction_not_found | 404 | The document was not created with extract, or it is not an invoice. | No retry. Create the invoice again with extract. |
extraction_closed | 409 | The invoice was submitted. | No retry. The values no longer change. |
extraction_unresolved | 422 | A submit with a value that is not accepted. | Settle each value in fields, then submit again. |
revision_conflict | 409 | The expectedRevision is older than the extraction. | Read the extraction again and send its revision. |
Related pages
- Upload and classify: create the invoice with
extract. - Approvals: what happens after the invoice is submitted.
- Idempotency and concurrency:
operationIdandexpectedRevision. - Errors: every code of the API.