Skip to main content

Exporting users

Contents​

Overview​

Export customer/user records from Spaaza, including profile data, RFM metrics, loyalty status, and opt-in preferences.

To create a user export, send a POST /tasks request to the Services API with target.export_index set to "users". See the Tasks API reference for full endpoint documentation.

Version-specific information​

VersionChange details
N/AN/A

Permissions and Authentication​

User exports use the Tasks API endpoints, which require chain-scoped authentication on the Services API. See Permissions and Authentication in the Tasks API reference for details on supported authentication methods.

Basic export (all users)​

Create an unfiltered CSV export of all users for your chain:

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"
}
}'

Using a saved segment from Console​

If you have already created a segment in Console (e.g. "High-value customers" or "Newsletter subscribers"), you can reference it by ID rather than defining inline rules:

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": "Export high-value customers segment",
"target": {
"action": "export",
"export_index": "users",
"export_format": "csv"
},
"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.

Filtered export: users created in the last 24 hours​

Use a relative_less_than rule on the created_date field for incremental syncs:

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": "Users created in the last 24 hours",
"target": {
"action": "export",
"export_index": "users",
"export_format": "csv"
},
"trigger": {
"once": "2026-05-26T12:00:00Z",
"segment": {
"entity": "people",
"index": "users",
"join": "all",
"chain_id": YOUR_CHAIN_ID,
"rules": [
{
"field_name": "created_date",
"field_type": "date",
"operator": "relative_less_than",
"time_factor": "day",
"time_amount": 1
}
]
}
}
}'

Filtered export: users in a specific country​

Use an is rule on a keyword field:

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": "Users in the Netherlands",
"target": {
"action": "export",
"export_index": "users",
"export_format": "csv"
},
"trigger": {
"once": "2026-05-26T12:00:00Z",
"segment": {
"entity": "people",
"index": "users",
"join": "all",
"chain_id": YOUR_CHAIN_ID,
"rules": [
{
"field_name": "country",
"field_type": "keyword",
"operator": "is",
"value": "NL"
}
]
}
}
}'

Combining multiple filter rules​

Use "join": "all" to require all rules to match (AND logic), or "join": "any" to match any rule (OR logic):

"segment": {
"entity": "people",
"index": "users",
"join": "all",
"chain_id": YOUR_CHAIN_ID,
"rules": [
{
"field_name": "country",
"field_type": "keyword",
"operator": "is",
"value": "NL"
},
{
"field_name": "created_date",
"field_type": "date",
"operator": "is_after_date",
"start_date": "2026-01-01T00:00:00Z"
}
]
}

This exports users in the Netherlands who were created after 1 January 2026.

See the Segment filter reference for the full list of operators, field types, and advanced filtering options.

Checking task status and downloading​

After creating the export, poll the task status:

curl 'https://{Services API hostname}/tasks/{TASK_ID}' \
-H 'Authorization: Bearer ACCESS_TOKEN_ID:ACCESS_TOKEN_SECRET'

When the task state is DONE, request the download URL:

curl 'https://{Services API hostname}/tasks/{TASK_ID}/download_url' \
-H 'Authorization: Bearer ACCESS_TOKEN_ID:ACCESS_TOKEN_SECRET'

Download the file promptly — the URL expires after approximately one hour.

See Get a task and Get download URL for full endpoint details.

Further reading​