Authentication Overview

API Authentication Documentation

Welcome to the API authentication guide. This document provides instructions on how to authenticate your API requests to ensure secure access to the system.

📘

Get developer keys at the Developer Dashboard

Authentication Methods

Our API supports three primary methods of authentication:

  1. Token Authentication
  2. Session Authentication
  3. Basic Authentication

1. Token Authentication

Token Authentication allows you to authenticate by including a unique token in your API requests. This token is generated when you log in.

Acquiring a Token

To get a token, send a POST request to the login endpoint with your username and password.

Endpoint:

POST /api/login/

Request Body:

{
    "username": "your_username",
    "password": "your_password"
}

Response:

{
    "key": "your_api_token"
}

Save the key from the response, as this will be your token for all authenticated requests.

Using the Token

To use the token, include it in the Authorization header of your API requests:

Header:

Authorization: Token your_api_token

Example Request:

GET /api/selected-endpoint/
Authorization: Token your_api_token

2. Session Authentication

Session Authentication uses a session ID stored in a cookie to verify user identity. This is useful for web applications where login sessions are managed automatically.

Using Session Authentication

  1. Log in to the web interface or use the login endpoint.
  2. The session cookie will be automatically included in subsequent requests.

No additional headers are needed once you are logged in.

3. Basic Authentication

Basic Authentication requires you to include your username and password with each API request. This method is simple but less secure.

Using Basic Authentication

Encode your username and password in base64, then include it in the Authorization header.

Header:

Authorization: Basic base64_encoded_username:password

Example Request:

GET /api/your-endpoint/
Authorization: Basic base64_encoded_username:password

Example: Basic Authentication in cURL

Here's how you can use Basic Authentication with cURL:

curl -u your_username:your_password https://api.yourservice.com/api/your-endpoint/

For Token Authentication with cURL:

curl -H "Authorization: Token your_api_token" https://api.yourservice.com/api/your-endpoint/

Summary

  • Token Authentication: Preferred method, use the token obtained from the login endpoint.
  • Session Authentication: Suitable for web applications, managed via cookies.
  • Basic Authentication: Simple but less secure, include base64-encoded credentials with each request.

For further assistance or details, please refer to the official API documentation or contact support. Happy coding!