---
title: "Extraction | Docs | DMS by R&D Copilot"
description: "Read the values taken from an invoice, accept them and correct them."
canonical: "https://documents.rdcopilot.com/docs/api-reference/extraction/"
language: en
updated: 2026-11-23
---

# Extraction

Read the values taken from an invoice, accept them and correct them.

## Get the extraction

GET `/documents/v1/documents/{documentId}/extraction`

Returns the values read from an invoice, each with how sure the reading is and whether a person has to look at it.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `documentId` | path | `string (uuid)` | Yesrequired | The document. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `200` | The record at its current revision. | `Extraction` |
| `401` | The token is missing, expired or not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The request was refused. The `code` is `document_not_found` or `extraction_not_found`. | `Error` |
| `429` | The request was refused and not processed: the `code` is `rate_limited`. Wait the seconds in the header `Retry-After`, then send it again with the same `operationId`. | `Error` |
| `503` | The service cannot answer now: the `code` is `unavailable`. Send the request again with the same `operationId`. | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

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

```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
<?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#

```csharp
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();
```

### Response `200`

JSON

```json
{
  "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
}
```

## Accept an extracted value

POST `/documents/v1/documents/{documentId}/extraction/{field}/accept`

Confirms a value that was read with doubt. A value that differs from the partner record is not accepted: correct it. The gross is not accepted while it is not the net plus the VAT.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `documentId` | path | `string (uuid)` | Yesrequired | The document. |
| `field` | path | `string` | Yesrequired | The extracted value: one of `supplier`, `taxCode`, `invoiceNumber`, `issueDate`, `dueDate`, `net`, `vat`, `gross`, `iban`. One of `supplier`, `taxCode`, `invoiceNumber`, `issueDate`, `dueDate`, `net`, `vat`, `gross`, `iban` |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the extraction you read. |
| `by` | `string` | Yesrequired | Who accepts the value. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result. | `OperationResult` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, expired or not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The request was refused. The `code` is `document_not_found`, `person_not_found`, `extraction_not_found` or `field_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `document_archived`, `revision_conflict`, `operation_reused`, `extraction_closed`, `value_already_accepted` or `value_differs`. | `Error` |
| `422` | The request was refused. The `code` is `totals_do_not_add`. | `Error` |
| `429` | The request was refused and not processed: the `code` is `rate_limited`. Wait the seconds in the header `Retry-After`, then send it again with the same `operationId`. | `Error` |
| `503` | The service cannot answer now: the `code` is `unavailable`. Send the request again with the same `operationId`. | `Error` |

### Request

curl

```bash
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

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

```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
<?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#

```csharp
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();
```

### Response `202`

JSON

```json
{
  "operationId": "f8f0cbc1-bb9c-44ce-909c-51837d6fceb2",
  "status": "accepted",
  "aggregateRevision": 2
}
```

## Correct an extracted value

POST `/documents/v1/documents/{documentId}/extraction/{field}/correct`

Replaces a value with the one you send. A corrected value is kept with full confidence. An amount is kept with two decimals, and an IBAN without spaces, in capitals.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `documentId` | path | `string (uuid)` | Yesrequired | The document. |
| `field` | path | `string` | Yesrequired | The extracted value: one of `supplier`, `taxCode`, `invoiceNumber`, `issueDate`, `dueDate`, `net`, `vat`, `gross`, `iban`. One of `supplier`, `taxCode`, `invoiceNumber`, `issueDate`, `dueDate`, `net`, `vat`, `gross`, `iban` |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the extraction you read. |
| `value` | `string` | Yesrequired | The corrected value: a text, a date `YYYY-MM-DD`, an amount as a decimal string or an IBAN. |
| `by` | `string` | Yesrequired | Who corrects the value. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result. | `OperationResult` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, expired or not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The request was refused. The `code` is `document_not_found`, `person_not_found`, `extraction_not_found` or `field_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `document_archived`, `revision_conflict`, `operation_reused` or `extraction_closed`. | `Error` |
| `422` | The request was refused. The `code` is `value_required`, `date_not_valid`, `amount_not_valid`, `account_not_valid` or `nothing_to_change`. | `Error` |
| `429` | The request was refused and not processed: the `code` is `rate_limited`. Wait the seconds in the header `Retry-After`, then send it again with the same `operationId`. | `Error` |
| `503` | The service cannot answer now: the `code` is `unavailable`. Send the request again with the same `operationId`. | `Error` |

### Request

curl

```bash
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

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

```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
<?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#

```csharp
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();
```

### Response `202`

JSON

```json
{
  "operationId": "0a211494-7f4a-4d1a-938a-1e50e1bd95b8",
  "status": "accepted",
  "aggregateRevision": 3
}
```
