Authorizations

In order to use the JS API you need to generate an API key that will be authenticating a given user.

Authorizing

To do that, simply call the following endpoint with the id of the user you want to provide access to

POST /api/v2/authorize

Request JSON Body:

{
    "api_key": "your_api_key",
    "user_id": "5409c35b97aac999d8c267371",
    "consumable": "True"
}
Parameter Type Required Default Status Description
api_key string True   stable Your API key
user_id string True   stable The id of the user
consumable True|False False False stable When set to True, the token will be valid for only one request (it will be imediately consumed)

JSON response:

{
    "user_id": "5409c35b97aac999d8c267371",
    "user_authorization_token": "5&SSkkals11&%409cAK:LADS879Asad;lksa"
}

To list current authorization tokens

GET /api/v2/authorize/list?api_key={your_api_key}&user_id={user_id}

Request JSON Body:

{
    "api_key": "your_api_key",
    "user_id": "5409c35b97aac999d8c267371",
}

JSON response:

{
    "user_id": "5409c35b97aac999d8c267371",
    "user_authorization_tokens": ["5&SSkkals11&%409cAK:LADS879Asad;lksa"]
}

Revoking

To logout a user, use the revoke call. If you provide a user_authorization_token it will only revoke this token. If you don’t provide this parameter, it will revoke all tokens for this user.

POST api/v2/authorize/revoke

Request JSON Body:

{
    "api_key": "your_api_key",
    "user_id": "5409c35b97aac999d8c267371",
    "user_authorization_token": "5&SSkkals11&%409cAK:LADS879Asad;lksa"
}

JSON response:

{
    "user_id": "5409c35b97aac999d8c267371",
    "user_authorization_tokens": []
}