Create API Token

Create your API Bearer Token key

MainBrainer supports JWT Bearer Authentication to authenticate all API requests. This endpoint creates the access token that must be passed in the Authorization header of all your API requests on MainBrainer. To create the access token, you’ll need to pass your account’s private token in your request.You can also set your token validity. Log into your account and get your account’s private token from the Account Configuration menu.

Request
Request Body schema:

Create a token to use further API POST API/token { "username": "xxxxxxxxxxx@xxxxx. com", "password": "xxxxxxx", "privatetoken": "00000000-0000-0000-0000-000000000000" }

userName
string or null
Default: "[email protected]"

The email address with which your account is registered on MainBrainer.com

password
string or null
Default: "xxxxxxxxxxx"

The password you use to access your MainBrainer account.

privateToken
string or null
Default: "00000000-0000-0000-0000-000000000000"

The private token assigned to your MainBrainer account and available under your account’s configuration menu.

validity
string (LKP.eTokenValidity)

The period for which you want your access token to remain valid.

Enum: "Default" "ShortLive" "LongLive"
Responses
200

Returns the newly created token

400

If the item is null

401

Unauthorized

409

Conflict

422

Client Error

500

Server Error

post/token
Request samples
{
  • "userName": "[email protected]",
  • "password": "xxxxxxxxxxx",
  • "privateToken": "00000000-0000-0000-0000-000000000000",
  • "validity": "Default"
}
Response samples
{
  • "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiMyIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3J",
  • "token_type": "Bearer",
  • "expires_in": 120,
  • "userName": "Tom",
  • "issued": "2020-05-29T04:21:56.0000000+00:00",
  • "expires": "2020-05-29T06:21:56.0000000+00:00",
  • "timeZoneOffset": "UTC+00.00",
  • "locale": "en-US"
}