Update retention policy
curl --request PUT \
--url https://api.truthlocks.com/v1/audit/retention \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"retention_days": 123,
"hard_delete": true,
"export_allowed": true,
"environment_id": "<string>"
}
'import requests
url = "https://api.truthlocks.com/v1/audit/retention"
payload = {
"retention_days": 123,
"hard_delete": True,
"export_allowed": True,
"environment_id": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
retention_days: 123,
hard_delete: true,
export_allowed: true,
environment_id: '<string>'
})
};
fetch('https://api.truthlocks.com/v1/audit/retention', 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.truthlocks.com/v1/audit/retention",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'retention_days' => 123,
'hard_delete' => true,
'export_allowed' => true,
'environment_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/audit/retention"
payload := strings.NewReader("{\n \"retention_days\": 123,\n \"hard_delete\": true,\n \"export_allowed\": true,\n \"environment_id\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.truthlocks.com/v1/audit/retention")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"retention_days\": 123,\n \"hard_delete\": true,\n \"export_allowed\": true,\n \"environment_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.truthlocks.com/v1/audit/retention")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"retention_days\": 123,\n \"hard_delete\": true,\n \"export_allowed\": true,\n \"environment_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"retention_days": 123,
"hard_delete": true,
"updated_at": "<string>"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Audit & Logs
Update retention policy
Update the audit log retention policy for the authenticated tenant.
PUT
/
v1
/
audit
/
retention
Update retention policy
curl --request PUT \
--url https://api.truthlocks.com/v1/audit/retention \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"retention_days": 123,
"hard_delete": true,
"export_allowed": true,
"environment_id": "<string>"
}
'import requests
url = "https://api.truthlocks.com/v1/audit/retention"
payload = {
"retention_days": 123,
"hard_delete": True,
"export_allowed": True,
"environment_id": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
retention_days: 123,
hard_delete: true,
export_allowed: true,
environment_id: '<string>'
})
};
fetch('https://api.truthlocks.com/v1/audit/retention', 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.truthlocks.com/v1/audit/retention",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'retention_days' => 123,
'hard_delete' => true,
'export_allowed' => true,
'environment_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/audit/retention"
payload := strings.NewReader("{\n \"retention_days\": 123,\n \"hard_delete\": true,\n \"export_allowed\": true,\n \"environment_id\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.truthlocks.com/v1/audit/retention")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"retention_days\": 123,\n \"hard_delete\": true,\n \"export_allowed\": true,\n \"environment_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.truthlocks.com/v1/audit/retention")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"retention_days\": 123,\n \"hard_delete\": true,\n \"export_allowed\": true,\n \"environment_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"retention_days": 123,
"hard_delete": true,
"updated_at": "<string>"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Updates the retention policy that controls how long audit logs are kept and what happens when they expire. Requires the
tenant.audit.retention.manage permission.
Parameters
integer
required
Number of days to retain audit logs. Must be between 30 and 3,650.
boolean
If
true, permanently delete expired logs. If false, archive them (soft delete). Defaults to false.boolean
Whether audit exports are permitted for this scope. Defaults to
true.string
Optional. Apply this policy to a specific environment only. Environment-specific policies take precedence over the global policy.
Responses
Authorizations
API key for machine-to-machine authentication
Body
application/json

