Authentication
Authentication with the Thinkeo API is done using bearer tokens. The process involves several steps to obtain a permanent token for your team.
Token Creation Process
1. Initial Login
First, authenticate with your Thinkeo credentials to get a temporary accessToken. This token will be used to identify the Teams accessible with your account and retrieve the Team ID for which you want to create a permanent bearer token.
Make a POST request to /auth/login:
curl -X POST https://api.thinkeo.io/v0/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "test@thinkeo.io",
"password": "xxxxxxx",
"rememberMe": false
}'
Example response:
{
"accessToken": "tkat_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0aGlua2VvMyIsInN1YiI6IjAxOGQ3ZTlhLWEyNDItNzkzOS04NGI5LWUwNzgxZWNmNjMzYyIsImV4cCI6MTcyNTYxNjM2NS4wLCJuYmYiOjAuMCwiaWF0IjoxNzI1NjE2MjQ1LjAsImp0aSI6ImFmNTE5ZDAzLTc1MmYtNGM5ZS1hZjYyLTM4NDA3ZDA5ODFjMiIsInNjb3BlIjozMDcyLCJ0ZWFtIjoiMDE5MDEwYjUtMWFlNC03OWFlLThlYjgtOTUwNWU1NDUwODliIiwic2Vzc2lvbiI6dHJ1ZX0.SUylFYFnUbAAHDUZD8kCBcVyWg-MxLE7qrMejguuwVw",
"refreshToken": "ZiV3Qg5WJNhShVwUYf049a3wEZm3OrPrBjRBltHyFyULxzlzcQs2oOS5zdfp-eOP"
}
Keep this accessToken for the next step. Note that it's only valid for a few minutes.
2. Identify Your Team
List the Teams accessible with your account using the temporary accessToken. From the response, you'll need to retrieve the ID of the Team for which you want to create your permanent bearer token.
Make a GET request to /teams:
curl -X GET https://api.thinkeo.io/v0/teams \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json"
Example response:
[
{
"id": "018eebbd-c47a-7d2c-a315-9f8c2e41b6d3",
"name": "Team A",
"stripeCustomerId": null,
"aiConfig": null
},
{
"id": "019010b5-e189-7f5d-b423-a0d7f5623c9e",
"name": "Team B",
"stripeCustomerId": null,
"aiConfig": null
}
]
Note down the ID of your desired Team for the next step.
3. Team-Specific Login
Create a new accessToken associated with your specific Team using the Team ID from the previous step.
Make another POST request to /auth/login:
curl -X POST https://api.thinkeo.io/v0/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "test@thinkeo.io",
"password": "xxxxxxx",
"teamId": "018eebbd-c47a-7d2c-a315-9f8c2e41b6d3",
"rememberMe": false
}'
Example response:
{
"accessToken": "tkat_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0aGlua2VvMyIsInN1YiI6IjAxOGQ3ZTlhLWEyNDItNzkzOS04NGI5LWUwNzgxZWNmNjMzYyIsImV4cCI6MTcyNTYxOTc1NS4wLCJuYmYiOjAuMCwiaWF0IjoxNzI1NjE5NjM1LjAsImp0aSI6ImQ4NDZmNGIxLWM1M2YtNDFiMi1hNDc0LTJkYjBlYTY1Yzk5ZiIsInNjb3BlIjozMDcyLCJ0ZWFtIjoiMDE5MDEwYjUtMWFlNC03OWFlLThlYjgtOTUwNWU1NDUwODliIiwic2Vzc2lvbiI6dHJ1ZX0.RBDazgeG4MSmLBT6zG23ds_6RFGnH_GBJEGD20tWLzQ",
"refreshToken": "oZ-ZzUQh7iFgvweEJzhFJnuat6qqMpaUO1eEIBSiM8qN9EbVaYG4K-NfYDIOJBSx"
}
4. Create Permanent Token
Finally, create a permanent bearer token for your Team. Make sure to set an expiration date that suits your needs.
Make a POST request to /tokens:
curl -X POST "https://api.thinkeo.io/v0/tokens?name=token_teamA&once=false&expiration=2024-09-07T00:00:00Z" \
-H "Authorization: Bearer YOUR_TEAM_ACCESS_TOKEN" \
-H "Content-Type: application/json"
Example response:
{
"id": "018eebbd-f94b-7a68-c531-b2e9d7f84a0f",
"teamId": "018eebbd-c47a-7d2c-a315-9f8c2e41b6d3",
"name": "token_teamA",
"expiration": "2024-09-07T00:00:00Z",
"createdAt": "2024-09-06T11:01:53.241234399Z",
"token": "tkak_qRXm9bNfLJTVUWoYzp15-3HKQSFD-nZxwEMCyAueghPiBcOlr_G7Jtv-TaLkdIjfw"
}
The "token" field in the response contains your permanent bearer token. You can use this token to authenticate all API requests for your Team's Apps until it expires.
Important: Store this token securely, as it provides access to all your Team's resources.