Exporting data from Spaaza
Contents
- Overview
- What you can export
- Export formats
- Workflow overview
- Quick start example
- Filtering exports with segments
- Recurring exports
- Best practices
- Export guides
- Related documentation
Overview
Spaaza provides an asynchronous, task-based export system that lets you extract data from the platform in CSV or JSON format. This is the recommended approach for programmatic or large-volume data exports.
Exports are managed through the Tasks API. You create a task describing what to export, wait for it to complete, and download the resulting file. For full endpoint documentation including parameters, authentication, response schemas, and error codes, see the Tasks API reference.
What you can export
| Export index | Description |
|---|---|
transactions | Basket/transaction records including item-level data |
users | Customer/user accounts and profile information |
vouchers | Issued vouchers, including status and redemption data |
wallet-ledger | Wallet credit and debit entries |
products | Product catalog records |
product-variants | Product variant records |
Export formats
| Format | Description |
|---|---|
csv | Comma-separated values file. Recommended for most use cases. |
json | JSON file containing all records. Can be very large for high-volume exports. |
Workflow overview
The following Mermaid sequence diagram shows the typical export workflow. The client creates a task, polls its status until completion, and then downloads the result file from temporary storage.
sequenceDiagram
participant Client
participant Services API
participant Storage
Client->>Services API: POST /tasks (create export)
Services API-->>Client: Task ID + state: READY
loop Poll until DONE
Client->>Services API: GET /tasks/{id}
Services API-->>Client: state: INPROGRESS / DONE
end
Client->>Services API: GET /tasks/{id}/download_url
Services API-->>Client: Temporary download URL
Client->>Storage: GET (download file)
Storage-->>Client: CSV/JSON file
Quick start example
Create a simple CSV export of all users:
curl -X POST 'https://{Services API hostname}/tasks' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ACCESS_TOKEN_ID:ACCESS_TOKEN_SECRET' \
-d '{
"chain": YOUR_CHAIN_ID,
"desc": "Full user export",
"target": {
"action": "export",
"export_index": "users",
"export_format": "csv"
},
"trigger": {
"once": "2026-05-26T12:00:00Z"
}
}'
Set trigger.once to a time shortly in the future when you want the export to run.
For authentication details, see Permissions and Authentication in the Tasks API reference.
Filtering exports with segments
You can filter an export to include only records matching specific criteria by adding a segment object to the trigger field. For example, to export only vouchers redeemed in the last 7 days:
"trigger": {
"once": "2026-05-26T12:00:00Z",
"segment": {
"entity": "people",
"index": "vouchers",
"join": "all",
"chain_id": YOUR_CHAIN_ID,
"rules": [
{
"field_name": "date_time_redeemed",
"field_type": "date",
"operator": "relative_less_than",
"time_factor": "day",
"time_amount": 7
}
]
}
}
Alternatively, if you have an existing saved segment in Console, you can reference it by ID:
"trigger": {
"once": "2026-05-26T12:00:00Z",
"segment_id": "YOUR_SEGMENT_ID"
}
You can find the segment ID from the URL in Console when viewing a particular segment.
See the Segment filter reference for the full list of operators, field types, and advanced filtering options.
Recurring exports
Tasks can be set to repeat on a schedule by adding trigger.repeat. After each run, the task automatically reschedules itself:
"trigger": {
"once": "2026-05-26T00:00:00Z",
"repeat": "daily",
"segment": {
"entity": "people",
"index": "transactions",
"join": "all",
"chain_id": YOUR_CHAIN_ID,
"rules": [
{
"field_name": "timestamp",
"field_type": "date",
"operator": "relative_less_than",
"time_factor": "day",
"time_amount": 1
}
]
}
}
Supported repeat values: "daily", "weekly", "monthly". See Scheduling and triggers in the Tasks API reference for details.
Best practices
- Stagger task scheduling: If you need to run multiple exports, spread them across different
trigger.oncetimes rather than scheduling them all at the same moment. This avoids overloading the task runner and ensures each export completes promptly. - Prefer CSV for large exports: JSON exports can produce very large files. CSV is generally more efficient for bulk data transfer.
- Use segment filters for incremental syncs: Rather than exporting all data each time, use relative date filters (e.g.
relative_less_thanwithtime_factor: "day"andtime_amount: 1) to export only records from the last 24 hours. - Chunk large historical exports: If a full export times out, break it into bounded date windows using
is_between_datewithstart_dateandend_date(e.g. one month at a time). See Exporting transactions for a detailed example. - Poll with reasonable intervals: Check task status every 10–30 seconds. Very large exports may take several minutes to complete.
- Download promptly: The download URL is temporary (valid for approximately one hour). Download the file shortly after requesting the URL.
Export guides
- Exporting transactions
- Exporting users
- Exporting vouchers
- Exporting wallet entries
- Exporting products
Related documentation
- Tasks API reference — Full endpoint specifications for creating, managing, and downloading task results
- Segment filter reference — Operators, field types, and rule syntax
- Export users (synchronous) — Legacy synchronous CSV endpoint for users
- BI & Data integrations — Connecting Spaaza data to analytics tools