API Authentication

Learn how to authenticate your API requests.

Authentication Methods

API Keys

The primary method for API authentication:

  • Generate keys in Settings

  • Include in request headers

  • Keys are tied to your account

  • Full access based on your permissions

JWT Tokens

For web applications and OAuth flows:

  • Obtained through Auth0 login

  • Short-lived access tokens

  • Include in Authorization header

Using API Keys

Getting an API Key

1

Go to Settings > API Keys

2

Click Create API Key

3

Name your key (e.g., "Integration Key")

4

Copy the key immediately

5

Store it securely

Important: The key is only shown once. If you lose it, create a new one.

Including the Key in Requests

Add the key to the Authorization header:

Example Request

JWT Token Authentication

Obtaining a Token

1

Redirect user to Auth0 login

2

User authenticates

3

Receive access token

4

Use token in requests

Using the Token

Include the JWT in requests:

Token Expiration

  • Check exp claim for expiration

  • Refresh tokens before expiry

  • Re-authenticate if expired

Security Best Practices

Protect Your Keys

  • Never share API keys

  • Don't commit keys to code repositories

  • Use environment variables

  • Rotate keys periodically

Use HTTPS

Always use HTTPS for API requests:

  • Encrypts data in transit

  • Protects your credentials

  • Required for all endpoints

Least Privilege

  • Create keys with minimum needed access

  • Use separate keys for different integrations

  • Revoke unused keys

Monitor Usage

  • Review API key activity

  • Check for unusual patterns

  • Investigate unexpected usage

Permissions

API access respects your account permissions:

  • You can only access what you can access in the UI

  • Tenant isolation is enforced

  • Admin endpoints require admin role

Error Responses

chevron-right401 Unauthorizedhashtag

Solutions:

  • Check that you included the Authorization header

  • Verify your API key is correct

  • Ensure the key hasn't been revoked

chevron-right403 Forbiddenhashtag

Solutions:

  • Verify you have the required role

  • Check resource belongs to your tenant

  • Contact admin for access

Revoking Keys

If a key is compromised:

1

Go to Settings > API Keys

2

Find the compromised key

3

Click Revoke

4

Create a new key

5

Update your integrations

Testing Authentication

Verify Your Key Works

Expected response:

Common Issues

chevron-right"Invalid token" errorhashtag
  • Check for typos in the key

  • Ensure no extra spaces

  • Verify key hasn't been revoked

chevron-right"Token expired" errorhashtag
  • For JWT: obtain a new token

Last updated

Was this helpful?