Skip to main content
POST/exports/

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.

AttributesTypeRequiredDescription
segmentintegeryes / no

A unique identifier for the segment of People/Deals/etc.
(required and possible to use for the sections, deals' stage changes and people timelines)

date_fromdate (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 and people timelines)

date_todate (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_byarrayno

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_idintegeryes / no

ID of the specific event.
(required and possible to use only for the event occurrences export)

deal_idintegerno

ID of the specific deal.
(possible to use only for the deals stage changes export)

typestringyes

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
    Other
  • tickets

Request​

curl -X POST "https://<your_app_subdomain>.user.com/api/public/exports/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2" \
-H "Content-Type: application/json" \
-d '{
"type": "people",
"segment": 43
}'

Response examples​

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

A 400 for a missing or unknown type has an error text. Other problems name the field:

MessageWhen
error: Type None is not valid. Valid options are …The body has no type, or type isn't one of the values listed.
segment: This field is required.A section export (people, tickets and the others) without segment.
segment: Segment does not exist.No segment has that ID.
event_id: This field is required. / Id of existing event should be passedAn events export without event_id, or with an ID no event has.
filter_by: Expected a list of items but got type "str".filter_by isn't a list, even for one action.
filter_by: This data type does not contain all of passed filter columns.filter_by has an action that isn't sent_at, opened_at, clicked_at or unsubscribed_at.
date_from: Date has wrong format. Use one of these formats instead: YYYY-MM-DD.A date isn't YYYY-MM-DD.

A date_from later than date_to isn't an error: the export is created. The file is built in the background; Download exported data answers 423 until it's ready. How long that takes depends on the size of the export: seconds for a small segment, much longer for a large one. Get all exported files shows the export's status and finished_at.

Response fields​

Fields returned in the 200 OK response body.

filenamestring
Name of the export file. Use it to download the file.
note

Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.

Email logs export example​

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