Articles on: API & Documentation

LootLabs API Documentation

Note: The API checks user data from the user that generated it, if you didn't fill in your MANDATORY creator details the API will have a failed response just like trying to create a link in the panel. In order to change creator setting Click Here

Loot Labs API Documentation - Create Link Shortener



API Endpoint:


POST https://be.lootlabs.gg/api/lootlabs/content_locker

Description:


This endpoint allows you to create a link shortener.
The endpoint supports both POST and GET requests

Request Body:


Field NameField DescriptionField MandatoryValidationOptions
titleThe title of the link. Mandatory String value, Max 30 characters.
urlThe final destination of the content monetizer, this is the link you're locking. Mandatory StringNeeds to be a valid link.
tier_idThe tier of the advertisements shown. Mandatory Numeric value, Options 1-3.1 - Trending & Recommended (MCPEDL Safe) / 2 - Gaming Offers & Recommendations / 3 - Profit Maximization
number_of_tasksThe max number of ads associated with the link shortener in a given session. Mandatory Numeric value between 1 and 5.1-5
themeThe theme of the link monetizer site. Optional Numeric value, Options 1-5, Default: 1. 1 - Classic / 2 - Sims / 3 - Minecraft / 4 - GTA / 5 - Space
thumbnailthumbnail is another name for our thumbnail, it's the little image/video in the link Optional Needs to be a valid linkCould be a link of any image format or a youtube link.


POST REQUESTS



Authorization:


When making POST requests to this API endpoint, you should include your API token in the "Authorization" header of your HTTP request. Set the header as follows:

Authorization: Bearer YOUR_API_TOKEN

Replace YOUR_API_TOKEN with your actual API token obtained from The Loot Labs Panel Under API.


Response:


If the request is successful, the API will respond with a success message and the details of the created link shortener.

Example POST Request:



POST https://be.lootlabs.gg/api/lootlabs/content_locker
{
"title": "hello",
"url": "https://yourlinkhere.com",
"tier_id": 1,
"number_of_tasks": 3,
"theme": 3,
"thumbnail": "https://example.com/thumbnail.jpg"
}


Example Successfull Response:



{
"type": "created",
"request_time": 256,
"message": {
            "title": "hello",
            "url": "https://yourlinkhere.com",
            "tier_id": 1,
            "number_of_tasks": 3,
            "theme": 3,
             "thumbnail": "https://example.com/thumbnail.jpg",
            "short": "xxxx",
            "loot_url": "https://loot-link.com/s?xxxx"
        }
}


Example Failed Response:


{
"type": "error",
"request_time": 6926,
"message": "Missing mandatory field: number_of_tasks"
}


GET REQUEST



We also support passing parameters in the query parameters GET request using the following syntax:

Authorization


Authorization is checked using the GET request with the query parameter called api_token=<YOURTOKEN> be sure to change yourtoken to the API token you generate in the panel.

Example GET Request:



GET https://be.lootlabs.gg/api/lootlabs/content_locker?api_token=<YOURTOKEN>&title=title&url=url.com&tier_id=3&number_of_tasks=3&theme=1&thumbnail=https://www.youtube.com/watch?v=dQw4w9WgXcQ

Example Successfull Response:



{
"type": "fetch",
"request_time": 2203,
"message": {
            "title": "title",
            "url": "url.com",
            "tier_id": 3,
            "number_of_tasks": 3,
            "theme": 1,
             "thumbnail": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
            "short": "xxxx",
            "loot_url": "https://loot-link.com/s?xxxx"
        }
}


Example Failed Response:



{
"type": "error",
"request_time": 889,
"message": "Internal Server Error"
}


Examples of Endpoint API integration:



Javascript/NodeJS POST request


const axios = require('axios');



// API Endpoint
const url = 'https://be.lootlabs.gg/api/lootlabs/content_locker';

// Replace 'YOUR_API_TOKEN' with your actual API token
const headers = {| xx | xx | xx |
| --- | --- | --- |
|  | xx | xx |
| xx | xx | xx |
    Authorization: 'Bearer YOUR_API_TOKEN'
};

// Request body data
const data = {
    title: 'hello',
    url: 'https://yourlinkhere.com',
    tier_id: 1,
    number_of_tasks: 3,
    theme: 3,
    thumbnail: 'https://example.com/thumbnail.jpg'
};

// Send POST request
axios.post(url, data, { headers: headers })
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error('Error:', error);
    });


Javascript/NodeJS GET request



const axios = require('axios');

// API Endpoint with query parameters
const api_token = 'YOUR_API_TOKEN'; // Replace with your actual API token
const url = `https://be.lootlabs.gg/api/lootlabs/content_locker?api_token=${api_token}&title=title&url=url.com&tier_id=3&number_of_tasks=3&theme=1&thumbnail=https://www.youtube.com/watch?v=dQw4w9WgXcQ`;

// Send GET request
axios.get(url)
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error('Error:', error);
    });


PHP POST Request



<?php


// API Endpoint
$url = 'https://be.lootlabs.gg/api/lootlabs/content_locker';

// Replace 'YOUR_API_TOKEN' with your actual API token
$headers = [
    'Authorization: Bearer YOUR_API_TOKEN',
    'Content-Type: application/json'
];

// Request body data
$data = [
    'title' => 'hello',
    'url' => 'https://yourlinkhere.com',
    'tier_id' => 1,
    'number_of_tasks' => 3,
    'theme' => 3,
    'thumbnail' => 'https://example.com/thumbnail.jpg'
];

// Initialize cURL session
$ch = curl_init($url);

// Set cURL options
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute cURL session and get the response
$response = curl_exec($ch);

// Close cURL session
curl_close($ch);

// Print response
echo $response;
?>


PHP GET request



<?php



// API Endpoint with query parameters

$api_token = 'YOUR_API_TOKEN'; // Replace with your actual API token

$url = 'https://be.lootlabs.gg/api/lootlabs/content_locker?api_token=' . $api_token . '&title=title&url=url.com&tier_id=3&number_of_tasks=3&theme=1&thumbnail=https://www.youtube.com/watch?v=dQw4w9WgXcQ';

// Initialize cURL session
$ch = curl_init($url);

// Set cURL options
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute cURL session and get the response
$response = curl_exec($ch);

// Close cURL session
curl_close($ch);

// Print response
echo $response;
?>


Python POST Request



import requests


# API Endpoint
url = "https://be.lootlabs.gg/api/lootlabs/content_locker"

# Replace 'YOUR_API_TOKEN' with your actual API token
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN"
}

# Request body data
data = {
    "title": "hello",
    "url": "https://yourlinkhere.com",
    "tier_id": 1,
    "number_of_tasks": 3,
    "theme": 3,
    "thumbnail": "https://example.com/thumbnail.jpg"
}

# Send POST request
response = requests.post(url, headers=headers, json=data)

# Print response
print(response.json())


Python GET Request



import requests

# API Endpoint with query parameters
api_token = "YOUR_API_TOKEN"  # Replace with your actual API token
url = f"https://be.lootlabs.gg/api/lootlabs/content_locker?api_token={api_token}&title=title&url=url.com&tier_id=3&number_of_tasks=3&theme=1&thumbnail=https://www.youtube.com/watch?v=dQw4w9WgXcQ"

# Send GET request
response = requests.get(url)

# Print response
print(response.json())

Updated on: 28/02/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!