# Document Retrieval

Download documents (PDFs) associated with entities. Documents are official registry extracts and filings retrieved during searches.

## Get Document

### Request

```
GET https://api.revolutio.systems/document/{documentId}
```

**Headers**

| Header          | Value              |
| --------------- | ------------------ |
| `Authorization` | `Bearer <idToken>` |

**Path Parameters**

| Parameter    | Type   | Description     |
| ------------ | ------ | --------------- |
| `documentId` | string | The document ID |

### Response

{% tabs %}
{% tab title="200 OK" %}
Returns the PDF file directly with appropriate headers:

```
Content-Type: application/pdf
Content-Disposition: inline; filename="document-name.pdf"
```

The response body is the binary PDF content.
{% endtab %}

{% tab title="400 Bad Request" %}

```json
{
  "error": "Missing documentId"
}
```

{% endtab %}

{% tab title="404 Not Found" %}

```json
{
  "error": "Document not found"
}
```

Or if the file has not yet been stored:

```json
{
  "error": "File not found"
}
```

{% endtab %}
{% endtabs %}

### Example (cURL)

```bash
# Download and save as PDF
curl -s https://api.revolutio.systems/document/abc123-doc-id \
  -H "Authorization: Bearer $TOKEN" \
  -o document.pdf
```

## Finding Document IDs

Document IDs are returned as part of the [Entity](broken://pages/a1f079420cfafe7050fd08dd98a2250aa71261fe) response within the `sourceDocuments` array:

```json
{
  "sourceDocuments": [
    {
      "_documentID": "abc123-doc-id",
      "_entityID": "entity-uuid",
      "dateRetrieved": "2025-01-15",
      "name": "Certificate of Incorporation",
      "source": "Companies House",
      "url": "https://registry-url.example.com/doc/123"
    }
  ]
}
```

Use the `_documentID` value as the `documentId` path parameter.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://equinoxe-systems.gitbook.io/revolutio-api/document-retrieval.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
