---
title: "Documents | Docs | Private AI Workspace by R&D Copilot"
description: "Read the documents resources and their request and response fields."
canonical: "https://private-ai.rdcopilot.com/docs/api-reference/documents/"
language: en
updated: 2026-11-22
---

# Documents

Read the documents resources and their request and response fields.

## List files and indexing states

GET `/private-ai/v1/documents`

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `limit` | query | `integer` | Nooptional | Records per page. Default `100` Range `1` – `500` |
| `cursor` | query | `string` | Nooptional | Opaque cursor from the preceding page. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `200` | Current record state. | `DocumentPage` |
| `401` | unauthorized | `Error` |
| `403` | forbidden | `Error` |
| `404` | Record not found in this installation. | `Error` |
| `429` | rate\_limited | `Error` |
| `503` | unavailable | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/private-ai/v1/documents?limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/private-ai/v1/documents?limit=20`, {
  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"]}/private-ai/v1/documents?limit=20',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/private-ai/v1/documents?limit=20');
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")}/private-ai/v1/documents?limit=20");
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
{
  "items": [
    {
      "id": "doc-procedure",
      "spaceId": "warehouse",
      "title": "Receiving procedure",
      "status": "ready",
      "revision": 1,
      "readable": true,
      "attempt": 1,
      "error": null
    },
    {
      "id": "doc-scan",
      "spaceId": "warehouse",
      "title": "Receiving checklist",
      "status": "failed",
      "revision": 1,
      "readable": false,
      "attempt": 1,
      "error": "unreadable_file"
    },
    {
      "id": "doc-delivery",
      "spaceId": "warehouse",
      "title": "Delivery instructions",
      "status": "ready",
      "revision": 1,
      "readable": true,
      "attempt": 1,
      "error": null
    },
    {
      "id": "doc-finance",
      "spaceId": "finance",
      "title": "Payment review",
      "status": "ready",
      "revision": 1,
      "readable": true,
      "attempt": 1,
      "error": null
    }
  ],
  "nextCursor": null
}
```

## Read a file record

GET `/private-ai/v1/documents/{documentId}`

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `documentId` | path | `string` | Yesrequired | Record identifier. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `200` | Current record state. | `Document` |
| `401` | unauthorized | `Error` |
| `403` | forbidden | `Error` |
| `404` | Record not found in this installation. | `Error` |
| `429` | rate\_limited | `Error` |
| `503` | unavailable | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/private-ai/v1/documents/doc-procedure" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/private-ai/v1/documents/doc-procedure`, {
  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"]}/private-ai/v1/documents/doc-procedure',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/private-ai/v1/documents/doc-procedure');
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")}/private-ai/v1/documents/doc-procedure");
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
{
  "id": "doc-procedure",
  "spaceId": "warehouse",
  "title": "Receiving procedure",
  "status": "ready",
  "revision": 1,
  "readable": true,
  "attempt": 1,
  "error": null
}
```

## Index a file again

POST `/private-ai/v1/documents/{documentId}/index`

Administrator access and space permission are required. Only ready or failed files can return to queued. Queued or indexing files refuse another start with invalid\_transition. The attempt increases so stale worker completions cannot replace the new result. A parsing failure ends in failed with unreadable\_file.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `documentId` | path | `string` | Yesrequired | Record identifier. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A new UUID for a new intent; reuse it after a timeout. |
| `expectedRevision` | `integer` | Yesrequired | The revision you last read. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The operation was accepted. | `OperationResult` |
| `400` | invalid\_request | `Error` |
| `401` | unauthorized | `Error` |
| `403` | forbidden | `Error` |
| `404` | record\_not\_found | `Error` |
| `409` | revision\_conflict | `Error` |
| `422` | invalid\_transition | `Error` |
| `429` | rate\_limited | `Error` |
| `503` | unavailable | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/private-ai/v1/documents/doc-procedure/index" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "8a000001-0000-4000-8000-000000000001",
  "expectedRevision": 1
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/private-ai/v1/documents/doc-procedure/index`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "8a000001-0000-4000-8000-000000000001",
    "expectedRevision": 1
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/private-ai/v1/documents/doc-procedure/index',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '8a000001-0000-4000-8000-000000000001',
        'expectedRevision': 1,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "8a000001-0000-4000-8000-000000000001",
  "expectedRevision": 1
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/private-ai/v1/documents/doc-procedure/index');
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")}/private-ai/v1/documents/doc-procedure/index");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "8a000001-0000-4000-8000-000000000001",
  "expectedRevision": 1
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "8a000001-0000-4000-8000-000000000001",
  "status": "accepted",
  "aggregateId": "doc-procedure",
  "aggregateRevision": 2
}
```
