Data Export Guide
Guide for requesting, downloading, and decrypting user data exports
This guide covers how to use the Audience API's encrypted export feature to securely extract user data for analysis, marketing, compliance, or migration purposes.
Overview
The export feature allows you to:
Export filtered user data as CSV or JSON
Automatically encrypt exports with AES-256-GCM
Receive email notifications when exports are ready
Download exports via secure time-limited URLs
Auto-expire exports after 24 hours for security
Creating an Export
1. Submit Export Request
curl -X POST \
'https://api.monterosa.cloud/v1/api/audience/internal/users/export' \
-H 'Content-Type: application/json' \
-H 'X-Monterosa-Org-ID: your-org-id' \
-H 'X-API-Key: your-api-key' \
-H 'X-API-Secret: your-api-secret' \
-d '{
"filters": {
"tier": ["gold", "platinum"],
"points": { "min": 1000 }
},
"format": "csv",
"fields": [
"userId",
"email",
"displayName",
"metrics.points",
"metrics.xp",
"tier"
],
"encrypt": true,
"notifyEmail": "admin@example.com"
}'Response:
2. Poll Export Status
3. Download Export
Once completed, download the encrypted file:
Or using JavaScript:
Decryption
File Format
Encrypted exports use this format:
All components are hex-encoded strings separated by colons.
Decryption with Node.js
Decryption with Python
Command Line Decryption Script
Create a reusable script decrypt-export.sh:
Make it executable:
UI Integration
React Component Example
Best Practices
Security
Never log passwords - They are only shown once in the API response
Use HTTPS - Always use secure connections for API calls
Store passwords securely - If saving for later, use encrypted storage
Delete after use - Remove decrypted files when no longer needed
Limit access - Only grant export permissions to trusted API keys
Performance
Use filters - Narrow exports to only needed users
Select specific fields - Don't export unnecessary data
Schedule large exports - Run during off-peak hours
Monitor status - Poll at 5-second intervals (not more frequently)
Compliance
GDPR compliance - Exports support data portability rights
Audit logging - All exports are logged with creator and timestamp
Auto-deletion - 24-hour expiry ensures data isn't retained unnecessarily
Email notifications - Provides audit trail of export access
Troubleshooting
Export Status Stuck on "Processing"
Cause: Large dataset or system overload
Solution: Wait up to 15 minutes; check status via API
"Export Expired" Error
Cause: More than 24 hours passed since creation
Solution: Create a new export request
Decryption Fails
Causes:
Wrong password
Corrupted download
Invalid file format
Solutions:
Verify password from API response
Re-download the file
Check file starts with hex strings separated by colons
Download URL Returns 403
Cause: Pre-signed URL expired or invalid
Solution: Request status again to get fresh URL
Last updated

