Export API

The Export API lets you export your project's event data.

Authentication

This API uses basic authentication, using the API key and secret key for your project. Pass base64-encoded credentials in the request header like {api-key}:{secret-key}. api-key replaces username, and secret-key replaces the password.

Your authorization header should look something like this:

--header 'Authorization: Basic YWhhbWwsdG9uQGFwaWdlZS5jb206bClwYXNzdzByZAo'

For more information, see Find your API Credentials

Endpoints

Region Endpoint
Standard server https://amplitude.com/api/2/export
EU residency server https://analytics.eu.amplitude.com/api/2/export

Considerations

  • The specified date range refers to the time the event data was uploaded to Amplitude servers (see server_upload_time). The Export API returns events timestamped in UTC. Data is available to export at a minimum within 2 hours of when the servers received it. For example, data sent between 8 and 9 PM begins loading at 9 PM and is available via the Export API at 11 PM. Note that there is no delay in platform reporting. Only exports are delayed.
  • Export API isn't supported for a cross-project view because the view doesn’t own any data. To export all the data in the view, you would need to call the Export API on the underlying projects that actually ingested the data.
  • Size limit is 4GB. If the size exceeds 4GB, the request returns a 400 response. In this case, choose a smaller time range to export the data. In cases where an hour's worth of data exceeds 4GB, use the Amazon S3 export.
  • To export a whole day, use T00 to T23. For example, GET 'https://amplitude.com/api/2/export?start=20230101T00&end=20220101T23'
  • The max period you can query at once is 365 days.

Request

GET https://amplitude.com/api/2/export

1curl --location --request GET 'https://amplitude.com/api/2/export?start=<starttime>&end=<endtime>' \
2-u '{api_key}:{secret_key}'

1GET /api/2/export?start=<starttime>&end=<endtime> HTTP/1.1
2Host: amplitude.com
3Authorization: Basic {api-key}:{secret-key} #credentials must be base64 encoded

Example: Get data for a period
Export activity data from between midnight on January 1, 2022 and midnight January 27, 2022.

1curl --location --request GET 'https://amplitude.com/api/2/export?start=20220101T00&end=20220127T00' \
2--header 'Authorization: Basic YWhhbWwsdG9uQGFwaWdlZS5jb206bClwYXNzdzByZAo'

1GET /api/2/export?start=20220101T00&end=20220127T00 HTTP/1.1
2Host: amplitude.com
3Authorization: Basic YWhhbWwsdG9uQGFwaWdlZS5jb206bClwYXNzdzByZAo

Query parameters

Name Description
start Required. First hour included in data series, formatted YYYYMMDDTHH. For example, 0220201T05.
end Required. Last hour included in data series, formatted YYYYMMDDTHH For example, 20220201T05.

Response

The response is a zipped archive of JSON files. Depending on data volume, there can be several files per hour. The API returns a 404 response is there is no data for the time range you requested.

Note

Events before November 12, 2014 are grouped by day, instead of by the hour.

Response schema

The response includes one event JSON object per line in each file, with the following schema:

1{
2 "server_received_time": UTC ISO-8601 formatted timestamp,
3 "app": int,
4 "device_carrier": string,
5 "city": string,
6 "user_id": string,
7 "uuid": UUID,
8 "event_time": UTC ISO-8601 formatted timestamp,
9 "platform": string,
10 "os_version": string,
11 "amplitude_id": long,
12 "processed_time": UTC ISO-8601 formatted timestamp,
13 "version_name": string,
14 "ip_address": string,
15 "paying": boolean,
16 "dma": string,
17 "group_properties": dict,
18 "user_properties": dict,
19 "client_upload_time": UTC ISO-8601 formatted timestamp,
20 "$insert_id": string,
21 "event_type": string,
22 "library": string,
23 "amplitude_attribution_ids": string,
24 "device_type": string,
25 "start_version": string,
26 "location_lng": float,
27 "server_upload_time": UTC ISO-8601 formatted timestamp,
28 "event_id": int,
29 "location_lat": float,
30 "os_name": string,
31 "groups": dict,
32 "event_properties": dict,
33 "data": dict,
34 "device_id": string,
35 "language": string,
36 "country": string,
37 "region": string,
38 "session_id": long,
39 "device_family": string,
40 "sample_rate": null,
41 "client_event_time": UTC ISO-8601 formatted timestamp,
42}

Status codes

Code Message
200 Success
400 The file size of the exported data is too large. Shorten the time ranges and try again. The limit size is 4GB.
404 No data available for the time range requested.
504 The amount of data is large causing a timeout. For large amounts of data, use the Amazon S3 destination.
Was this page helpful?

Thanks for your feedback!

May 21st, 2024

Need help? Contact Support

Visit Amplitude.com

Have a look at the Amplitude Blog

Learn more at Amplitude Academy

© 2024 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.