Skip to content

EcoPhi API: Authentication

Learn how to set your password before starting to use the API and how to obtain an access token afterwards.

Setting the password

This step is only necessary one time (or if the password was reset). The desired password for the username is set using the provided one time password.

POST /set_password

Headers:

Authorization: Bearer b64($OTP)
x-api-key: $API-KEY

Body:

Content type: application/json

{
"user": "$USERNAME",
"pw": "$PASSWORD"
}

Obtain an access token

Obtain an access token using username and password to send requests to the API. The access token is valid for 12 hours; after that a new one has to be obtained.

POST /create_token

Headers:

Authorization: Basic b64($USERNAME:$PASSWORD)
x-api-key: $API-KEY

Example response:

Content type: application/json

{
"token": "$TOKEN",
"expires_in": 43200
}
  • expires_in: the validity of the token in seconds