Skip to main content
The Compliance API lets Enterprise account admins retrieve retained prompt content associated with 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.
Prompt content can contain source code, secrets, personal data, or other sensitive information. Grant access only to approved systems and people, store the content according to your organization’s security and retention policies, and use the minimum required scope.

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 dedicated compliance: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

Use GET /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.
  1. Query a time window of 24 hours or less using occurredAfter and occurredBefore. Use UTC RFC 3339 timestamps ending in Z, with at most six fractional-second digits. The lower bound is inclusive and the upper bound is exclusive; both filter the event’s occurredAt, not when it became available.
  2. Follow the response’s pagination.cursor while pagination.hasMore is true. Cursors expire after one hour. If you send occurredAfter, occurredBefore, limit, or messageRef with a cursor, the values must match the original request.
  3. Poll with overlapping time windows to reduce the risk of missing events that arrive late. Remove duplicate events using eventId before storing or processing them.
The API does not provide a completion watermark or a guaranteed bound on late arrivals. Overlapping polling windows reduce the risk of missed events but cannot guarantee complete capture. Do not treat a completed page sequence as proof that every event in the time window has arrived.

Example use cases

  • Security investigations: Enrich project.message_sent audit 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.
  • Audit Logs: View, export, and stream security-relevant events from your Enterprise account.
  • Admin API: Access account usage, workspaces, members, and projects programmatically.