For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

You are the data controller and are entirely responsible for your data. Ensure that you follow all compliance and regulatory best practices.

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

  1. Never log passwords - They are only shown once in the API response

  2. Use HTTPS - Always use secure connections for API calls

  3. Store passwords securely - If saving for later, use encrypted storage

  4. Delete after use - Remove decrypted files when no longer needed

  5. Limit access - Only grant export permissions to trusted API keys

Performance

  1. Use filters - Narrow exports to only needed users

  2. Select specific fields - Don't export unnecessary data

  3. Schedule large exports - Run during off-peak hours

  4. Monitor status - Poll at 5-second intervals (not more frequently)

Compliance

  1. GDPR compliance - Exports support data portability rights

  2. Audit logging - All exports are logged with creator and timestamp

  3. Auto-deletion - 24-hour expiry ensures data isn't retained unnecessarily

  4. 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:

    1. Wrong password

    2. Corrupted download

    3. Invalid file format

  • Solutions:

    1. Verify password from API response

    2. Re-download the file

    3. 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