curl --request GET \
--url https://api.openworklabs.com/v1/audit/export \
--header 'x-api-key: <api-key>'import requests
url = "https://api.openworklabs.com/v1/audit/export"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.openworklabs.com/v1/audit/export', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openworklabs.com/v1/audit/export",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.openworklabs.com/v1/audit/export"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.openworklabs.com/v1/audit/export")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openworklabs.com/v1/audit/export")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body"<string>"{
"error": "audit_invalid_query"
}{
"error": "unauthorized"
}{
"error": "forbidden",
"message": "<string>",
"code": "requires_admin",
"retryable": false,
"action_url": "<string>",
"requiredPermission": "audit.view"
}{
"error": "organization_not_found"
}{
"error": "audit_cursor_expired"
}{
"error": "audit_unavailable"
}Export one audit snapshot page
Requires View audit history (audit.view) and deployment audit visibility. For scripts, send an organization API key in x-api-key without a Bearer prefix; its owner must be a current member with that permission.
Exports retained, structured events only; not every cloud action is recorded. Omitted filters impose no restriction; supplied filters combine with AND.
Read X-Audit-Next-Cursor from the response headers, not the body. Pass it as cursor; stop when a successful response omits the header, even if the page is full.
Download audit history with the API · Audit export rules · How export snapshots and cursors work.
curl --request GET \
--url https://api.openworklabs.com/v1/audit/export \
--header 'x-api-key: <api-key>'import requests
url = "https://api.openworklabs.com/v1/audit/export"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.openworklabs.com/v1/audit/export', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openworklabs.com/v1/audit/export",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.openworklabs.com/v1/audit/export"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.openworklabs.com/v1/audit/export")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openworklabs.com/v1/audit/export")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body"<string>"{
"error": "audit_invalid_query"
}{
"error": "unauthorized"
}{
"error": "forbidden",
"message": "<string>",
"code": "requires_admin",
"retryable": false,
"action_url": "<string>",
"requiredPermission": "audit.view"
}{
"error": "organization_not_found"
}{
"error": "audit_cursor_expired"
}{
"error": "audit_unavailable"
}Authorizations
Query Parameters
Inclusive lower bound on the operation's first-recorded time; unbounded when omitted. Use YYYY-MM-DD (UTC midnight) or YYYY-MM-DDTHH:MM:SS[.fraction] followed by Z or ±HH:MM, e.g. 2026-11-01T00:00:00+08:00. Seconds and a time zone are required for date-times; numeric offsets must include a colon. from must not be later than to.
Inclusive upper bound on the operation's first-recorded time; unbounded when omitted. Use YYYY-MM-DD (UTC midnight) or YYYY-MM-DDTHH:MM:SS[.fraction] followed by Z or ±HH:MM, e.g. 2026-11-01T00:00:00+08:00. Seconds and a time zone are required for date-times; numeric offsets must include a colon. from must not be later than to.
Response
One attachment page of retained, structured child events from matching operations, ordered by ascending event ID. Content-Type is application/x-ndjson; charset=utf-8 for NDJSON or text/csv; charset=utf-8 for CSV.
One complete audit event envelope per line, or an empty body when no events match.
Was this page helpful?