Log in Create workspace
Skip to content

API reference

Operator - Data Controls

Run governed exports, deletion requests, and retention purges for one workspace.

Jump to 4 endpoints
On this page

Overview

Data controls provide auditable workspace-level privacy operations over stored traces, eval runs, and related datasets. Exports and deletions return recorded request summaries so an operator can verify what was included or removed.

Requests are evidence
The list returns id, event_id, kind, event_type, status, metadata, occurred_at, and inserted_at. Arguments, deletion boundaries, and result counts are inside metadata; keep the ID for later review.
Retention and targeted deletion differ
A deletion request applies an explicit dataset and older_than_days boundary. The manual purge executes and writes its audit result only when auto_purge_enabled is true; otherwise it returns a skipped result without a purge audit. Neither operation is an undoable preview.
Fleet evidence windows run separately
Workspace settings include location_retention_days (90 default) and work_order_evidence_retention_days (400 default), both limited to positive whole days up to 36,500. They are not gated by auto_purge_enabled, which applies to trace/eval purge. Current robot position and geofence state, terminal work-order summary, and immutable audit history are retained separately. Processed geofence outbox rows have a fixed 14-day window; pending rows are recovered, not purged.
Marketplace evidence is held
A trace bound to a marketplace engagement is the record a dispute over that hiring is settled on. Neither a deletion request nor a retention purge removes it while the engagement is active or the marketplace reports it open or disputed. A settled hire can still be disputed and an unclassified one can still receive its outcome, so those are held for 90 days after the later of the close and the last commercial change; a refunded one is not held. The result reports how many matching traces were kept as held.traces.

Before you begin

  • A signed-in browser session with a selected workspace backed by an active membership is required; an archived workspace remains readable but rejects mutations. Every /api/v1/operator endpoint rejects API credentials and bearer tokens, regardless of their scopes.
  • Any role on an active membership can read prior data requests. Owner or admin membership is required to create exports, request deletion, or run a manual retention purge.
  • Choose the dataset, age boundary, format, limit, and audit inclusion before starting. JSON exports are enabled by default; CSV works only when workspace export_formats enables csv.

How it works

  1. Review history first

    Read recent request status and metadata first to avoid duplicate exports or deletions over the same range.

  2. Execute through a protected client

    Use /app/workspace only to edit retention and export settings. To create an export or deletion request, or run a purge, call the matching operator route from a same-origin CSRF-aware client. Save the immediate result and verify its counts before closing the privacy request. Read-only GET requests do not need a CSRF token. A mutating operator request needs the browser session cookie and current Phoenix CSRF token supplied by the product UI or another authorized same-origin client; do not substitute bearer authentication.

Examples

These examples are illustrative. Replace the sample values with your own. Keep credentials in environment variables or a secret manager, never in client-side code.

Read recent privacy operations

The optional limit accepts 1 through 200; invalid values fall back to 50.

javascript
const response = await fetch("/api/v1/operator/data_requests?limit=25", {
  credentials: "same-origin",
  headers: {"Accept": "application/json"}
});
const body = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${body.detail}`);
console.log(body);
What to expect

200 OK. The wrapper is {"data_requests": []} when no governed operation has been recorded; each populated row has id, event_id, kind, event_type, status, metadata, occurred_at, and inserted_at.

Troubleshooting

A deletion count is lower than expected
Recheck dataset eligibility and older_than_days. Audit records are governed separately and are included only where the dataset and include-audit option permit it.
Mutation returns 403
Only owners and admins may use these management paths. An archived workspace is read-only and returns the workspace_archived problem code.

Endpoint reference

Ready to integrate? Open an endpoint for its required permissions, request fields, response format, and status codes. The examples above explain the workflow; these details define each individual request.

GET
/api/v1/operator/data_requests Web Session

List data export/deletion requests

Description

Returns recent data export, deletion, and retention purge audit records for the current workspace.

Auth

Web Session
Parameters
Name In Type Required Description
limit query integer No Maximum requests to return
Responses
200

List of data control requests

Returns: DataRequestList

POST
/api/v1/operator/data_exports Web Session

Create data export

Description

Creates and executes a workspace data export request with optional format and payload limits. JSON is enabled by default; CSV is accepted only when workspace data_controls.export_formats allowlists csv.

Auth

Web Session
Request Body
Field Type Required Description
data_export object Yes Data export attributes
data_export.format string No Export format (json by default; csv only when workspace export_formats allows it)
data_export.limit integer No Max records per dataset
data_export.include_audit_logs boolean No Include audit events in exported payload
Responses
201

Export completed

Returns: DataRequest

400

Invalid export payload

POST
/api/v1/operator/deletion_requests Web Session

Create deletion request

Description

Creates and executes a deletion request across traces, eval runs, and optionally audit events. The all dataset also deletes webhook deliveries, which keep the event payloads they sent. A trace bound to a marketplace engagement is held, not deleted, while its outcome can still be contested: while the engagement is active or its commercial state is open or disputed, and for 90 days after the later of the close and the last commercial change when it is settled or was never classified. A refunded engagement's trace is not held. held.traces reports how many matching traces were kept for that reason.

Auth

Web Session
Request Body
Field Type Required Description
deletion_request object Yes Deletion request attributes
deletion_request.include_audit_logs boolean No When true and dataset allows, includes audit event deletion
deletion_request.dataset string (traces, eval_runs, audit_events, all) Yes Dataset to delete
deletion_request.older_than_days integer No Delete records older than this many days
Responses
201

Deletion completed

Returns: DataRequest

400

Invalid deletion payload

POST
/api/v1/operator/data_retention/purge Web Session

Run manual retention purge

Description

Runs immediate retention purge only when `auto_purge_enabled` is true; otherwise it is skipped and no audit event is written. When enabled it uses workspace data_controls retention windows and logs an audit event. Traces bound to a marketplace engagement whose outcome can still be contested (active, disputed, or open with a partner commercial revision; settled, unclassified, or open without a revision within 90 days of the later of the close and the last commercial change) are held past the window and counted in held.traces.

Auth

Web Session
Responses
200

Retention purge summary

Returns: RetentionPurgeResult

Where to go next

see also