project.message_sent audit events. Use it to enrich exported or streamed audit logs when an authorized security or compliance workflow needs a prompt’s full text.
Who can access the Compliance API
The Compliance API is available only to account admins on Enterprise accounts. Workspace admins and other account members cannot create API keys with Compliance API access or retrieve prompt content. To learn more about Enterprise admin roles, see Account and Workspace Admins.Create an API key
For new integrations, grant the dedicatedcompliance:messages:read scope. General read access, including read:*, does not grant access to customer prompt content. Existing keys with the legacy audit-logs:read scope remain valid.
1
Open Developer settings
Open Settings. Under Account, select Developer.
2
Create an API key
Select Create API key, give the key a descriptive name, and choose an
expiration appropriate for your security policy.
3
Grant message access
Under Messages, select Read. Confirm that the key includes the
compliance:messages:read scope.4
Store the key securely
Copy the key, which begins with
rpl_, and store it in a secure secret
manager. The key is displayed only once. Treat it like a password and never
share it, paste it into chat, or commit it to source control.5
Authenticate your integration
Send the key as a Bearer token with requests to the Compliance API.
Collect prompt content
UseGET /v1/compliance/messages to retrieve retained prompt events for the account associated with your API key. You cannot select a different account in the request.
- Query a time window of 24 hours or less using
occurredAfterandoccurredBefore. Use UTC RFC 3339 timestamps ending inZ, with at most six fractional-second digits. The lower bound is inclusive and the upper bound is exclusive; both filter the event’soccurredAt, not when it became available. - Follow the response’s
pagination.cursorwhilepagination.hasMoreistrue. Cursors expire after one hour. If you sendoccurredAfter,occurredBefore,limit, ormessageRefwith a cursor, the values must match the original request. - Poll with overlapping time windows to reduce the risk of missing events that arrive late. Remove duplicate events using
eventIdbefore storing or processing them.
Example use cases
- Security investigations: Enrich
project.message_sentaudit events with full customer prompt text so authorized responders can reconstruct incidents, identify prompt-injection or data-exfiltration attempts, and determine affected projects and users. - Compliance monitoring: Inspect prompt content for regulated data, secrets, or policy violations, then route findings into DLP, SIEM, retention, and eDiscovery workflows with the original audit metadata intact.
API reference
For the endpoint path, query parameters, response schema, pagination behavior, and examples, see the Compliance API developer documentation.Related documentation
- Audit Logs: View, export, and stream security-relevant events from your Enterprise account.
- Admin API: Access account usage, workspaces, members, and projects programmatically.