> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.staple.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.staple.ai/_mcp/server.

# List Document Set Audit Trail

GET https://api.staple.io/reconciliation/v1/document-sets/{id}/audit

Returns who did what to one document set, newest first: force accepts, withdrawals, system releases and other audited actions. The log is append-only.

Each entry has an `action` (`<category>.<verb>`, see List Audit Actions), the `actor` (a user, or `is_system: true`), an optional `reason`, `comment` or system `cause`, and the `targets` it touched with their `before` and `after` state.

Page with `next_cursor`: pass it back as `cursor` until it is `null`. `counts` gives the number of entries per action and ignores the `action` and `category` filters, so it can drive filter chips.

Requires reconciliation v2 on the organisation; other tenants receive `404`.

Reference: https://docs.staple.ai/api-reference/v2/reconciliation/list-document-set-audit-trail

## Authentication

- `x-api-key` header (required) — API key issued by Staple.
- `Authorization` header (bearer token, required) — JWT obtained from the login endpoint.

## Request

### Path parameters

- `id` (string, required) — Document set ID (`document_set_id` from List Document Sets), URL-encoded.

### Query parameters

- `action` (list of string, optional) — Filter by action, for example `force_accept.accepted`. Repeat the parameter or pass a comma-separated list. Combined with `category` by OR.
- `category` (list of string, optional) — Filter by action category (the part before the dot), for example `force_accept`.
- `from` (datetime, optional) — Only entries at or after this time (ISO 8601 date-time).
- `to` (datetime, optional) — Only entries at or before this time (ISO 8601 date-time).
- `user_id` (integer, optional) — Only entries performed by this user ID.
- `cursor` (string, optional) — `next_cursor` from the previous page.
- `limit` (integer, optional, default: 50) — Page size. Defaults to 50 and is capped at 200.

## Response

### 200

OK

## Examples

**Response**

```json
{
  "counts": {
    "force_accept.accepted": 1
  },
  "items": [
    {
      "action": "force_accept.accepted",
      "action_label": "Force Accept",
      "actor": {
        "email": "ap.controller@example.com",
        "id": "4821",
        "is_system": false,
        "name": "Priya Shah"
      },
      "category": "force_accept",
      "cause": null,
      "comment": "Delivery note follows by post",
      "entry_id": "5f6e7d8c-0000-4000-8000-0000000000e1",
      "metadata": {},
      "reason": {
        "code": "approved_exception",
        "label": "Approved exception",
        "text": "Approved by AP lead"
      },
      "targets": [
        {
          "after": "RECONCILED",
          "attributes": {
            "comparison_rule_id": "b3c1d2e4-0000-4000-8000-0000000000b2",
            "primary_field": "Delivery note number",
            "primary_group": "Invoice",
            "primary_value": "DN-500",
            "secondary_field": "Number",
            "secondary_group": "Delivery note",
            "secondary_value": ""
          },
          "before": "NOT_FOUND",
          "id": "pair-1",
          "kind": "comparison_pair",
          "name": "Delivery note number"
        }
      ],
      "timestamp": "2026-01-11T08:15:00Z"
    }
  ],
  "next_cursor": null,
  "total_count": 1
}
```

**SDK Code**

```python Document Set Audit Trail
import requests

url = "https://api.staple.io/reconciliation/v1/document-sets/ds%3A7c2a1b90-4d3e-4f81-9a0c-11b2c3d4e5f6%3A500/audit"

querystring = {"action":"[\"force_accept.accepted\"]","category":"[\"force_accept\"]","from":"2026-01-01T00:00:00Z","limit":"50","to":"2026-01-31T23:59:59Z","user_id":"4821"}

headers = {"x-api-key": "<apiKey>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Document Set Audit Trail
const url = 'https://api.staple.io/reconciliation/v1/document-sets/ds%3A7c2a1b90-4d3e-4f81-9a0c-11b2c3d4e5f6%3A500/audit?action=%5B%22force_accept.accepted%22%5D&category=%5B%22force_accept%22%5D&from=2026-01-01T00%3A00%3A00Z&limit=50&to=2026-01-31T23%3A59%3A59Z&user_id=4821';
const options = {method: 'GET', headers: {'x-api-key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Document Set Audit Trail
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.staple.io/reconciliation/v1/document-sets/ds%3A7c2a1b90-4d3e-4f81-9a0c-11b2c3d4e5f6%3A500/audit?action=%5B%22force_accept.accepted%22%5D&category=%5B%22force_accept%22%5D&from=2026-01-01T00%3A00%3A00Z&limit=50&to=2026-01-31T23%3A59%3A59Z&user_id=4821"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Document Set Audit Trail
require 'uri'
require 'net/http'

url = URI("https://api.staple.io/reconciliation/v1/document-sets/ds%3A7c2a1b90-4d3e-4f81-9a0c-11b2c3d4e5f6%3A500/audit?action=%5B%22force_accept.accepted%22%5D&category=%5B%22force_accept%22%5D&from=2026-01-01T00%3A00%3A00Z&limit=50&to=2026-01-31T23%3A59%3A59Z&user_id=4821")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Document Set Audit Trail
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.staple.io/reconciliation/v1/document-sets/ds%3A7c2a1b90-4d3e-4f81-9a0c-11b2c3d4e5f6%3A500/audit?action=%5B%22force_accept.accepted%22%5D&category=%5B%22force_accept%22%5D&from=2026-01-01T00%3A00%3A00Z&limit=50&to=2026-01-31T23%3A59%3A59Z&user_id=4821")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Document Set Audit Trail
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.staple.io/reconciliation/v1/document-sets/ds%3A7c2a1b90-4d3e-4f81-9a0c-11b2c3d4e5f6%3A500/audit?action=%5B%22force_accept.accepted%22%5D&category=%5B%22force_accept%22%5D&from=2026-01-01T00%3A00%3A00Z&limit=50&to=2026-01-31T23%3A59%3A59Z&user_id=4821', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Document Set Audit Trail
using RestSharp;

var client = new RestClient("https://api.staple.io/reconciliation/v1/document-sets/ds%3A7c2a1b90-4d3e-4f81-9a0c-11b2c3d4e5f6%3A500/audit?action=%5B%22force_accept.accepted%22%5D&category=%5B%22force_accept%22%5D&from=2026-01-01T00%3A00%3A00Z&limit=50&to=2026-01-31T23%3A59%3A59Z&user_id=4821");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Document Set Audit Trail
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/reconciliation/v1/document-sets/ds%3A7c2a1b90-4d3e-4f81-9a0c-11b2c3d4e5f6%3A500/audit?action=%5B%22force_accept.accepted%22%5D&category=%5B%22force_accept%22%5D&from=2026-01-01T00%3A00%3A00Z&limit=50&to=2026-01-31T23%3A59%3A59Z&user_id=4821")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```