> ## Documentation Index
> Fetch the complete documentation index at: https://developers.circularo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Collect the evidence of a signed document

Circularo records everything that happens to a document, and hands it back in three forms: a timeline you can read, a sealed audit trail, and the certificate that closes a finished transaction. This guide collects all three in three calls.

## Before you begin

* **A document with something to show.** The examples use an agreement that was sent to a signer and signed.

## Step 1: Read the timeline

The history is the machine-readable view — what happened, when, and to whom:

```http Request theme={null}
GET /documents/pXq4NcYBhK9tWdA2mFzR/history
Authorization: Bearer YOUR_API_KEY
```

```http Response theme={null}
HTTP/2 200

{
  "pagination": null,
  "results": [
    {
      "actor": {
        "email": "jane.doe@example.com",
        "fullname": "Jane Doe",
        "userId": "jane.doe@example.com"
      },
      "message": null,
      "occurredAt": "2026-05-11T09:36:00.000Z",
      "recipients": [
        {
          "email": "jane.doe@example.com",
          "fullname": "Jane Doe",
          "userId": "jane.doe@example.com"
        }
      ],
      "renewal": null,
      "type": "completed"
    },
    {
      "actor": {
        "email": "jane.doe@example.com",
        "fullname": "Jane Doe",
        "userId": "jane.doe@example.com"
      },
      "message": null,
      "occurredAt": "2026-05-11T09:34:00.000Z",
      "recipients": [
        {
          "email": "jane.doe@example.com",
          "fullname": "Jane Doe",
          "userId": "jane.doe@example.com"
        }
      ],
      "renewal": null,
      "type": "signed"
    },
    {
      "actor": {
        "email": "john.smith@example.com",
        "fullname": "John Smith",
        "userId": "john.smith@example.com"
      },
      "message": "Please sign your employment agreement.",
      "occurredAt": "2026-05-11T09:32:00.000Z",
      "recipients": [
        {
          "email": "jane.doe@example.com",
          "fullname": "Jane Doe",
          "userId": "jane.doe@example.com"
        }
      ],
      "renewal": null,
      "type": "shared"
    },
    {
      "actor": {
        "email": "john.smith@example.com",
        "fullname": "John Smith",
        "userId": "john.smith@example.com"
      },
      "message": null,
      "occurredAt": "2026-05-11T09:30:00.000Z",
      "recipients": [],
      "renewal": null,
      "type": "created"
    }
  ],
  "total": 4,
  ...
}
```

A few things to notice:

* Events come newest first, and the whole timeline is returned at once — `pagination` is `null`, so there is nothing to page through.
* `type` says what happened. The document above was created, shared with a recipient, signed by them, and then the transaction completed.
* `actor` is who performed the action, or `null` when Circularo raised the event itself. `recipients` names the people an event concerns, and is empty for events about the document alone.
* `message` carries the note that went with the action — here the message sent along with the invitation.

Use this when your own system needs to react to what happened, or to show a progress trail in your interface.

## Step 2: Download the audit trail

The audit trail is the same story as a sealed PDF, meant to be archived or handed to somebody outside:

```http Request theme={null}
GET /documents/pXq4NcYBhK9tWdA2mFzR/audit-trail
Authorization: Bearer YOUR_API_KEY
```

```http Response theme={null}
HTTP/2 200
Content-Type: application/pdf
```

The body is the PDF itself. You can ask for it at any point in the document's life, except while it is in the trash (`409`) — it captures the history as it stands at that moment, so a document still being signed produces a valid, partial trail.

> [!NOTE]
>
> An audit trail belongs to one document. The organization-wide record of who did what across your organization is a different thing — the audit logs of [Search the audit logs](https://developers.circularo.com/guides/administration/audit-logs.md).

## Step 3: Download the certificate of fulfillment

Once every recipient has acted, the transaction can be certified as fulfilled:

```http Request theme={null}
GET /documents/pXq4NcYBhK9tWdA2mFzR/certificate-of-fulfillment
Authorization: Bearer YOUR_API_KEY
```

```http Response theme={null}
HTTP/2 200
Content-Type: application/pdf
```

The body is a PDF again, this time a closing statement rather than a running record — which is why it exists only for a transaction that has finished. Ask for it earlier, while recipients are still acting or before the document was ever sent, or while the document is in the trash, and the answer is `409`.

## Complete example

Collecting all three, as a Node.js script. Error handling is minimal for brevity — in production, inspect the error envelope of non-2xx responses.

```js theme={null}
import fs from "node:fs/promises";

// your environment's base URL
const BASE_URL = "https://sandbox.circularo.com/api/v2";
const API_KEY = "YOUR_API_KEY";
const AUTH_HEADER = { "Authorization": `Bearer ${API_KEY}` };
const documentId = "pXq4NcYBhK9tWdA2mFzR"; // the finished document

const history = await (await fetch(`${BASE_URL}/documents/${documentId}/history`, { headers: AUTH_HEADER })).json();
for (const event of history.results.slice().reverse()) {
  console.log(`${event.occurredAt} ${event.type} ${event.actor?.email ?? "system"}`);
}

const download = async (path, target) => {
  const res = await fetch(`${BASE_URL}/documents/${documentId}/${path}`, { headers: AUTH_HEADER });
  // error handling kept minimal for brevity
  if (!res.ok) throw new Error(`${path} failed: ${res.status}`);
  await fs.writeFile(target, Buffer.from(await res.arrayBuffer()));
};

await download("audit-trail", "audit-trail.pdf");
await download("certificate-of-fulfillment", "certificate.pdf");
```

## Next steps

* Download the signed document these certificates describe — [Upload and download files](https://developers.circularo.com/guides/documents-and-files/files.md).
* Watch a transaction reach the status that unlocks the certificate — [Manage a running transaction](https://developers.circularo.com/guides/signing/manage-transaction.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.