Skip to main content

Authentication

This API requires authentication to access its endpoints. Authentication is managed using a bearer token in the HTTP Authorization header. The bearer token is a string that must be included in the Authorization header of each request to the API.

Receiving a Token

Follow these steps to obtain a bearer token:

  1. Ensure you are registered as a user with the API service.
  2. Send a POST request to the /api/token endpoint with your registered username and password.

The API service will respond with an access token, a refresh token, and the token type. The access token is used to authenticate your requests to the API service. The refresh token is used to obtain a new access token when the current access token expires. The token type is always bearer.

Request Example

POST /api/token

Headers:

Content-Type: application/x-www-form-urlencoded

Form Data:

username: admin
password: admin

Full URL:

https://api.energypeople.com.au/api/token

Response Example

Status Code: 200 OK

Body:

{
"access_token": "eyJhbGciOiJIUzI1NiI...",
"refresh_token": "eyJhbGciOiJIUzI1NiI...",
"token_type": "bearer",
"carrier_type": ""
}