---
title: "Approval | Docs | DMS by R&D Copilot"
description: "Submit a document to its approvers, approve it or return it with a reason."
canonical: "https://documents.rdcopilot.com/docs/api-reference/workflows/"
language: en
updated: 2026-11-23
---

# Approval

Submit a document to its approvers, approve it or return it with a reason.

## Submit a document

POST `/documents/v1/documents/{documentId}/submit`

Sends a draft to its approvers: the first approver of its class up to the limit, every approver above it, in order. An invoice is submitted when every extracted value is accepted.

### Parameters

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

### 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 document you read. |
| `by` | `string` | Yesrequired | Who submits the document. |

### 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` or `person_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `document_archived`, `revision_conflict`, `operation_reused`, `document_not_draft` or `revision_required`. | `Error` |
| `422` | The request was refused. The `code` is `extraction_unresolved`, `amount_required` or `owner_is_approver`. | `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/417fc646-2924-483f-b1d7-b2c07692e924/submit" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "881bc655-2a08-4758-b283-ceedcfab6e53",
  "expectedRevision": 1,
  "by": "sorin-avram"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/submit`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "881bc655-2a08-4758-b283-ceedcfab6e53",
    "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/417fc646-2924-483f-b1d7-b2c07692e924/submit',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '881bc655-2a08-4758-b283-ceedcfab6e53',
        'expectedRevision': 1,
        'by': 'sorin-avram',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "881bc655-2a08-4758-b283-ceedcfab6e53",
  "expectedRevision": 1,
  "by": "sorin-avram"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/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#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/submit");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "881bc655-2a08-4758-b283-ceedcfab6e53",
  "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": "881bc655-2a08-4758-b283-ceedcfab6e53",
  "status": "accepted",
  "aggregateRevision": 2
}
```

## Approve a document

POST `/documents/v1/documents/{documentId}/approve`

Records the approval of the next approver of the route. After the last approver the document is approved.

### Parameters

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

### 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 document you read. |
| `approver` | `string` | Yesrequired | The approver who decides: the next one of the route. |

### 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` or `person_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `document_archived`, `revision_conflict`, `operation_reused`, `document_not_in_review`, `not_your_turn` or `already_decided`. | `Error` |
| `422` | The request was refused. The `code` is `not_an_approver`. | `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/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9/approve" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "4939c1de-58ca-4732-ab10-4df248268504",
  "expectedRevision": 2,
  "approver": "ioana-marin"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9/approve`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "4939c1de-58ca-4732-ab10-4df248268504",
    "expectedRevision": 2,
    "approver": "ioana-marin"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9/approve',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '4939c1de-58ca-4732-ab10-4df248268504',
        'expectedRevision': 2,
        'approver': 'ioana-marin',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "4939c1de-58ca-4732-ab10-4df248268504",
  "expectedRevision": 2,
  "approver": "ioana-marin"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9/approve');
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/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9/approve");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "4939c1de-58ca-4732-ab10-4df248268504",
  "expectedRevision": 2,
  "approver": "ioana-marin"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "4939c1de-58ca-4732-ab10-4df248268504",
  "status": "accepted",
  "aggregateRevision": 3
}
```

## Return a document

POST `/documents/v1/documents/{documentId}/reject`

The next approver returns the document to its owner with a reason. It becomes a draft again and is revised before it is submitted.

### Parameters

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

### 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 document you read. |
| `approver` | `string` | Yesrequired | The approver who decides: the next one of the route. |
| `reason` | `string` | Yesrequired | Why the document is returned. |

### 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` or `person_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `document_archived`, `revision_conflict`, `operation_reused`, `document_not_in_review`, `not_your_turn` or `already_decided`. | `Error` |
| `422` | The request was refused. The `code` is `not_an_approver` or `reason_required`. | `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/c4619fe2-a7f9-49d9-98f7-46a02d5c39c3/reject" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "52427312-c140-49a8-b7e4-f856f6bb1017",
  "expectedRevision": 3,
  "approver": "ana-rusu",
  "reason": "The packaging quantities do not match the delivery note."
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/c4619fe2-a7f9-49d9-98f7-46a02d5c39c3/reject`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "52427312-c140-49a8-b7e4-f856f6bb1017",
    "expectedRevision": 3,
    "approver": "ana-rusu",
    "reason": "The packaging quantities do not match the delivery note."
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/c4619fe2-a7f9-49d9-98f7-46a02d5c39c3/reject',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '52427312-c140-49a8-b7e4-f856f6bb1017',
        'expectedRevision': 3,
        'approver': 'ana-rusu',
        'reason': 'The packaging quantities do not match the delivery note.',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "52427312-c140-49a8-b7e4-f856f6bb1017",
  "expectedRevision": 3,
  "approver": "ana-rusu",
  "reason": "The packaging quantities do not match the delivery note."
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/c4619fe2-a7f9-49d9-98f7-46a02d5c39c3/reject');
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/c4619fe2-a7f9-49d9-98f7-46a02d5c39c3/reject");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "52427312-c140-49a8-b7e4-f856f6bb1017",
  "expectedRevision": 3,
  "approver": "ana-rusu",
  "reason": "The packaging quantities do not match the delivery note."
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "52427312-c140-49a8-b7e4-f856f6bb1017",
  "status": "accepted",
  "aggregateRevision": 4
}
```
