Data Export

Export logs, metrics, and usage data. GDPR-compliant data export and account deletion.

Overview

Xerotier provides two export systems:

  • Data Export API (/exports/) -- Export request logs, aggregated metrics, and usage/billing data in CSV, JSON, or JSONL format.
  • GDPR Data Rights (/gdpr/) -- Export all personal data or request account deletion with a configurable grace period.

Data Export API

The Data Export API supports asynchronous export of logs, metrics, and usage data. Exports are processed in the background and can be downloaded when complete.

Endpoints

Method Endpoint Description
POST /exports/logs Export request logs.
POST /exports/metrics Export aggregated metrics.
POST /exports/usage Export usage/billing data.
GET /exports List export jobs (paginated, filterable by status).
GET /exports/:id Get export job status.
GET /exports/:id/download Download completed export (supports gzip compression).
DELETE /exports/:id Cancel a pending or processing export.

Export Types

Logs Export

Export request-level logs with optional filtering:

JSON
POST /exports/logs { "start_date": "2026-01-01T00:00:00Z", "end_date": "2026-01-31T23:59:59Z", "format": "json", "filters": { "endpoint_ids": ["endpoint-prod"], "status_codes": [200, 429], "model_name": "llama-3.1-8b", "min_latency_ms": 100, "max_latency_ms": 5000, "region": "RegionOne" } }

Metrics Export

Export aggregated metrics:

JSON
POST /exports/metrics { "start_date": "2026-01-01T00:00:00Z", "end_date": "2026-01-31T23:59:59Z", "format": "csv" }

Usage Export

Export usage and billing data:

JSON
POST /exports/usage { "start_date": "2026-01-01T00:00:00Z", "end_date": "2026-01-31T23:59:59Z", "format": "jsonl" }

Filter Options

Filter Type Description
endpoint_ids array of strings Filter by endpoint slug(s).
status_codes array of integers Filter by HTTP response status codes.
model_name string Filter by model name.
min_latency_ms integer Minimum request latency in milliseconds.
max_latency_ms integer Maximum request latency in milliseconds.
region string Filter by region identifier.

The maximum date range for any export is 90 days. Requests with a wider range are rejected with a 400 error.

Export Formats

Format Content Type Description
json application/json Single JSON array of objects. Default format.
csv text/csv Comma-separated values with a header row.
jsonl application/x-ndjson One JSON object per line. Best for large exports and streaming processing.

The download endpoint supports gzip compression. Send Accept-Encoding: gzip to receive a compressed response.

Export Workflow

Exports are processed asynchronously:

  1. Request -- Submit an export request (POST /exports/logs, etc.). You receive a job ID.
  2. Poll -- Check the export status (GET /exports/:id) until it shows completed.
  3. Download -- Download the completed export (GET /exports/:id/download).

Export Job Statuses

Status Description
pending Export is queued for processing.
processing Export is being generated.
completed Export is ready for download.
failed Export failed. Check the error message in the job details.
cancelled Export was cancelled before completion.

Example Workflow

curl
# 1. Request an export curl -X POST https://xerotier.ai/exports/logs \ -H "Authorization: Bearer xero_my-project_abc123" \ -H "Content-Type: application/json" \ -d '{ "start_date": "2026-01-01T00:00:00Z", "end_date": "2026-01-31T23:59:59Z", "format": "json" }' # Response: {"id": "export-abc123", "status": "pending", ...} # 2. Poll for completion curl https://xerotier.ai/exports/export-abc123 \ -H "Authorization: Bearer xero_my-project_abc123" # Response: {"id": "export-abc123", "status": "completed", ...} # 3. Download the export curl -O https://xerotier.ai/exports/export-abc123/download \ -H "Authorization: Bearer xero_my-project_abc123" \ -H "Accept-Encoding: gzip"
Python
import requests import time headers = { "Authorization": "Bearer xero_my-project_abc123", "Content-Type": "application/json" } # 1. Request an export response = requests.post( "https://xerotier.ai/exports/logs", headers=headers, json={ "start_date": "2026-01-01T00:00:00Z", "end_date": "2026-01-31T23:59:59Z", "format": "json" } ) export_id = response.json()["id"] # 2. Poll for completion while True: status_resp = requests.get( f"https://xerotier.ai/exports/{export_id}", headers=headers ) status = status_resp.json()["status"] if status == "completed": break elif status == "failed": raise Exception("Export failed") time.sleep(5) # 3. Download the export download = requests.get( f"https://xerotier.ai/exports/{export_id}/download", headers=headers ) with open("export.json", "wb") as f: f.write(download.content)
Node.js
const headers = { "Authorization": "Bearer xero_my-project_abc123", "Content-Type": "application/json" }; // 1. Request an export const createResp = await fetch( "https://xerotier.ai/exports/logs", { method: "POST", headers, body: JSON.stringify({ start_date: "2026-01-01T00:00:00Z", end_date: "2026-01-31T23:59:59Z", format: "json" }) } ); const { id: exportId } = await createResp.json(); // 2. Poll for completion let status; do { const statusResp = await fetch( `https://xerotier.ai/exports/${exportId}`, { headers } ); const job = await statusResp.json(); status = job.status; if (status !== "completed") { await new Promise(r => setTimeout(r, 5000)); } } while (status === "pending" || status === "processing"); // 3. Download the export const download = await fetch( `https://xerotier.ai/exports/${exportId}/download`, { headers } ); const data = await download.json(); console.log(`Exported ${data.length} records`);

GDPR Data Rights

The GDPR endpoints allow you to export all personal data associated with your account or request account deletion.

GDPR Endpoints

Method Endpoint Description
POST /gdpr/export Request a GDPR data export.
GET /gdpr/exports List your export requests (paginated).
GET /gdpr/export/:exportId Get export request status.
GET /gdpr/export/:exportId/download Download the export file.
DELETE /gdpr/export/:exportId Delete an export.
POST /gdpr/export/:exportId/cancel Cancel a pending export.

Exported Data

A GDPR export includes all personal data associated with your account:

  • Project information
  • Model metadata
  • Endpoint configurations
  • API key metadata (not the key values themselves)
  • Usage events (capped at 10,000 records)
  • Invoices
  • Audit logs (capped at 10,000 records)

Exports are generated as JSON and stored securely. The export file is available for download for 30 days. You may request one GDPR export per 30 days.

Account Deletion

Account deletion is a two-step process with a grace period to prevent accidental data loss.

Deletion Endpoints

Method Endpoint Description
POST /gdpr/delete Request account deletion. Returns a confirmation token.
GET /gdpr/delete/:requestId Get deletion request status.
POST /gdpr/delete/:requestId/confirm Confirm deletion using the confirmation token. Starts the grace period.
POST /gdpr/delete/:requestId/cancel Cancel deletion during the grace period.
GET /gdpr/delete/preview Preview what data would be deleted.

Deletion Process

  1. Request -- Submit a deletion request (POST /gdpr/delete). You receive a confirmation token via email.
  2. Confirm -- Confirm the deletion with the token (POST /gdpr/delete/:requestId/confirm). This starts the grace period.
  3. Grace period -- During the 30-day grace period, you can cancel the deletion at any time.
  4. Deletion -- After the grace period expires, all account data is permanently deleted.

Before requesting deletion, use the preview endpoint to see exactly what data would be removed. Consider exporting your data first using the GDPR export feature.