API Authentication Guides

This guide explains how to authenticate your requests to our APIs. Secure authentication is crucial for protecting your data and ensuring the integrity of our services.

Authentication Methods

We support several authentication methods to cater to different use cases and security requirements. The primary method for most API interactions is token-based authentication.

1. Token-Based Authentication (OAuth 2.0)

This is the recommended and most common method for authenticating API requests. You'll obtain an access token, which you then include in the Authorization header of your requests.

Obtaining an Access Token

To get an access token, you'll need to perform an OAuth 2.0 flow. The specific flow depends on your application type:

You can initiate the OAuth 2.0 flow by making a POST request to our token endpoint:

POST /oauth2/token
Host: api.example.com
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET

Replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with your actual credentials. You can obtain these from your developer portal.

Using the Access Token

Once you have an access token, include it in the Authorization header of your API requests using the Bearer scheme:

GET /v1/users
Host: api.example.com
Authorization: Bearer YOUR_ACCESS_TOKEN

Replace YOUR_ACCESS_TOKEN with the token you received.

Note: Access tokens have an expiration time. You'll need to implement logic to refresh your tokens before they expire.

2. API Keys (Legacy / Specific Services)

For certain older services or specific functionalities, you might still use API keys. These are static keys that you include in a custom header or as a query parameter.

Using API Keys

Include your API key in the X-API-Key header:

GET /v1/data
Host: api.example.com
X-API-Key: YOUR_API_KEY
Important: API keys are generally less secure than OAuth 2.0 tokens. We strongly recommend migrating to token-based authentication wherever possible.

Security Best Practices

Tip: For detailed information on the OAuth 2.0 flows and token management, refer to the OAuth 2.0 Implementation Guide.

Troubleshooting Authentication

If you encounter authentication issues: