On this page

For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.

Dashboard REST API

You can get data that's displayed on the dashboard graphs in JSON format with the Dashboard REST API.

Regions

The base URL depends on your project's data residency. In all examples on this page, use the default base URL unless your project uses Amplitude's EU data center. For EU projects, use the EU base URL in this table.

Requests go to https://amplitude.com (default) or https://analytics.eu.amplitude.com (EU). The https://analytics.amplitude.com hostname is the Analytics web app (browser UI); use the hosts in this table for REST requests, not analytics.amplitude.com.

Authentication

Authenticate with HTTP Basic authentication. Use the project's API key as the username and its secret key as the password. For a raw HTTP request, base64 encode the string api_key:secret_key after Authorization: Basic. cURL's -u option encodes the credentials for you. Use credentials for the project that owns the chart or data you query.

Considerations

  • URL encode special characters in event types, event properties, and user property names. For example, encode Play Song as Play%20Song. Refer to the W3Schools encoding reference.
  • Some examples use backslash syntax to escape characters in cURL. If you aren't using cURL, don't encode your request with backslash escape characters.
  • The Dashboard REST API time zone matches your Amplitude project's time zone.

Rate limits

Each endpoint has a concurrent limit and a rate limit. The concurrent limit restricts the number of requests you can run at the same time. The rate limit restricts the total number of queries per hour. Exceeding these limits returns a 429 error. Limits are per project, and the 429 error includes information about which limit you exceeded.

Concurrent Limit: Run up to 5 concurrent requests across all Amplitude REST API endpoints, including cohort download.

User activity and user search limits

The User Activity and User Search endpoints have different limits:

  • Concurrent Limit: Run up to 10 concurrent requests for these endpoints.
  • Rate Limit: Run up to 360 queries per hour for these endpoints.

Project or organization overrides can change the limits. Coordinate workers that query the same project; adding workers doesn't create a separate project budget. Query cost limits apply in addition to request concurrency limits.

Endpoint costs

Endpoints use a cost per query rate limit model. Cost measures rate limits and API usage limits, rather than monetary value. This method provides equal API availability for all queries. Amplitude calculates rate costs with this formula:

cost = (# of days) * (# of conditions) * (cost for the query type)

Amplitude determines each variable as follows:

  • Number of days: The number of days in the query.
  • Number of conditions: The number of segments plus the number of conditions within the segments applied to the chart. Each group by counts as 4 segments.

Segments and conditions

  • Segments are comparison groups. For more information, refer to Add user segments.
  • Conditions represent top-level filters. Cohorts, WHERE, and "who performed/did" are conditions in Amplitude. Event filters don't count as conditions for API costs.

Different chart types have different costs. For endpoints not listed here, the cost is 1. The limits for these endpoints, measured in cost per query, are:

  • Concurrent Limit: Up to 1000 cost within a five minute period.

  • Rate Limit: Up to 108,000 cost per hour.

  • Event Segmentation: Equal to the number of events in the left module. If any event has a group by, add a cost of 4 per group by and event.

  • Funnel Analysis: The number of events in the funnel multiplied by two. If any event has a group by, add a cost of 4 per group by and event.

  • Retention Analysis: The cost for this chart is 8.

  • User Sessions: The cost for this chart is 4.

Status codes

Use HTTP status codes to handle failures across Dashboard REST API endpoints. Error bodies can vary by endpoint and failure type; don't assume every error returns the same JSON schema or message.

Retry handling

For 429, network failures, and transient 5xx responses, use exponential backoff with jitter and a bounded retry count. If the response includes Retry-After, honor it. Otherwise, use your client's backoff policy. An immediate retry doesn't resolve an exhausted hourly budget. For cost-related throttling, shorten the date range or reduce segments and group bys. Don't retry authentication, validation, or missing-chart failures until you correct the request.

Data consistency

The Dashboard REST API queries analytics results using the project's time zone. The Export API selects raw events by UTC upload hour. Match the time zone, date boundaries, filters, and chart settings before comparing results between the APIs.

Saved-chart requests use the chart's definition when the request runs. Editing a saved chart can change subsequent results. For reproducible comparisons, record the chart settings and query parameters with the response. Don't treat multiple requests as a single snapshot, or assume a repeated query returns identical results while data or chart settings change.

Shared query parameters

Several Dashboard REST API endpoints share these query parameters.

  • For built-in Amplitude properties, valid values are version, country, city, region, DMA, language, platform, os, device, device_type, start_version, and paying.
  • For custom user properties, format the key as gp:name.

Event format

The event parameter accepts these keys:

Filter object keys

Event format example

json
{
  "event_type": "CompletedProfile",
  "filters": [
    {
      "subprop_type": "event",
      "subprop_key": "EmailVerified",
      "subprop_op": "is",
      "subprop_value": ["true"]
    },
    {
      "subprop_type": "user",
      "subprop_key": "gp:SignUpDate",
      "subprop_op": "is",
      "subprop_value": ["2021-08-18"]
    }
  ],
  "group_by": [
    {
      "type": "user",
      "value": "platform"
    }
  ]
}

Segment definition

Segments filter users based on their properties or behaviors. Each segment is a JSON object.

Segment definition examples

User property filter

Filter users by property values.

json
[
  {
    "prop": "version",
    "op": "contains",
    "values": ["1.0", "2.0"]
  },
  {
    "prop": "gp:gender",
    "op": "is",
    "values": ["female"]
  }
]

"Who performed" filter

Filter users who performed a specific event. This example filters users who performed the signup - end signup event at least once in the last 30 days.

json
[
  {
    "op": ">=",
    "type": "event",
    "event_type": "signup - end signup",
    "filters": [],
    "value": 0,
    "time_type": "forEachInterval",
    "time_value": 30
  }
]

You can combine multiple filters. This example filters users in the United States who performed the signup - end signup event at least once.

json
[
  {
    "prop": "country",
    "op": "is",
    "values": ["United States"]
  },
  {
    "op": ">=",
    "type": "event",
    "event_type": "signup - end signup",
    "filters": [],
    "value": 1,
    "time_type": "allTime"
  }
]

Export data tables

You can use the Dashboard REST API to export data from data tables. Query any Data Table chart type, and don't include start or end dates in the query.

Get results from an existing chart

Get JSON results from any saved chart by chart ID. GET https://amplitude.com/api/3/chart/chart_id/csv

curl --location --request GET 'https://amplitude.com/api/3/chart/:chart_id/csv' \
-u '{api_key}:{secret_key}'

Path variables

Response

Responses vary based on the chart's type.

Get active and new user counts

Get the number of active or new users.

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

curl --location --request GET 'https://amplitude.com/api/2/users?start=STARTDATE&end=ENDDATE' \
-u '{api_key}:{secret_key}'

Query parameters

Response

The response is a JSON object with this schema:

json
{
  "data": {
    "series": [
      [46109, 47542],
      [42845, 42626]
    ],
    "seriesMeta": ["United States", "Canada"],
    "xValues": ["2017-08-14", "2017-08-15"]
  }
}

Get session length distribution

Get the number of sessions for each predefined length (bucket) period during a specified date range.

GET https://amplitude.com/api/2/sessions/length

curl --location --request GET 'https://amplitude.com/api/2/sessions/length?start=STARTDATE&end=ENDDATE'
-u '{api_key}:{secret_key}'

Query parameters

timeHistogramConfigBin format

To use custom binning, specify timeHistogramConfigBinMin, timeHistogramConfigBinMax, and timeHistogramConfigBinTimeUnit. When timeHistogramConfigBinSize isn't specified, Amplitude finds the best bin sizing. For example, with timeHistogramConfigBinMin=0, timeHistogramConfigBinMax=10, and timeHistogramConfigBinTimeUnit=minutes, the final number of bins or bin bounds isn't guaranteed. With timeHistogramConfigBinSize=1, there are 10 bins and each bin size equals a minute.

When timeHistogramConfigBin parameters are invalid or missing, Amplitude uses default bins that account for behaviors such as bounce rate. The default bins, in milliseconds, are: [0, 3000), [3000, 10,000), [10,000, 30,000), [30,000, 60,000), [60,000, 180,000), [180,000, 600,000), [600,000, 1,800,000), [1,800,000, 3,600,000), [3,600,000, 86,400,000).

Session lengths have a maximum length of 1 day (86,400,000 ms).

Response

The response is a JSON object with this schema:

json
{
  "data": {
    "series": [
      [0, 120408, 2261, 6984, 10778, 54529, 210614, 336605, 196235, 54148]
    ],
    "xValues": [
      "0s-60s",
      "60s-120s",
      "120s-180s",
      "180s-240s",
      "240s-300s",
      "300s-360s",
      "360s-420s",
      "420s-480s",
      "480s-540s",
      "540s-600s"
    ]
  }
}

Get average session length

GET https://amplitude.com/api/2/sessions/average

Get the average session length (in seconds) for each day in the specified date range.

curl --location --request GET 'https://amplitude.com/api/2/sessions/average?start=20210601&end=20210630' \
-u '{api_key}:{secret_key}'

Query parameters

Response

Returns a JSON object with this schema:

json
{
  "data": {
    "series": [[1204.0238276716443, 1197.4160169086904]],
    "seriesMeta": [{ "segmentIndex": 0 }],
    "xValues": ["2017-08-14", "2017-08-15"]
  }
}

Get average sessions per user

GET https://amplitude.com/api/2/sessions/peruser

Get the average number of sessions per user on each day in the specified date range.

curl --location --request GET 'https://amplitude.com/api/2/sessions/peruser?start=&end=' \
-u '{api_key}:{secret_key}'

Query parameters

Response

Returns a JSON object with this schema:

json
{
  "data": {
    "series": [[3.624536794878406, 3.6232302614435854]],
    "seriesMeta": [{ "segmentIndex": 0 }],
    "xValues": ["2017-08-14", "2017-08-15"]
  }
}

User composition

Get the distribution of users across values of a user property in the specified date range.

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

curl --location --request GET 'https://amplitude.com/api/2/composition?start=STARTDATE&end=ENDDATE&p=PROPERTY' \
-u '{api_key}:{secret_key}'

Query parameters

Response

Returns a JSON object with this schema:

json
{
  "data": {
    "series": [[69643, 47419, 38087, 19064]],
    "seriesLabels": ["version"],
    "xValues": ["1.0", "(none)", "1.1", "0.2"]
  }
}

Get events list

Get the list of events with the current week's totals, uniques, and % DAU (daily active users).

This endpoint returns only visible events.

GET https://amplitude.com/api/2/events/list

curl --location --request GET 'https://amplitude.com/api/2/events/list' \
-u '{api-key}:{secret-key}'

Response

Returns a JSON object with this schema:

json
{
    "data": [
        {
            "non_active": false,
            "value": "Add Content to Cart",
            "totals": 1505645,
            "deleted": false,
            "flow_hidden": false,
            "hidden": false,
            "display": "Add Content to Cart"
        },
        {
            "non_active": false,
            "value": "Add Friends",
            "totals": 193167,
            "deleted": false,
            "flow_hidden": false,
            "hidden": false,
            "display": "Add Friends"
        }
    ]
    ...
}

Event segmentation

Get metrics for an event with segmentation.

curl --location --request GET 'https://amplitude.com/api/2/events/segmentation?e={"event_type":"YOUR%20EVENT"}&start=STARTDATE&end=DATE' \
-u '{api-key}:{secret-key}'

URL encode special characters in event types, event properties, and user property names. For example, encode Play Song as Play%20Song.

Query parameters

Response

json
{
    "data": {
        "series": [
            [273333], [190351]
        ],
        "seriesLabels": ["United States", "Germany"],
        "seriesCollapsed": [
            [
                {"value": 273333}
            ],
            [
                {"value": 190351}
            ],
        "xValues": ["2014-10-01", "2014-10-02"]
    }
}

Funnel analysis

Get funnel drop-off and conversion rates.

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

curl --location -g --request GET 'https://amplitude.com/api/2/funnels?e={"event_type":"EVENT_1"}&e={"event_type":"EVENT_2"}&start=STARTDATE&end=ENDDATE'
-u '{api_key}:{secret_key}'

Query parameters

Response

The response includes an array with one element per group. Each element has these fields:

json
{
  "data": [
    {
      "meta": { "segmentIndex": 0 },
      "dayMedianTransTimes": {
        "series": [
          [0, 165548, 264380],
          [0, 164767, 269444]
        ],
        "xValues": ["2017-08-14", "2017-08-15"],
        "formattedXValues": ["Aug 14", "Aug 15"]
      },
      "dayAvgTransTimes": {
        "series": [
          [0, 2294365, 5730478],
          [0, 2268879, 5700436]
        ],
        "xValues": ["2017-08-14", "2017-08-15"],
        "formattedXValues": ["Aug 14", "Aug 15"]
      },
      "stepByStep": [1.0, 0.9915120144246691, 0.9741139357951383],
      "medianTransTimes": [0, 166444, 270194],
      "cumulative": [1.0, 0.9915120144246691, 0.9658456707593803],
      "cumulativeRaw": [163054, 161670, 157485],
      "avgTransTimes": [0, 2175406, 5607243],
      "dayFunnels": {
        "series": [
          [125259, 123716, 118636],
          [126964, 125373, 119986]
        ],
        "xValues": ["2017-08-14", "2017-08-15"],
        "formattedXValues": ["Aug 14", "Aug 15"]
      },
      "events": [
        "Search Song or Video",
        "Select Song or Video",
        "Play Song or Video"
      ]
    }
  ]
}

Retention analysis

Get user retention for specific starting and returning actions.

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

curl --location --request GET 'https://amplitude.com/api/2/retention?se={"event_type":"STARTEVENT"}&re={"event_type":"RETURNEVENT"}&start=STARTDATE&end=ENDDATE' \
-u '{api_key}:{secret_key}'

Query parameters

Response

json
{
    "data": {
        "series": [
            {
                "dates": ["Aug 15", "Aug 14"],
                "values": {
                    "Aug 14": [
                        {"count": 12864, "outof": 12864, "incomplete": false}, {"count": 9061, "outof": 12864, "incomplete": false}, ..., {"count": 1561, "outof": 12864, "incomplete": true}
                    ],
                    "Aug 15": [
                        {"count": 14720, "outof": 14720, "incomplete": false}, {"count": 10249, "outof": 14720, "incomplete": false}, ..., {"count": 1773, "outof": 14720, "incomplete": true}
                    ],
                },
                "combined": [
                    {"count": 27584, "outof": 27584, "retainedSetId": null, "incomplete": false},
                    {"count": 19310, "outof": 27584, "retainedSetId": null, "incomplete": false},
                    ...
                    {"count": 1561, "outof": 12864, "retainedSetId": null, "incomplete": true}
                ]
            },
        "seriesMeta": [
            {"segmentIndex": 0, "eventIndex": 0}
            ]
        ]
    }
}

User activity

Get a user summary and the user's most or least recent events. Exceeding the request limits returns 429 errors.

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

curl --location --request GET 'https://amplitude.com/api/2/useractivity?user={amplitude_id}'
-u '{api_key}:{secret_key}'

Query parameters

Response

The response is a JSON object with this schema:

json
{
    "userData": {
        "user_id": "myusername",
        "canonical_amplitude_id": 12345,
        "merged_amplitude_ids": [11111, 22222],
        "num_events": 142,
        "num_sessions": 23,
        "usage_time": 2570259,
        "first_used": "2015-03-14",
        "last_used": "2015-04-22",
        "purchases": 2,
        "revenue": 9.98,
        "platform": "iOS",
        "os": "ios 8.2",
        "version": "3.4.9",
        "device": "Apple iPhone",
        "device_type": "Apple iPhone 6",
        "carrier": "AT&T",
        "country": "United States",
        "region": "California",
        "city": "San Francisco",
        "dma": "San Francisco-Oakland-San Jose, CA",
        "language": "English",
        "start_version": "1.2.3",
        "device_ids": ["some-device", "some-other-device"],
        "last_location": {
            "lat": 37.133,
            "lng": -122.241
        },
        "properties": {
            "gender": "female"
        }
    },
    "events": [...]
}

Search for a user by Amplitude ID, device ID, user ID, or user ID prefix. Exceeding the request limits returns 429 errors.

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

curl --location --request GET 'https://amplitude.com/api/2/usersearch?user=USER_ID' \
-u '{api-key}:{secret-key}'

Query parameters

Response

json
{
  "matches": [
    {
      "user_id": "myusername",
      "amplitude_id": 12345
    }
  ],
  "type": "match_user_or_device_id"
}

If there are no matches, the API returns a 200 response with the following body:

json
{
  "type": "nomatch",
  "matches": []
}

Real-time active users

Get active user numbers with 5-minute granularity for the last two days.

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

curl --location --request GET 'https://amplitude.com/api/2/realtime' \
-u '{api-key}:{secret-key}'

Response

Returns a JSON object with this schema:

json
{
    "data": {
        "xValues": ["15:00", "15:05", "15:10", ... ],
        "seriesLabels": ["Today", "Yesterday"],
        "series": [
            [123, 144, 101, ...],
            [139, 111, 180, ...]
        ]
    }
}

Revenue lifetime value

Get the lifetime value of new users.

GET https://amplitude.com/api/2/revenue/ltv

Learn more about the Revenue LTV chart.

curl --location --request GET 'https://amplitude.com/api/2/revenue/ltv?start=&end=' \
-u '{api-key}:{secret-key}'

Query parameters

Response

Returns a response containing JSON objects with this schema:

json
{
    "data": {
        "seriesLabels": [""],
        "series": [
            {
                "dates": ["2021-10-04", "2021-10-03", "2021-10-02", "2021-10-01"],
                "values": {
                    "2014-10-01": {
                        "r1d": 9.99,
                        "r2d": 19.98,
                        ...
                        "r90d": 742.52,
                        "count": 110,
                        "paid": 37,
                        "total_amount": 781.39
                    },
                    ...
                }
            }
        ]
    }
}

Was this helpful?