API Documentation

Tracking Generation API (Price Depend on vendor and service)

API Integration Guide

This guide provides instructions on how to integrate with the USPS tracking API using your sub-API key.

Base URL

https://my.labelscheap.com/

Endpoint

GET /api/generate_tracking.php
2. Required Parameters
Parameter Type Description
user_name String The username associated with the API key.
api_key String The valid API key provided to the user.
class String The class of tracking (e.g., ground_advantage, priority).
count Integer The number of tracking numbers to generate.
cURL Example
curl -X GET 
"https://my.labelscheap.com/api/generate_tracking.php?user_name=johndoe&api_key=abc123&class=ground_advantage&count=5"
                                
PHP Example

$api_url = "https://my.labelscheap.com/api/generate_tracking.php";
$params = [
    'user_name' => 'johndoe',
    'api_key' => 'abc123',
    'class' => 'ground_advantage',
    'count' => 5
];
$url = $api_url . '?' . http_build_query($params);
$response = file_get_contents($url);
$data = json_decode($response, true);
print_r($data);

                                
Python Example
import requests
url = "https://my.labelscheap.com/api/generate_tracking.php"
params = {
    'user_name': 'johndoe',
    'api_key': 'abc123',
    'class': 'ground_advantage',
    'count': 5
}
response = requests.get(url, params=params)
print(response.json())
                                
JavaScript Example
fetch("https://my.labelscheap.com/api/generate_tracking.php?user_name=johndoe&api_key=abc123&class=ground_advantage&count=5")
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
                                
Node.js Example
const axios = require('axios');
const params = {
    user_name: 'johndoe',
    api_key: 'abc123',
    class: 'ground_advantage',
    count: 5
};
axios.get('https://my.labelscheap.com/api/generate_tracking.php', { params })
    .then(response => console.log(response.data))
    .catch(error => console.error('Error:', error));
                                
VB Example
Dim client As New WebClient()
Dim url As String = "https://my.labelscheap.com/api/tracking.php?user_name=johndoe&class=rollo&service=ground_advantage&api_key=abc123"
Dim response As String = client.DownloadString(url)
Console.WriteLine(response)
                                
Example Response
{
    "tracking_numbers" : 
        [
            "XXXXXXXXXXXXXXXXXXX",
            "XXXXXXXXXXXXXXXXXXX",
            "XXXXXXXXXXXXXXXXXXX",
            "XXXXXXXXXXXXXXXXXXX"
        ]
 }
3. Common Errors
  • User not found: This occurs if the user_name does not match any entry in the users table.
  • Invalid or inactive API key: This happens if the API key provided is incorrect or inactive.
  • Low balance: This error occurs when the user's current_balance is less than 1.
  • Transaction failed: This happens when an error occurs during the database update or API call process.
  • Invalid format: The provided parameters are not correctly formatted (e.g., missing or incorrectly named parameters).
Important Notes
  • User Profile: The user's user_id will be updated from the user profile page.
  • API Keys Management: API keys are managed under the Developer Tools section. Users can generate, revoke, or view their keys.
  • Click Logs: All API requests are logged under the Logs section in the Developer Tools.
Services
ServiceSlug
Prioritypriority
Ground Advantageground_advantage
Priority Expresspriority_express
First Classfirst_class
Vendors
Vendor
Shippo (shippo)
Rollo (rollo)
Easyship(easyship)
Easypost(easypost)
EVS (evs)
Pitney Bowes (pitneybowes)
Supported class by a vendor
VendorSlug
Shippopriority
Shippoground_advantage
Shippopriority_express
Rolloground_advantage
Rollopriority
Easyshippriority
Easyshipground_advantage
Easypostfirst_class
Easypostpriority_express
EVSpriority
EVSground_advantage
Pitney Bowespriority_express
Pitney Bowesfirst_class
ATFMground_advantage
Preshipment preship

If you have any questions, feel free to contact our support team!