POST /token

API endpoint that handles the authorization and the bearer access tokens.
These can be sent in both Basic Auth header or in the body of the request as shown down below.
You'll need this bearer token for your Authorization, which you'll use in the header of your request.

Request Information

Body Parameters

Name Description Type Additional information
username Email of the account string Required
password Password of the account string Required
client_id ID of the company you want to GET access to string | integer Required
grant_type

Type of grant you need. OAuth 2.0 Grant types

The default of this field is "password"

string Required
How to get a username?

In order to get a valid username, you'll need read/write permissions in the company that you want to use the API. Configure company »
Permissions revalidated every 2 hours

Examples

Javascript (Jquery)

                
                    var loginData = {
                        grant_type: "password",
                        username: "lorem",
                        password: "ipsum",
                        client_id: 999999
                    };
                    $.ajax({
                        type: 'POST',
                        url: 'https://businessapi.libax.com/token',
                        headers: { "Accept": "application/json" },
                        contentType: "application/x-www-form-url; charset=utf-8",
                        data: loginData
                    }).done(function (data) {
                        console.log(data)
                    });
                

C#

                
using (HttpClient client = new HttpClient())
{
    client.BaseAddress = "https://businessapi.libax.com;
    var request = new HttpRequestMessage(HttpMethod.Post, "/token");
    var formData = new <List<KeyValuePair<string, string>>
    {
        new KeyValuePair<string, string>("grant_type", "password"),
        new KeyValuePair<string, string>("username", username),
        new KeyValuePair<string, string>("password", password),
        new KeyValuePair<string, string>("client_id", client_id)
    };

    request.Content = new FormUrlEncodedContent(formData);

    HttpResponseMessage response = client.SendAsync(request).Result;

    string resultJSON = response.Content.ReadAsStringAsync().Result;

    dynamic result = Newtonsoft.Json.JsonConvert.DeserializeObject(resultJSON);

    string  AccessToken = result.access_token;
}
                    
                

Response

            
                    {
                        access_token: "oKJ5MzOUU1v23Iq5opzHFYyAnmFSxcegoq_VZb5yv3Cuztfail…SlCemcFrjYvnOqihcBZoASQG97wTbH3gBZFjc-cgTZWQhwYyg",
                        token_type: "bearer",
                        expires_in: 1799 //30min
                    }
                

How to use the requested token

Javascript (Jquery)

            
                    $.ajax({
                        url: endpoint,
                        method: "GET",
                        success: function(data) {
                            console.log("The returned data", data);
                        },
                        beforeSend: function(xhr, settings) { 
                            xhr.setRequestHeader('Authorization','Bearer ' + token); 
                        }
                    });
                

C#

                
                    using (HttpClient c = new HttpClient())
                    {
                        c.client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
                        HttpResponseMessage response =  c.GetAsync(endPoint).Result;
                    }