Obtaining a token

Labelf uses the standard oAuth 2 workflow with a key and a secret, which you use to obtain a bearer token.

The bearer token can then be used to authenticate your API requests

Step 1: Create your client credentials

Navigate to the API section of labelf.ai(Link here)  and hit "Create new API credentials" at the bottom of the page
You will now see your new credentials!

Step 2: Save/copy the credentials

Save the client ID and client secret from the mid section in the image above and generate your own bearer tokens using curl or your favorite coding language.

Keep in mind that the client credentials will only be showed when you generate them, and make sure to store them somewhere safe. If you lose them, you will have to generate a new set of credentials.

Step 3: Aquire a Bearer Token

Finally some code! This is standard for most APIs so we'll go through it quickly! If you want to read more about revoking credentials and more see our API documentation.

We need to send our client id and client secret which can be seen as a basic login with a username and password to obtain our token.

import requests

data = {
    'grant_type': 'client_credentials',

response = requests.post('https://auth.app.labelf.ai/oauth2/token', data=data, verify=False, auth=('CLIENT_ID', 'CLIENT_SECRET'))

fetch('https://auth.app.labelf.ai/oauth2/token', {
    method: 'POST',
    headers: {
        'Authorization': 'Basic ' + btoa('CLIENT_ID:CLIENT_SECRET')
    body: new URLSearchParams({
        'grant_type': 'client_credentials'

curl -k -X POST -H \
"Content-Type: application/x-www-form-urlencoded" \
-d grant_type=client_credentials \ https://auth.app.labelf.ai/oauth2/token

Use the code above to get your bearer token. If we do not have an example for your favourite language, you can use the cURL example and translate it!

Remember to replace CLIENT_ID and CLIENT_SECRET with your own credentials!

Excpected response:

HTTP/1.1 200 OK 
Status: 200 OK
Content-Type: application/json; charset=utf-8 
"access_token": "asdAASDASDASD_SASDASD", 
"expires_in": 3122063999, 
"scope": "",
"token_type": "bearer" 

Step 4: Use your model!

We can now move on to the section using a model:
Using a model
Change Cookie Settings