Skip to main content
The Sunbird AI API uses Bearer Token authentication. You must include a valid access token in the Authorization header of your HTTP requests.

Overview

  1. Register an account.
  2. Login to obtain an access token.
  3. Include the token in your requests.

Registration

To start using the API, you need to create an account. You have two options:
You will need a valid email address.

Getting an Access Token

After registering, exchange your credentials for an access token using the /auth/token endpoint. Note that this endpoint expects form-encoded data, not JSON.
The response will include your token:

Using the Token

Include the token in the Authorization header of your requests:

Example Request

Token Lifetime

Access tokens do not expire. Your token effectively acts as your API key — use the same token to authenticate every request to the Sunbird AI API. Generate it once (from the tokens page or the /auth/token endpoint), store it securely, and reuse it. If a request returns a 401 Unauthorized error, the token is missing or invalid — double-check that it is included correctly in the Authorization header.

Security Best Practices

Never commit your API tokens or passwords to version control (like GitHub).
  • Environment Variables: Store your tokens in environment variables (e.g., SUNBIRD_API_TOKEN).
  • Backend Proxy: If you are building a frontend application, route requests through your own backend to keep your credentials hidden. Do not expose your token in client-side code.

OAuth Integration

We support Google OAuth for easier login. This is primarily handled via our web interface, but the underlying flow uses standard OAuth 2.0 protocols.

Common Errors