Skip to main content
Download the retained events in an audit snapshot to audit.ndjson. You can use the file as input to Splunk or another SIEM. See Audit export rules for cursor validity, throttling, and self-hosted setup.

Before you start

  • Grant the key’s owner View audit history (audit.view) in the target organization, then create an API key.
  • Make sure audit visibility is enabled on Den API (DEN_AUDIT_VISIBILITY_ENABLED, on by default).
  • Set DEN_API_URL to https://api.openworklabs.com for Cloud or to your own Den API base URL for self-hosted. Set DEN_API_KEY to the organization key. The requests send it as x-api-key, with no Bearer prefix.

Follow the cursor

  1. Call GET /v1/audit/export without cursor.
  2. Read X-Audit-Next-Cursor from the successful response headers, not from the NDJSON or CSV body. If present, URL-encode its full value as the next request’s cursor.
  3. Stop when a successful response omits X-Audit-Next-Cursor. An empty result or a final page with exactly limit events can both end the export.
To inspect the first page, save its headers separately from the data:

Download every NDJSON page

Save the script as export-audit.sh in a new directory and run bash export-audit.sh. It appends successful pages to audit.ndjson.partial and saves the next cursor in audit.cursor. When it finishes, use the final audit.ndjson file as your SIEM input. Keep the files and error output private.
To filter the download, add the same --data-urlencode options to args on every iteration. See the generated audit export reference for the available filters. To download CSV instead, start without a cursor and add --data-urlencode 'format=csv' to the single-page command. See Combine pages before saving or joining CSV pages.

Resume after an error

  • Request failed: Fix the error, then run bash export-audit.sh from the same directory with the same filters. The script loads audit.cursor and appends the remaining pages. For your own client, save the next cursor only after processing the current page.
  • Throttled: Leave the key idle for longer than its throttling window, then rerun the script. It retries a 401 once after 61 seconds. If 401 persists, check the key and its settings before trying again.
  • Cursor expired or filters changed: Start in a new directory without a cursor. See Keep pages in the same snapshot.
  • Interrupted while writing a page: Check the partial output for an incomplete or duplicate page before using it.

Check a self-hosted proxy

If you expect another page, inspect the headers with curl --dump-header - in place of --dump-header page.headers in the first-page command. If the cursor is missing, check the self-hosted proxy rules. See How export snapshots and cursors work for what a snapshot includes and why it is not a continuous feed.