---
title: "Create data export"
method: POST
path: "/data-exports"
tags: ["Data Exports"]
---

# Create data export

`POST /data-exports`

## Request

- Base URL: `https://api.sequenzy.com/api/v1`
- URL: `https://api.sequenzy.com/api/v1/data-exports`
- Auth: HTTP bearer

Adds an S3, Google Cloud Storage or S3-compatible bucket as a data export destination. Sequenzy first writes a small test file under the path prefix; the request fails with 400 when that write fails. The first export starts immediately and later exports follow the frequency. Requires data_exports:write, subscribers:read and analytics:read.

## Request body

- object
  - `name` string, required
  - `provider` 's3' | 'gcs', required: s3 for Amazon S3 or any S3-compatible service; gcs for Google Cloud Storage (HMAC keys).
  - `bucket` string, required: Bucket name, not a URL.
  - `region` string, nullable: Bucket region. Required for Amazon S3 without a custom endpoint; defaults to auto otherwise.
  - `endpoint` string, nullable: HTTPS origin of an S3-compatible service (R2, MinIO, Backblaze). Must resolve to a public address. Not allowed for gcs.
  - `pathPrefix` string, nullable: Folder inside the bucket. Leading and trailing slashes are removed.
  - `accessKeyId` string, required: Access key ID (GCS HMAC access ID).
  - `secretAccessKey` string, required: Secret access key. Stored encrypted and never returned.
  - `datasets` string[]
  - `frequency` 'every_5_minutes' | 'every_15_minutes' | 'hourly' | 'daily'
  - `startFrom` string, date-time, nullable: Include events recorded since this time, at most 30 days ago. Defaults to now.

## Response `201`

Data export created and first run queued

- object
  - `success` boolean
  - `dataExport` DataExport: A bucket that Sequenzy streams workspace data to as gzipped JSON lines.
    - `id` string
    - `name` string
    - `provider` 's3' | 'gcs'
    - `bucket` string
    - `region` string
    - `endpoint` string, nullable
    - `pathPrefix` string
    - `accessKeyId` string: Masked access key ID, for example AKIA…WXYZ. The secret is never returned.
    - `datasets` string[]
    - `frequency` 'every_5_minutes' | 'every_15_minutes' | 'hourly' | 'daily'
    - `isEnabled` boolean
    - `status` 'idle' | 'queued' | 'running' | 'failed': failed means the last run failed; it retries automatically with backoff.
    - `startFrom` string, date-time
    - `exportedThrough` object: Per dataset. Event datasets: everything recorded up to this timestamp has been written. subscribers: date of the last complete snapshot. null until the first export of that dataset.
    - `nextRunAt` string, date-time, nullable
    - `lastRunAt` string, date-time, nullable
    - `lastSuccessAt` string, date-time, nullable
    - `lastError` string, nullable
    - `lastErrorAt` string, date-time, nullable
    - `consecutiveFailures` integer
    - `totalRowsExported` integer
    - `createdAt` string, date-time
    - `updatedAt` string, date-time

## Other responses

- `400`: Validation error (code invalid_input) or the test write failed (code connection_failed, with the reason: missing bucket, access denied, wrong region, unknown key or unsafe endpoint)
- `401`: Unauthorized
- `403`: Missing scope, or the member role cannot manage workspace settings
- `422`: Request body does not match the schema (for example an unknown dataset)

## Changes

- **2026-10-16** `db3873ca3d4d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/sequenzy/apis/sequenzy-api/changes/data-exports/post.md)

---

[API](https://skmtc.dev/sequenzy/apis/sequenzy-api.md) - [All operations](https://skmtc.dev/sequenzy/apis/sequenzy-api/llms.txt) - [OpenAPI document](https://skmtc.dev/sequenzy/apis/sequenzy-api/revisions/8156dc12d8b4?raw)
