# Export data

You can export data from specific section (People/Deals/etc.) or campaign logs (Email deliveries/clicks or SMS deliveries) based on segment (for sections) as well as based on date of campaign sending or user's click/opening/unsubscription.

POST /api/public/exports/

Attributes Type Required Description
segment integer yes / no A unique identifier for the segment of People/Deals/etc.
(required and possible to use for the sections and to use for deals' stage changes)
date_from date (Y-m-d) no A date from which the data will be returned (format: Y-m-d, e.g., 2024-01-15).
(possible to use only for logs)
date_to date (Y-m-d) no A date to which the data will be returned (format: Y-m-d, e.g.,2024-01-31).
(possible to use only for logs)
filter_by array no Array of email action types to filter by, based on the date_from and date_to.

Must always be an array format (even for single values):
- sent_at (default)
- opened_at
- clicked_at
- unsubscribed_at

Examples:
Single filter: ["sent_at"]
Multiple filters: ["sent_at", "opened_at", "clicked_at"]
event_id integer yes / no ID of the specific event.
(required and possible to use only for the event occurrences export)
deal_id integer no ID of the specific deal.
(possible to use only for the deals stage changes export)
type string yes Type of the exported data.
Those can be:
Section
- people
- products
- deals
- companies
- activities
Logs
- email_delivery_logs
- sms_delivery_logs
- email_clicks
- events
- deals_stage_changes
- people_timelines

# Request

  • CURL
  • JavaScript
  • PHP
  • Python
curl -X POST
    "https://<your_app_subdomain>.user.com/api/public/exports/"
    -H 'authorization: Token <your_64_char_api_key>'
    -H 'content-type: application/json'
    -H "Accept: */*; version=2"
    -d '{
    "type": "people",
    "segment": 1
}'

# Response

{
  "filename": "d1d69214-d07f-418f-bd85-27c49fd3398f.csv"
}

# Email logs export example

  • CURL
  • JavaScript
  • PHP
  • Python
curl -X POST
    "https://<your_app_subdomain>.user.com/api/public/exports/"
    -H 'authorization: Token <your_64_char_api_key>'
    -H 'content-type: application/json'
    -H "Accept: */*; version=2"
    -d '{
    "type": "email_delivery_logs",
    "date_from": "2024-01-01",
    "date_to": "2024-01-31",
    "filter_by": ["sent_at", "opened_at"]
}'