PlatformXeDocs
Get API Key

Data Exports

API reference for creating and retrieving data exports.

The Data Exports service lets you export platform data as CSV or JSON files. Exports run asynchronously -- you create an export request and then poll for completion or wait for a webhook notification.

Create an export

POST /api/v1/exports

Scope: exports:create

Request body

FieldTypeRequiredDescription
dataTypestringYesWhat to export: messages, usage, webhooks, or invoices
formatstringNoOutput format: CSV or JSON. Default: CSV
filters.dateFromstringNoISO 8601 start date for the export window
filters.dateTostringNoISO 8601 end date for the export window
filters.servicestringNoFilter by service name (e.g., email, sms, storage)

Response

{
  "success": true,
  "data": {
    "id": "exp_abc123",
    "organizationId": "org_xyz",
    "dataType": "usage",
    "format": "CSV",
    "status": "PENDING",
    "downloadUrl": null,
    "fileSize": null,
    "recordCount": null,
    "completedAt": null,
    "expiresAt": null,
    "createdAt": "2026-04-05T10:00:00.000Z"
  }
}
FieldTypeDescription
idstringExport ID for polling
dataTypestringThe data type being exported
formatstringOutput format
statusstringPENDING, PROCESSING, COMPLETED, or FAILED
downloadUrlstring or nullPre-signed download URL (available when COMPLETED)
fileSizenumber or nullFile size in bytes (available when COMPLETED)
recordCountnumber or nullNumber of records exported (available when COMPLETED)
completedAtstring or nullISO 8601 completion timestamp
expiresAtstring or nullISO 8601 expiry timestamp for the download URL

Get an export

GET /api/v1/exports/:exportId

Scope: exports:create

Returns the export record. Poll this endpoint to check when status transitions to COMPLETED, then use the downloadUrl to retrieve the file.

Download URLs are pre-signed and expire based on your exports processor's retentionDays setting (default: 30 days). After expiry, the export file is permanently deleted.

Export statuses

StatusDescription
PENDINGExport has been queued
PROCESSINGExport is being generated
COMPLETEDExport is ready for download
FAILEDExport generation failed (check error details)

Processor configuration

The exports processor controls format restrictions, row limits, and file retention. See Exports Processor Config for the full reference.

SettingDefaultDescription
allowedFormats["csv", "json"]Which formats tenants can request
maxRowsPerExport100000Maximum rows per export file
retentionDays30Days before completed export files are auto-deleted

Examples

Export usage data as CSV

curl

# Create the export
curl -X POST https://api.platformxe.com/api/v1/exports \
  -H "Content-Type: application/json" \
  -H "x-api-key: pxk_live_your_api_key_here" \
  -d '{
    "dataType": "usage",
    "format": "CSV",
    "filters": {
      "dateFrom": "2026-03-01T00:00:00.000Z",
      "dateTo": "2026-03-31T23:59:59.999Z",
      "service": "email"
    }
  }'

# Poll for completion
curl https://api.platformxe.com/api/v1/exports/exp_abc123 \
  -H "x-api-key: pxk_live_your_api_key_here"

TypeScript SDK

import { PlatformXe } from '@caldera/platformxe-sdk';

const px = new PlatformXe({ apiKey: 'pxk_live_your_api_key_here' });

// Create export
const exp = await px.exports.create({
  dataType: 'usage',
  format: 'CSV',
  filters: {
    dateFrom: '2026-03-01T00:00:00.000Z',
    dateTo: '2026-03-31T23:59:59.999Z',
    service: 'email',
  },
});

console.log(exp.id, exp.status);
// "exp_abc123" "PENDING"

// Poll for completion
const completed = await px.exports.get(exp.id);
if (completed.status === 'COMPLETED') {
  console.log('Download:', completed.downloadUrl);
}

Python SDK

from platformxe import PlatformXe

px = PlatformXe(api_key="pxk_live_your_api_key_here")

exp = px.exports.create({
    "dataType": "usage",
    "format": "CSV",
    "filters": {
        "dateFrom": "2026-03-01T00:00:00.000Z",
        "dateTo": "2026-03-31T23:59:59.999Z",
        "service": "email"
    }
})

# Poll for completion
result = px.exports.get(exp["id"])
if result["status"] == "COMPLETED":
    print("Download:", result["downloadUrl"])

Export invoices as JSON

const invoiceExport = await px.exports.create({
  dataType: 'invoices',
  format: 'JSON',
  filters: {
    dateFrom: '2026-01-01T00:00:00.000Z',
  },
});

Error responses

CodeDescription
BAD_REQUESTInvalid dataType, format, or filter values
FORBIDDENAPI key does not have the exports:create scope
SERVICE_DISABLEDExports processor is disabled for this organization
RATE_LIMITEDRate limit exceeded