Overview
The inventory management workflow typically involves:- Fetching current stock levels across warehouses
- Monitoring inventory changes and levels
- Map between products and associated inventory items
Getting Inventory Data
Use the Get Inventory endpoint to retrieve current stock levels across all locations.Fetching All Inventory
curl -X GET https://production.trackstarhq.com/wms/inventory \
-H "x-trackstar-api-key: YOUR_API_KEY" \
-H "x-trackstar-access-token: YOUR_ACCESS_TOKEN"
import requests
url = "https://production.trackstarhq.com/wms/inventory"
headers = {
"x-trackstar-api-key": "YOUR_API_KEY",
"x-trackstar-access-token": "YOUR_ACCESS_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
const url = "https://production.trackstarhq.com/wms/inventory";
fetch(url, {
method: "GET",
headers: {
"x-trackstar-api-key": "YOUR_API_KEY",
"x-trackstar-access-token": "YOUR_ACCESS_TOKEN"
}
})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = "https://production.trackstarhq.com/wms/inventory";
$options = [
"http" => [
"header" =>
"x-trackstar-api-key: YOUR_API_KEY\r\n" .
"x-trackstar-access-token: YOUR_ACCESS_TOKEN\r\n",
"method" => "GET"
]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
echo $response;
?>
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://production.trackstarhq.com/wms/inventory"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("x-trackstar-api-key", "YOUR_API_KEY")
req.Header.Set("x-trackstar-access-token", "YOUR_ACCESS_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class TrackstarGetInventoryExample {
public static void main(String[] args) throws IOException, InterruptedException {
String url = "https://production.trackstarhq.com/wms/inventory";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("x-trackstar-api-key", "YOUR_API_KEY")
.header("x-trackstar-access-token", "YOUR_ACCESS_TOKEN")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Status: " + response.statusCode());
System.out.println("Body: " + response.body());
}
}
require 'net/http'
require 'uri'
url = URI('https://production.trackstarhq.com/wms/inventory')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request['x-trackstar-api-key'] = 'YOUR_API_KEY'
request['x-trackstar-access-token'] = 'YOUR_ACCESS_TOKEN'
response = http.request(request)
puts "Status: #{response.code}"
puts "Response: #{response.body}"
Sample Response
{
"data": [
{
"id": "inv_widget001_main",
"warehouse_customer_id": "customer_12345",
"created_date": "2024-01-15T10:00:00Z",
"updated_date": "2024-01-20T14:30:00Z",
"name": "Premium Widget",
"sku": "WIDGET-001",
"unit_cost": 25.00,
"active": true,
"awaiting": 100,
"onhand": 150,
"committed": 25,
"unfulfillable": 5,
"fulfillable": 120,
"unsellable": 0,
"sellable": 150,
"substitute_skus": [],
"inventory_by_warehouse_id": {
"warehouse_main": {
"onhand": 100,
"committed": 15,
"unfulfillable": 3,
"fulfillable": 82,
"unsellable": 0,
"sellable": 100,
"awaiting": 50
},
"warehouse_east": {
"onhand": 50,
"committed": 10,
"unfulfillable": 2,
"fulfillable": 38,
"unsellable": 0,
"sellable": 50,
"awaiting": 50
}
},
"lots": [
{
"lot_id": "LOT-W001-240115",
"onhand": 75,
"expiration_date": "2025-01-15"
}
],
"locations": [
{
"location_id": "A-01-15-02",
"warehouse_id": "warehouse_main",
"quantity": 75
},
{
"location_id": "B-02-08-01",
"warehouse_id": "warehouse_main",
"quantity": 25
}
],
"trackstar_tags": ["high-priority", {"category": "fast-mover"}],
"external_system_url": "https://wms.example.com/inventory/inv_widget001_main",
"additional_fields": {
"custom_field_1": "value1",
"warehouse_notes": "Premium product location"
},
"measurements": {
"length": 12.5,
"width": 8.0,
"height": 4.2,
"unit": "in",
"weight": 2.3,
"weight_unit": "lb"
}
},
{
"id": "inv_gadget002_main",
"warehouse_customer_id": "customer_12345",
"created_date": "2024-01-10T09:00:00Z",
"updated_date": "2024-01-18T16:45:00Z",
"name": "Smart Gadget",
"sku": "GADGET-002",
"unit_cost": 45.00,
"active": true,
"awaiting": 25,
"onhand": 75,
"committed": 10,
"unfulfillable": 0,
"fulfillable": 65,
"unsellable": 0,
"sellable": 75,
"substitute_skus": ["GADGET-002A"],
"inventory_by_warehouse_id": {
"warehouse_main": {
"onhand": 75,
"committed": 10,
"unfulfillable": 0,
"fulfillable": 65,
"unsellable": 0,
"sellable": 75,
"awaiting": 25
}
},
"lots": [],
"locations": [
{
"location_id": "C-03-12-01",
"warehouse_id": "warehouse_main",
"quantity": 75
}
],
"trackstar_tags": ["smart-device"],
"external_system_url": "https://wms.example.com/inventory/inv_gadget002_main",
"additional_fields": {
"electronics_category": "consumer",
"warehouse_notes": "Electronics section"
},
"measurements": {
"length": 6.8,
"width": 3.4,
"height": 1.8,
"unit": "in",
"weight": 0.8,
"weight_unit": "lb"
}
}
],
"next_token": null,
"total_count": 2
}
Understanding Inventory Levels
For detailed information about inventory breakdowns, see the Inventory Info page.Multi-Location Inventory
Trackstar tracks inventory across multiple warehouses and specific locations within each warehouse.Warehouse-Level Inventory
Each inventory item shows totals by warehouse:{
"inventory_by_warehouse_id": {
"warehouse_main": {
"onhand": 100,
"committed": 15,
"fulfillable": 85
},
"warehouse_east": {
"onhand": 50,
"committed": 10,
"fulfillable": 40
}
}
}
Location-Level Details
Specific storage locations within warehouses:{
"locations": [
{
"location_id": "A-01-15-02",
"warehouse_id": "warehouse_main",
"quantity": 75
},
{
"location_id": "B-02-08-01",
"warehouse_id": "warehouse_main",
"quantity": 25
}
]
}
Mapping Products to Inventory Items
Products and inventory items have a many-to-many relationship in Trackstar. A single product (identified by SKU) can map to multiple inventory items across different warehouses. To accurately get inventory levels for a product, you need to first fetch the product to get its associated inventory items.Fetching Product Information
Use the Get Product endpoint to retrieve a specific product and its inventory item mappings.curl -X GET https://production.trackstarhq.com/wms/products/prod_widget_001 \
-H "x-trackstar-api-key: YOUR_API_KEY" \
-H "x-trackstar-access-token: YOUR_ACCESS_TOKEN"
import requests
url = "https://production.trackstarhq.com/wms/products/prod_widget_001"
headers = {
"x-trackstar-api-key": "YOUR_API_KEY",
"x-trackstar-access-token": "YOUR_ACCESS_TOKEN"
}
response = requests.get(url, headers=headers)
print(response.json())
const url = "https://production.trackstarhq.com/wms/products/prod_widget_001";
fetch(url, {
method: "GET",
headers: {
"x-trackstar-api-key": "YOUR_API_KEY",
"x-trackstar-access-token": "YOUR_ACCESS_TOKEN"
}
})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = "https://production.trackstarhq.com/wms/products/prod_widget_001";
$options = [
"http" => [
"header" =>
"x-trackstar-api-key: YOUR_API_KEY\r\n" .
"x-trackstar-access-token: YOUR_ACCESS_TOKEN\r\n",
"method" => "GET"
]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
echo $response;
?>
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://production.trackstarhq.com/wms/products/prod_widget_001"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("x-trackstar-api-key", "YOUR_API_KEY")
req.Header.Set("x-trackstar-access-token", "YOUR_ACCESS_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class TrackstarGetProductExample {
public static void main(String[] args) throws IOException, InterruptedException {
String url = "https://production.trackstarhq.com/wms/products/prod_widget_001";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("x-trackstar-api-key", "YOUR_API_KEY")
.header("x-trackstar-access-token", "YOUR_ACCESS_TOKEN")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Status: " + response.statusCode());
System.out.println("Body: " + response.body());
}
}
require 'net/http'
require 'uri'
url = URI('https://production.trackstarhq.com/wms/products/prod_widget_001')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request['x-trackstar-api-key'] = 'YOUR_API_KEY'
request['x-trackstar-access-token'] = 'YOUR_ACCESS_TOKEN'
response = http.request(request)
puts "Status: #{response.code}"
puts "Response: #{response.body}"
Sample Product Response
{
"data": {
"id": "prod_widget_001",
"warehouse_customer_id": "customer_12345",
"created_date": "2024-01-01T00:00:00Z",
"updated_date": "2024-01-15T10:30:00Z",
"name": "Premium Widget",
"sku": "WIDGET-001",
"gtin": "1234567890123",
"unit_price": 29.99,
"inventory_items": [
{
"inventory_item_id": "inv_widget001_main",
"sku": "WIDGET-001",
"unit_quantity": 1
},
{
"inventory_item_id": "inv_widget001_east",
"sku": "WIDGET-001",
"unit_quantity": 1
}
],
"is_kit": false,
"active": true,
"supplier": "ACME Suppliers",
"supplier_object": {
"supplier_id": "ACME001",
"supplier_name": "ACME Suppliers Inc"
},
"country_of_origin": "US",
"harmonized_code": "9999999999",
"supplier_products": [
{
"supplier_id": "ACME001",
"supplier_name": "ACME Suppliers Inc",
"external_id": "ACME-WIDGET-001",
"unit_cost": "25.00"
}
],
"trackstar_tags": ["premium", {"priority": "high"}],
"external_system_url": "https://wms.example.com/products/prod_widget_001",
"additional_fields": {
"product_category": "widgets",
"marketing_description": "Our best-selling premium widget"
}
}
}
Getting Inventory Levels for Products
Once you have theinventory_item_id values from the product response, use the Get Inventory endpoint to retrieve current stock levels. The inventory_item_id from the product endpoint maps directly to the id field in the inventory endpoint.
curl -X GET https://production.trackstarhq.com/wms/inventory/inv_widget001_main \
-H "x-trackstar-api-key: YOUR_API_KEY" \
-H "x-trackstar-access-token: YOUR_ACCESS_TOKEN"
import requests
url = "https://production.trackstarhq.com/wms/inventory/inv_widget001_main"
headers = {
"x-trackstar-api-key": "YOUR_API_KEY",
"x-trackstar-access-token": "YOUR_ACCESS_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
const url = "https://production.trackstarhq.com/wms/inventory/inv_widget001_main";
fetch(url, {
method: "GET",
headers: {
"x-trackstar-api-key": "YOUR_API_KEY",
"x-trackstar-access-token": "YOUR_ACCESS_TOKEN"
}
})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = "https://production.trackstarhq.com/wms/inventory/inv_widget001_main";
$options = [
"http" => [
"header" =>
"x-trackstar-api-key: YOUR_API_KEY\r\n" .
"x-trackstar-access-token: YOUR_ACCESS_TOKEN\r\n",
"method" => "GET"
]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
echo $response;
?>
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://production.trackstarhq.com/wms/inventory/inv_widget001_main"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("x-trackstar-api-key", "YOUR_API_KEY")
req.Header.Set("x-trackstar-access-token", "YOUR_ACCESS_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class TrackstarGetInventoryItemExample {
public static void main(String[] args) throws IOException, InterruptedException {
String url = "https://production.trackstarhq.com/wms/inventory/inv_widget001_main";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("x-trackstar-api-key", "YOUR_API_KEY")
.header("x-trackstar-access-token", "YOUR_ACCESS_TOKEN")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Status: " + response.statusCode());
System.out.println("Body: " + response.body());
}
}
require 'net/http'
require 'uri'
url = URI('https://production.trackstarhq.com/wms/inventory/inv_widget001_main')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request['x-trackstar-api-key'] = 'YOUR_API_KEY'
request['x-trackstar-access-token'] = 'YOUR_ACCESS_TOKEN'
response = http.request(request)
puts "Status: #{response.code}"
puts "Response: #{response.body}"
Sample Inventory Item Response
{
"data": {
"id": "inv_widget001_main",
"warehouse_customer_id": "customer_12345",
"created_date": "2024-01-15T10:00:00Z",
"updated_date": "2024-01-20T14:30:00Z",
"name": "Premium Widget",
"sku": "WIDGET-001",
"unit_cost": 25.00,
"active": true,
"awaiting": 50,
"onhand": 100,
"committed": 15,
"unfulfillable": 3,
"fulfillable": 82,
"unsellable": 0,
"sellable": 100,
"substitute_skus": [],
"inventory_by_warehouse_id": {
"warehouse_main": {
"onhand": 100,
"committed": 15,
"unfulfillable": 3,
"fulfillable": 82,
"unsellable": 0,
"sellable": 100,
"awaiting": 50
}
},
"lots": [
{
"lot_id": "LOT-W001-240115",
"onhand": 75,
"expiration_date": "2025-01-15"
}
],
"locations": [
{
"location_id": "A-01-15-02",
"warehouse_id": "warehouse_main",
"quantity": 75
},
{
"location_id": "B-02-08-01",
"warehouse_id": "warehouse_main",
"quantity": 25
}
],
"trackstar_tags": ["high-priority", {"category": "fast-mover"}],
"external_system_url": "https://wms.example.com/inventory/inv_widget001_main",
"additional_fields": {
"custom_field_1": "value1",
"warehouse_notes": "Premium product location"
},
"measurements": {
"length": 12.5,
"width": 8.0,
"height": 4.2,
"unit": "in",
"weight": 2.3,
"weight_unit": "lb"
}
}
}
Complete Product-to-Inventory Workflow
- Fetch the product using the Get Product endpoint
- Extract inventory item IDs from the
inventory_itemsarray - Fetch inventory levels for each
inventory_item_idusing the Get Inventory Item endpoint