API Documentation

Tracking API at $0.10

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/track.php
2. Required Parameters
user_name The username associated with the API key.
tracking The USPS tracking number to be queried.
api_key The valid API key provided to the user.
cURL Example
curl -X GET "https://my.labelscheap.com/api/track.php?user_name=johndoe&tracking=123456789&api_key=abc123"
                                
PHP Example

// Prepare the API endpoint and parameters
$api_url = "my.labelscheap.com/api.php";
$params = [
    'user_name' => 'johndoe',
    'tracking' => '123456789',
    'api_key' => 'abc123'
];

// Build the URL with parameters
$url = $api_url . '?' . http_build_query($params);

// Fetch the response
$response = file_get_contents($url);

// Decode the response
$data = json_decode($response, true);

// Output the result
print_r($data);

                                
Python Example
import requests

# Prepare the API endpoint and parameters
url = "my.labelscheap.com/api.php"
params = {
    'user_name': 'johndoe',
    'tracking': '123456789',
    'api_key': 'abc123'
}

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

# Print the response in JSON format
print(response.json())
                                
JavaScript Example
fetch("https://my.labelscheap.com/api/tracking.php?user_name=johndoe&tracking=123456789&api_key=abc123")
    .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',
    tracking: '123456789',
    api_key: 'abc123'
};

axios.get('https://my.labelscheap.com/api/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&tracking=123456789&api_key=abc123"
Dim response As String = client.DownloadString(url)
Console.WriteLine(response)
                                
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 tracking number: The tracking number does not exist or is not valid in the USPS system.
  • 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.

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