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.

API Authentication

Amplitude APIs use different credentials depending on the endpoint. Check the API reference for the endpoint you call before sending a key.

Authenticate Analytics REST API requests

The Export API and Dashboard REST API use HTTP Basic authentication to read project data. Use the project's API key as the username and its secret key as the password. Keep the secret key on your server.

Send an Authorization header with the base64 encoding of api_key:secret_key:

http
Authorization: Basic <base64(api_key:secret_key)>

With cURL, -u creates the header for you:

bash
curl -u '{api_key}:{secret_key}' 'https://amplitude.com/api/2/export?start=20220101T00&end=20220101T01'

The HTTP V2 and Batch Event Upload APIs instead take the project API key in the JSON request body. They don't require a secret key. Other Amplitude APIs can use different credentials; follow the authentication section of the specific API reference.

If an authenticated request fails, check the endpoint's documented status codes, the credentials, and the API host for your project region. For instructions to rotate or revoke keys, refer to Manage your API keys and secret keys.

Find your API key and secret key

To find your Amplitude project's API key and secret key:

  1. In the Amplitude web app, select Settings in the lower-left navigation.
  2. Select Projects in the side navigation.
  3. Select the project whose keys you need. On the project's General tab, select Manage next to API Key or Secret Key to view and copy each value. Managers and Admins can generate, copy, and revoke API keys, and generate secret keys. Amplitude shows a secret key only when you generate it.

For more detail on creating, rotating, revoking, and deleting keys, refer to Manage your API keys and secret keys. For a reference on every key and token Amplitude uses, refer to Keys and Tokens.

Was this helpful?