Auth Method

You must have a valid access token to use the Eggplant AI API. To get this token, send your Eggplant AI account email and password to the auth endpoint. The response contains an access token, which is then used in an Authorization header prefixed with the word bearer and a space between the word bearer and the access token. Access tokens expire after one hour. Upon expiration, you will receive a 401 Unauthorized response from any of the REST API endpoints. Send your credentials again to the auth endpoint to get a new access token. Your scripts need to make allowances for access token expiration and renewal.


POST -> http://localhost:8000/auth


Name Value
Content-Type application/x-www-form-urlencoded

Body Parameters

Name Type Required
username Text Yes
password Text Yes

Possible Responses

Status Status Text Description
200 OK  
400 Bad request The required parameters were not sent
401 Bad request The credentials provided were not valid
403 Forbidden Not enough available concurrent user licenses

Response Body JSON

The first example below shows a typical successful response (Status 200).



"access_token": "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1Mjc3ODU3ODAsImlhdCI6MTUyNzc4MjE4MCwiaXNzIjoiZWdncGxhbnRhaS5jb20iLCJ1c2VyIjp7InVzZXJuYW1lIjoibWFydGluLmRhbm5AZWdncGxhbnQuaW8ifX0.I7oef6kA9F6gvY9HHsgMvLBka4JsmLTiQIB6gPt8xrU",

"expires_in": 3600,

"token_type": "bearer"


The next example shows Invalid Response Status 401 Unauthorized.



"message": "Not Authorized",

"description": "The credentials you provided are not valid."


Name Type Value
access_token Text <dynamic>
expires_in Integer (number of seconds until the token expires) 3600
token_type Text bearer


This topic was last updated on August 19, 2021, at 03:30:47 PM.

Eggplant icon | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant