Products API
The Products API allows external applications, smart POS terminals, and e-commerce storefronts to access your product catalog in real time. Products are scoped to your authenticated warehouse branch, providing localized stock levels, warehouse selling prices, purchase costs, and tax rules.
1. List Products
Retrieve a paginated list of catalog products available in the authenticated warehouse.
GET
/api/v1/public/productsScope: readQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | Integer | No | Number of records per page (default: 20, max: 100). |
page | Integer | No | Page number for pagination (default: 1). |
category_id | String / Integer | No | Filter products by Category ID or Hash ID (xid). |
Request Headers
| Header | Type | Required | Description |
|---|---|---|---|
X-Tracepos-Public-Key | String | Yes | Warehouse public API key |
X-Tracepos-Secret-Key | String | Yes | Warehouse secret API key |
Accept | String | Yes | application/json |
Code Samples
cURL
curl -X GET "https://app.tracepos.net/api/v1/public/products?limit=10" \
-H "X-Tracepos-Public-Key: YOUR_PUBLIC_KEY" \
-H "X-Tracepos-Secret-Key: YOUR_SECRET_KEY" \
-H "Accept: application/json"
Node.js (Axios)
const axios = require('axios');
async function getProducts() {
const response = await axios.get('https://app.tracepos.net/api/v1/public/products', {
params: { limit: 10 },
headers: {
'X-Tracepos-Public-Key': process.env.TRACEPOS_PUBLIC_KEY,
'X-Tracepos-Secret-Key': process.env.TRACEPOS_SECRET_KEY,
'Accept': 'application/json',
},
});
return response.data;
}
Python (Requests)
import os
import requests
headers = {
"X-Tracepos-Public-Key": os.getenv("TRACEPOS_PUBLIC_KEY"),
"X-Tracepos-Secret-Key": os.getenv("TRACEPOS_SECRET_KEY"),
"Accept": "application/json",
}
response = requests.get(
"https://app.tracepos.net/api/v1/public/products",
params={"limit": 10},
headers=headers,
)
print(response.json())
PHP (Guzzle)
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://app.tracepos.net/api/v1/public/']);
$response = $client->get('products', [
'headers' => [
'X-Tracepos-Public-Key' => getenv('TRACEPOS_PUBLIC_KEY'),
'X-Tracepos-Secret-Key' => getenv('TRACEPOS_SECRET_KEY'),
'Accept' => 'application/json',
],
'query' => ['limit' => 10],
]);
echo $response->getBody();
Response (200 OK)
{
"status": "success",
"data": {
"current_page": 1,
"per_page": 10,
"total": 450,
"data": [
{
"id": 45,
"xid": "w8vBqGZ0",
"name": "Coca-Cola 500ml Pet",
"slug": "coca-cola-500ml-pet",
"item_code": "5449000000996",
"product_type": "single",
"image_url": "https://app.tracepos.net/uploads/products/coke-500.png",
"category": {
"id": 12,
"name": "Beverages & Soft Drinks",
"slug": "beverages"
},
"details": [
{
"product_id": 45,
"warehouse_id": 1,
"current_stock": "280.00",
"sales_price": "500.00",
"purchase_price": "380.00",
"mrp": "550.00",
"tax_id": 1,
"sales_tax_type": "exclusive"
}
]
}
]
}
}
2. Get Single Product
Retrieve details for a specific product within the authenticated warehouse branch.
GET
/api/v1/public/products/{product-xid}Scope: readPath Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
product-xid | String / Integer | Yes | Product Hash ID (xid). Positive numeric IDs are accepted for backward compatibility. |
Code Samples
cURL
curl -X GET "https://app.tracepos.net/api/v1/public/products/<product-xid>" \
-H "X-Tracepos-Public-Key: <public-key>" \
-H "X-Tracepos-Secret-Key: <secret-key>" \
-H "Accept: application/json"
Node.js (Axios)
const axios = require('axios');
async function getProduct(productXid) {
const response = await axios.get(`https://app.tracepos.net/api/v1/public/products/${productXid}`, {
headers: {
'X-Tracepos-Public-Key': process.env.TRACEPOS_PUBLIC_KEY,
'X-Tracepos-Secret-Key': process.env.TRACEPOS_SECRET_KEY,
'Accept': 'application/json',
},
});
return response.data;
}
Python (Requests)
import os
import requests
headers = {
"X-Tracepos-Public-Key": os.getenv("TRACEPOS_PUBLIC_KEY"),
"X-Tracepos-Secret-Key": os.getenv("TRACEPOS_SECRET_KEY"),
"Accept": "application/json",
}
response = requests.get(
"https://app.tracepos.net/api/v1/public/products/<product-xid>",
headers=headers,
)
print(response.json())
PHP (Guzzle)
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://app.tracepos.net/api/v1/public/']);
$response = $client->get('products/<product-xid>', [
'headers' => [
'X-Tracepos-Public-Key' => getenv('TRACEPOS_PUBLIC_KEY'),
'X-Tracepos-Secret-Key' => getenv('TRACEPOS_SECRET_KEY'),
'Accept' => 'application/json',
],
]);
echo $response->getBody();
Response (200 OK)
{
"status": "success",
"data": {
"id": 45,
"xid": "w8vBqGZ0",
"name": "Coca-Cola 500ml Pet",
"slug": "coca-cola-500ml-pet",
"item_code": "5449000000996",
"product_type": "single",
"image_url": "https://app.tracepos.net/uploads/products/coke-500.png",
"category": {
"id": 12,
"name": "Beverages & Soft Drinks",
"slug": "beverages"
},
"brand": {
"id": 3,
"name": "Coca-Cola Company",
"slug": "coca-cola-company"
},
"details": [
{
"product_id": 45,
"warehouse_id": 1,
"current_stock": "280.00",
"sales_price": "500.00",
"purchase_price": "380.00",
"mrp": "550.00",
"tax_id": 1,
"sales_tax_type": "exclusive"
}
]
}
}
