Retention settings control how long Audit Log events are stored before being permanently deleted. You can configure the retention period on a per-organization basis.
Get the configured event retention period for the given Organization.
curl "https://api.workos.com/organizations/org_01EHZNVPK3SFK441A1RGBFSHRT/audit_logs_retention" \ --header "Authorization: Bearer sk_example_123456789"
{ "retention_period_in_days": 30 }
| curl "https://api.workos.com/organizations/org_01EHZNVPK3SFK441A1RGBFSHRT/audit_logs_retention" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.audit_logs.get_organization_audit_logs_retention(id: "org_01EHZNVPK3SFK441A1RGBFSHRT") |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.audit_logs.get_organization_audit_logs_retention( | |
| id_="org_01EHZNVPK3SFK441A1RGBFSHRT" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v9" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.AuditLogs().GetOrganizationAuditLogsRetention(context.Background(), "org_01EHZNVPK3SFK441A1RGBFSHRT") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->auditLogs() | |
| ->getOrganizationAuditLogsRetention(id: "org_01EHZNVPK3SFK441A1RGBFSHRT"); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.auditLogs.getOrganizationAuditLogsRetention("org_01EHZNVPK3SFK441A1RGBFSHRT"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.AuditLogs.GetOrganizationAuditLogsRetentionAsync("org_01EHZNVPK3SFK441A1RGBFSHRT"); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::builder() | |
| .api_key("sk_example_123456789") | |
| .client_id("client_123456789") | |
| .build(); | |
| let _result = client | |
| .audit_logs() | |
| .get_organization_audit_logs_retention("org_01EHZNVPK3SFK441A1RGBFSHRT") | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "retention_period_in_days": 30 | |
| } |
GET/organizations /:id /audit_logs_retentionParameters Returns Set the event retention period for the given Organization.
curl --request PUT \ --url "https://api.workos.com/organizations/org_01EHZNVPK3SFK441A1RGBFSHRT/audit_logs_retention" \ --header "Authorization: Bearer sk_example_123456789" \ --header "Content-Type: application/json" \ -d @- <<'BODY' { "retention_period_in_days": 30 } BODY
{ "retention_period_in_days": 30 }
| curl --request PUT \ | |
| --url "https://api.workos.com/organizations/org_01EHZNVPK3SFK441A1RGBFSHRT/audit_logs_retention" \ | |
| --header "Authorization: Bearer sk_example_123456789" \ | |
| --header "Content-Type: application/json" \ | |
| -d @- <<'BODY' | |
| { | |
| "retention_period_in_days": 30 | |
| } | |
| BODY |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.audit_logs.update_organization_audit_logs_retention( | |
| id: "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| retention_period_in_days: 30 | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.audit_logs.update_organization_audit_logs_retention( | |
| id_="org_01EHZNVPK3SFK441A1RGBFSHRT", retention_period_in_days=30 | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v9" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.AuditLogs().UpdateOrganizationAuditLogsRetention(context.Background(), "org_01EHZNVPK3SFK441A1RGBFSHRT", &workos.AuditLogsUpdateOrganizationAuditLogsRetentionParams{ | |
| RetentionPeriodInDays: 30, | |
| }) | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->auditLogs() | |
| ->updateOrganizationAuditLogsRetention( | |
| id: "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| retentionPeriodInDays: 30, | |
| ); |
| import com.workos.WorkOS; | |
| import com.workos.auditlogs.AuditLogsApi.UpdateOrganizationAuditLogsRetentionOptions; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| UpdateOrganizationAuditLogsRetentionOptions options = | |
| UpdateOrganizationAuditLogsRetentionOptions.builder() | |
| .retentionPeriodInDays(30) | |
| .build(); | |
| workos.auditLogs.updateOrganizationAuditLogsRetention( | |
| "org_01EHZNVPK3SFK441A1RGBFSHRT", options); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.AuditLogs.UpdateOrganizationAuditLogsRetentionAsync( | |
| "org_01EHZNVPK3SFK441A1RGBFSHRT", new AuditLogsUpdateOrganizationAuditLogsRetentionOptions { | |
| RetentionPeriodInDays = 30, | |
| }); |
| use workos::Client; | |
| use workos::audit_logs::UpdateOrganizationAuditLogsRetentionParams; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::builder() | |
| .api_key("sk_example_123456789") | |
| .client_id("client_123456789") | |
| .build(); | |
| let _result = client | |
| .audit_logs() | |
| .update_organization_audit_logs_retention( | |
| "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| UpdateOrganizationAuditLogsRetentionParams { | |
| retention_period_in_days: 30, | |
| ..Default::default() | |
| } | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "retention_period_in_days": 30 | |
| } |
PUT/organizations /:id /audit_logs_retentionParameters Returns