Getting an API Key and Creating Users
This article provides a step-by-step quick start process for working with the Albato Embedded API: obtaining a master token, creating an end-user account, using and refreshing the user token.
Quick Start with Albato Embedded API
This section will help you quickly get started with the Albato Embedded API for integrating automation into your SaaS solution.
1. Obtaining the Master Token of the Partner Account
To work with the Embedded API, you need the master token of your Albato partner account. You can get it in the Albato Embedded Panel (section Integrations) or request it from your account manager.
Important: All actions for creating and managing end-users are performed using the master token.
2. Creating an End-User Account
For each end user of your platform, you need to create a separate account in Albato. This is done via a special endpoint.
Example request to create a user
curl --header "Content-type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Basic <YOUR_MASTER_TOKEN>" \
--request POST \
--data '{"id":"test", "timezoneOffset": -180}' \
"https://api.albato.com/wl/partner-name/add-user"- Replace
<YOUR_MASTER_TOKEN>with your master token. <partner-name>is your partner identifier (contract) in Albato.- In the
idfield, specify the unique user identifier in your system. - In the
timezoneOffsetfield, specify the user's time zone.
Example of a successful response
{
"success": true,
"data": {
"id": 1357,
"email": "[email protected]",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}- The response will contain the end-user token (
data.token).
3. Using the End-User Token
All further requests to the Albato API (for example, to work with solutions, connections, automations, webhooks) are performed using the end-user token.
Example request with the end-user token
curl --header "Content-type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Basic <END-USER_TOKEN>" \
--request GET \
"https://api.albato.com/wl/<partner-name>/solution/apps"- Replace
<END-USER_TOKEN>with the received user token.
4. Refreshing the End-User Token
If the end-user token has expired, it can be refreshed using a special method.
Example request to refresh the token
curl --header "Content-type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Basic <YOUR_MASTER_TOKEN>" \
--request POST \
--data '{"id":"user-123"}' \
"https://api.albato.com/wl/<partner-name>/refresh-user-token"- The response will contain a new token for the end user.
If you have any questions, please contact your Albato manager or technical support.
Updated about 2 months ago
