---
title: "Documents and versions | Docs | DMS by R&D Copilot"
description: "How a document moves from draft to archive, what a version is, what a revision is and which change each status allows."
canonical: "https://documents.rdcopilot.com/docs/concepts/documents-and-versions/"
language: en
updated: 2026-11-23
---

# Documents and versions

How a document moves from draft to archive, what a version is, what a revision is and which change each status allows.

A document is a file with a class, properties, a status and an audit trail, named by an `id` and a number.

curl

```bash
curl "$RDC_BASE_URL/documents/v1/documents/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9`, {
  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/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9');
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/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9");
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
{
  "id": "af784fd4-dcdb-4ac4-9e0a-3f59571d40c9",
  "number": "DOC-2026-0401",
  "name": "Invoice BO-2026-0733",
  "class": "invoice",
  "counterpartyId": "f8888efb-9a9e-4556-82a4-687b8880629f",
  "counterparty": "Brânzeturi Obcina SRL",
  "project": "Purchasing",
  "owner": "sorin-avram",
  "date": "2026-11-19",
  "amount": "18940.50",
  "currency": "RON",
  "status": "in-review",
  "version": 1,
  "returned": false,
  "keepUntil": "2036-12-31",
  "changedAt": "2026-11-19T07:51:00Z",
  "approval": {
    "route": [
      "ioana-marin"
    ],
    "decisions": [],
    "next": "ioana-marin"
  },
  "signature": null,
  "readers": {
    "groups": [
      "finance",
      "purchasing"
    ],
    "people": [
      "sorin-avram",
      "ioana-marin"
    ]
  },
  "revision": 2
}
```

The answer carries the `status`, the `version`, the `revision`, the route of `approval`, the request in `signature` and the `readers` of the document.

## Identify a document

Every document has two names. Use the `id` in the paths of requests and the number when you talk to people.

| Field | What it is | Use it for |
| --- | --- | --- |
| `id` | A UUID, the same for the life of the document. | `documentId` in the path of every request on one document. |
| `number` | `DOC-YYYY-NNNN`: the year the document was created and a running number of four digits, for example `DOC-2026-0401`. | The audit trail, search and everything people say to each other. |

## Statuses and what moves them

A document has one `status`. Each status allows a few operations, and every other change is refused.

| Status | What moves it there | What you can do next | Operation |
| --- | --- | --- | --- |
| `draft` | Creation, or a return by an approver. | Change the properties, add a version, submit. | `updateProperties, reviseDocument, submitDocument` |
| `in-review` | Submitting the draft. | The next approver approves it or returns it. | `approveDocument, rejectDocument` |
| `approved` | The last approver of the route approves. | Send a contract or an offer for signature. Archive an invoice or a report. | `sendForSignature, archiveDocument` |
| `signed` | The last recipient signs. | Archive. | `archiveDocument` |
| `archived` | Archiving. | Read it. Every change is refused. | `getDocument` |

## Follow a contract to the archive

1.  Submit
    
    Send the draft with `submitDocument`. The `status` becomes `in-review` and `approval.route` lists the approvers.
    
2.  Approve
    
    Each approver of the route calls `approveDocument` in turn. After the last one the `status` is `approved`.
    
3.  Send for signature
    
    Call `sendForSignature` with the recipients. The `status` stays `approved` while the request is open.
    
4.  Collect the signatures
    
    The signing service reports each recipient. When every recipient has signed, the `status` is `signed`. A decline ends the request, the `status` stays `approved` and you send a new request.
    
5.  Archive
    
    Call `archiveDocument`. The `status` is `archived`.
    

An invoice or a report skips the signature: after the last approval it is archived directly.

## Return a document and revise it

`rejectDocument` takes a `reason` and puts the document back in `draft` with `returned` set. The route and the decisions of that round are cleared.

A returned draft cannot be submitted again as it is. Add a version with `reviseDocument`, which clears `returned`, and then submit.

curl

```bash
curl -X POST "$RDC_BASE_URL/documents/v1/documents/7e9127fe-ec9e-4863-baf0-4ca4177acc75/revise" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "45e4eb70-7f6e-4690-a7e9-f31d188116a4",
  "expectedRevision": 3,
  "by": "mihai-stan",
  "note": "Differences by aisle added.",
  "file": {
    "name": "stock-count-october-2026-v2.pdf",
    "mediaType": "application/pdf",
    "content": "JVBERi0xLjcKJeLjz9MKJSVFT0YK"
  }
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/7e9127fe-ec9e-4863-baf0-4ca4177acc75/revise`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "45e4eb70-7f6e-4690-a7e9-f31d188116a4",
    "expectedRevision": 3,
    "by": "mihai-stan",
    "note": "Differences by aisle added.",
    "file": {
      "name": "stock-count-october-2026-v2.pdf",
      "mediaType": "application/pdf",
      "content": "JVBERi0xLjcKJeLjz9MKJSVFT0YK"
    }
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/7e9127fe-ec9e-4863-baf0-4ca4177acc75/revise',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '45e4eb70-7f6e-4690-a7e9-f31d188116a4',
        'expectedRevision': 3,
        'by': 'mihai-stan',
        'note': 'Differences by aisle added.',
        'file': {
            'name': 'stock-count-october-2026-v2.pdf',
            'mediaType': 'application/pdf',
            'content': 'JVBERi0xLjcKJeLjz9MKJSVFT0YK',
        },
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "45e4eb70-7f6e-4690-a7e9-f31d188116a4",
  "expectedRevision": 3,
  "by": "mihai-stan",
  "note": "Differences by aisle added.",
  "file": {
    "name": "stock-count-october-2026-v2.pdf",
    "mediaType": "application/pdf",
    "content": "JVBERi0xLjcKJeLjz9MKJSVFT0YK"
  }
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/7e9127fe-ec9e-4863-baf0-4ca4177acc75/revise');
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/7e9127fe-ec9e-4863-baf0-4ca4177acc75/revise");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "45e4eb70-7f6e-4690-a7e9-f31d188116a4",
  "expectedRevision": 3,
  "by": "mihai-stan",
  "note": "Differences by aisle added.",
  "file": {
    "name": "stock-count-october-2026-v2.pdf",
    "mediaType": "application/pdf",
    "content": "JVBERi0xLjcKJeLjz9MKJSVFT0YK"
  }
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "45e4eb70-7f6e-4690-a7e9-f31d188116a4",
  "status": "accepted",
  "aggregateRevision": 4
}
```

## Revision and version

The two numbers count different things. A version is a file, and a revision is a line of the audit trail.

| Field | What it counts | What adds one | What you use it for |
| --- | --- | --- | --- |
| `version` | The files of the document. It starts at 1. | `reviseDocument`, on a draft. | Read the versions with `listVersions`. |
| `revision` | The lines of the audit trail. Creation is revision 1. | Every change: properties, a version, a submission, a decision, a signature request, a delivery, a signature, a decline and the archive. | Send it as `expectedRevision` with every change. |

A new version also adds a revision, but a change of properties adds a revision and no version. A delivery, a signature or a decline moves the revision without a request from you.

Read the document again before you change one that is out for signature. See [Idempotency and concurrency](https://documents.rdcopilot.com/docs/reference/idempotency/).

## When a change is refused

| Code | Cause | What to do |
| --- | --- | --- |
| `document_not_draft` | Properties, a version or a submission on a document that is not a draft. | Read the document. These changes need `draft`. |
| `revision_required` | A returned draft was submitted. | Add a version with `reviseDocument`, then submit. |
| `revision_conflict` | The `expectedRevision` is older than the document. | Read the document again, check that the change still applies and send it with the new `revision`. |
| `signature_required` | An approved contract or offer was archived. | Wait for the `status` `signed`. |
| `document_not_final` | A document that is neither approved (invoice, report) nor signed (contract, offer) was archived. | Wait until the document reaches that status. |
| `document_archived` | A change on an archived document. | Do not retry. Nothing changes on an archived document. |

Nothing is deleted through the API. An archived document stays until its keep-until date; see [Retention](https://documents.rdcopilot.com/docs/concepts/retention/).
