> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequenzy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Data Export

> Stream events and subscriber snapshots to your bucket

Adds a bucket as a data export destination. Before saving, Sequenzy writes a small test file to `<pathPrefix>/_sequenzy/connection-test.json`. If that write fails, nothing is saved and the response explains why. The first export starts immediately.

Requires `data_exports:write`, `subscribers:read` and `analytics:read`, because the destination receives subscriber and engagement data.

See [Data exports](/integrations/data-exports) for the file layout, row schemas and warehouse loading recipes.

## Request

<ParamField body="name" type="string" required>
  Display name, up to 255 characters.
</ParamField>

<ParamField body="provider" type="string" required>
  `s3` for Amazon S3 or any S3-compatible service, `gcs` for Google Cloud
  Storage.
</ParamField>

<ParamField body="bucket" type="string" required>
  Bucket name, not a URL.
</ParamField>

<ParamField body="region" type="string | null">
  Bucket region, for example `us-east-1`. Required for Amazon S3 without a
  custom endpoint. Defaults to `auto` for GCS and custom endpoints.
</ParamField>

<ParamField body="endpoint" type="string | null">
  HTTPS origin of an S3-compatible service such as Cloudflare R2, MinIO or
  Backblaze B2. It must resolve to a public address. Not allowed with `gcs`.
</ParamField>

<ParamField body="pathPrefix" type="string | null" default="">
  Folder inside the bucket. Leading and trailing slashes are removed. Letters,
  numbers, `/` and `! _ . * ' ( ) = -` are allowed; `..` segments are rejected.
</ParamField>

<ParamField body="accessKeyId" type="string" required>
  Access key ID. For GCS, the HMAC access ID.
</ParamField>

<ParamField body="secretAccessKey" type="string" required>
  Secret access key (GCS: HMAC secret). Stored encrypted and never returned.
</ParamField>

<ParamField body="datasets" type="string[]" default="[&#x22;email_events&#x22;, &#x22;custom_events&#x22;, &#x22;subscribers&#x22;]">
  Any of `email_events`, `sms_events`, `custom_events`, `subscribers`. Unknown
  values return `422`.
</ParamField>

<ParamField body="frequency" type="string" default="every_15_minutes">
  `every_5_minutes`, `every_15_minutes`, `hourly` or `daily`.
</ParamField>

<ParamField body="startFrom" type="string | null">
  ISO timestamp, at most 30 days ago, to include events recorded since then.
  Defaults to now. The subscriber snapshot always reflects current data.
</ParamField>

```bash theme={null}
curl -X POST "https://api.sequenzy.com/api/v1/data-exports" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Analytics lake",
    "provider": "s3",
    "bucket": "acme-exports",
    "region": "us-east-1",
    "pathPrefix": "sequenzy",
    "accessKeyId": "AKIA...",
    "secretAccessKey": "...",
    "datasets": ["email_events", "custom_events", "subscribers"],
    "frequency": "every_15_minutes"
  }'
```

<ResponseExample>
  ```json 201 theme={null}
  {
    "success": true,
    "dataExport": {
      "id": "exp_abc123",
      "name": "Analytics lake",
      "provider": "s3",
      "bucket": "acme-exports",
      "region": "us-east-1",
      "endpoint": null,
      "pathPrefix": "sequenzy",
      "accessKeyId": "AKIA…WXYZ",
      "datasets": ["email_events", "custom_events", "subscribers"],
      "frequency": "every_15_minutes",
      "isEnabled": true,
      "status": "queued",
      "startFrom": "2026-09-30T12:00:00.000Z",
      "exportedThrough": {
        "email_events": null,
        "custom_events": null,
        "subscribers": null
      },
      "nextRunAt": "2026-09-30T12:00:00.000Z",
      "lastRunAt": null,
      "lastSuccessAt": null,
      "lastError": null,
      "lastErrorAt": null,
      "consecutiveFailures": 0,
      "totalRowsExported": 0,
      "createdAt": "2026-09-30T12:00:00.000Z",
      "updatedAt": "2026-09-30T12:00:00.000Z"
    }
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "code": "connection_failed",
    "error": "Access denied writing to \"acme-exports\". Grant the key permission to put objects under the configured path."
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "code": "invalid_input",
    "error": "Region is required for Amazon S3 (for example us-east-1)."
  }
  ```

  ```json 403 theme={null}
  {
    "success": false,
    "error": "API key is missing required scopes: subscribers:read, analytics:read"
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.