Skip to main content
Order fulfillment is a core workflow in warehouse management systems. This guide shows you how to create orders and track their progress through the fulfillment process.

Overview

The order fulfillment process typically involves:
  1. Creating an order with product details
  2. Tracking order status through the fulfillment pipeline
  3. Syncing updates and managing order data

Creating Orders

To create an order, use the Create Order endpoint with the required order information including products, quantities, and shipping details.
For a full list of fields that need to be passed in, see the Programmatic Writes guide.

Create the Order

curl -X POST https://production.trackstarhq.com/wms/orders \
  -H "Content-Type: application/json" \
  -H "x-trackstar-api-key: YOUR_API_KEY" \
  -H "x-trackstar-access-token: YOUR_ACCESS_TOKEN" \
  -d '{
    "warehouse_customer_id": "customer_12345",
    "reference_id": "order_2024_001",
    "order_number": "ORD-001",
    "channel_object": {
      "channel_id": "Online Store",
      "channel_name": "shopify"
    },
    "trading_partner": "Direct",
    "shipping_method_id": "1234",
    "shipping_method": "fedex_ground",
    "service_level": "Standard",
    "total_price": 79.98,
    "total_tax": 6.40,
    "ship_to_address": {
      "name": "John Doe",
      "company": null,
      "address1": "123 Main St",
      "address2": "Apt 4B",
      "city": "Anytown",
      "state": "NY",
      "zip_code": "12345",
      "country": "US",
      "phone_number": "+1234567890",
      "email": "john@example.com"
    },
    "line_items": [
      {
        "product_id": "prod_widget_001",
        "sku": "WIDGET-001",
        "quantity": 2,
        "unit_price": 29.99,
        "discount_amount": 1.5
      },
      {
        "product_id": "prod_gadget_002",
        "sku": "GADGET-002",
        "quantity": 1,
        "unit_price": 19.99,
        "discount_amount": 1.5
      }
    ]
  }'
import requests
import json

url = "https://production.trackstarhq.com/wms/orders"

headers = {
    "Content-Type": "application/json",
    "x-trackstar-api-key": "YOUR_API_KEY",
    "x-trackstar-access-token": "YOUR_ACCESS_TOKEN"
}

payload = {
    "warehouse_customer_id": "customer_12345",
    "reference_id": "order_2024_001",
    "order_number": "ORD-001",
    "channel_object": {
        "channel_id": "Online Store",
        "channel_name": "shopify"
    },
    "trading_partner": "Direct",
    "shipping_method_id": "1234",
    "shipping_method": "fedex_ground",
    "service_level": "Standard",
    "total_price": 79.98,
    "total_tax": 6.40,
    "ship_to_address": {
        "name": "John Doe",
        "company": None,
        "address1": "123 Main St",
        "address2": "Apt 4B",
        "city": "Anytown",
        "state": "NY",
        "zip_code": "12345",
        "country": "US",
        "phone_number": "+1234567890",
        "email": "john@example.com"
    },
    "line_items": [
        {
            "product_id": "prod_widget_001",
            "sku": "WIDGET-001",
            "quantity": 2,
            "unit_price": 29.99,
            "discount_amount": 1.5
        },
        {
            "product_id": "prod_gadget_002",
            "sku": "GADGET-002",
            "quantity": 1,
            "unit_price": 19.99,
            "discount_amount": 1.5
        }
    ]
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
const url = "https://production.trackstarhq.com/wms/orders";

const payload = {
  warehouse_customer_id: "customer_12345",
  reference_id: "order_2024_001",
  order_number: "ORD-001",
  channel_object: {
    channel_id: "Online Store",
    channel_name: "shopify"
  },
  trading_partner: "Direct",
  shipping_method_id: "1234",
  shipping_method: "fedex_ground",
  service_level: "Standard",
  total_price: 79.98,
  total_tax: 6.40,
  ship_to_address: {
    name: "John Doe",
    company: null,
    address1: "123 Main St",
    address2: "Apt 4B",
    city: "Anytown",
    state: "NY",
    zip_code: "12345",
    country: "US",
    phone_number: "+1234567890",
    email: "john@example.com"
  },
  line_items: [
    {
      product_id: "prod_widget_001",
      sku: "WIDGET-001",
      quantity: 2,
      unit_price: 29.99,
      discount_amount: 1.5
    },
    {
      product_id: "prod_gadget_002",
      sku: "GADGET-002",
      quantity: 1,
      unit_price: 19.99,
      discount_amount: 1.5
    }
  ]
};

fetch(url, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-trackstar-api-key": "YOUR_API_KEY",
    "x-trackstar-access-token": "YOUR_ACCESS_TOKEN"
  },
  body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = "https://production.trackstarhq.com/wms/orders";

$payload = [
    "warehouse_customer_id" => "customer_12345",
    "reference_id" => "order_2024_001",
    "order_number" => "ORD-001",
    "channel_object" => [
        "channel_id" => "Online Store",
        "channel_name" => "shopify"
    ],
    "trading_partner" => "Direct",
    "shipping_method_id" => "1234",
    "shipping_method" => "fedex_ground",
    "service_level" => "Standard",
    "total_price" => 79.98,
    "total_tax" => 6.40,
    "ship_to_address" => [
        "name" => "John Doe",
        "company" => null,
        "address1" => "123 Main St",
        "address2" => "Apt 4B",
        "city" => "Anytown",
        "state" => "NY",
        "zip_code" => "12345",
        "country" => "US",
        "phone_number" => "+1234567890",
        "email" => "john@example.com"
    ],
    "line_items" => [
        [
            "product_id" => "prod_widget_001",
            "sku" => "WIDGET-001",
            "quantity" => 2,
            "unit_price" => 29.99,
            "discount_amount" => 1.5
        ],
        [
            "product_id" => "prod_gadget_002",
            "sku" => "GADGET-002",
            "quantity" => 1,
            "unit_price" => 19.99,
            "discount_amount" => 1.5
        ]
    ]
];

$options = [
    "http" => [
        "header" => "Content-Type: application/json\r\n" .
                   "x-trackstar-api-key: YOUR_API_KEY\r\n" .
                   "x-trackstar-access-token: YOUR_ACCESS_TOKEN\r\n",
        "method" => "POST",
        "content" => json_encode($payload)
    ]
];

$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
echo $response;
?>
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

type OrderRequest struct {
    WarehouseCustomerID string        `json:"warehouse_customer_id"`
    ReferenceID         string        `json:"reference_id"`
    OrderNumber         string        `json:"order_number"`
    ChannelObject       ChannelObject `json:"channel_object"`
    TradingPartner      string        `json:"trading_partner"`
    ShippingMethodID    string        `json:"shipping_method_id"`
    ShippingMethod      string        `json:"shipping_method"`
    ServiceLevel        string        `json:"service_level"`
    TotalPrice          float64       `json:"total_price"`
    TotalTax            float64       `json:"total_tax"`
    ShipToAddress       Address       `json:"ship_to_address"`
    LineItems           []LineItem    `json:"line_items"`
}

type ChannelObject struct {
    ChannelID   string `json:"channel_id"`
    ChannelName string `json:"channel_name"`
}

type Address struct {
    Name        string  `json:"name"`
    Company     *string `json:"company"`
    Address1    string  `json:"address1"`
    Address2    string  `json:"address2"`
    City        string  `json:"city"`
    State       string  `json:"state"`
    ZipCode     string  `json:"zip_code"`
    Country     string  `json:"country"`
    PhoneNumber string  `json:"phone_number"`
    Email       string  `json:"email"`
}

type LineItem struct {
    ProductID      string  `json:"product_id"`
    SKU            string  `json:"sku"`
    Quantity       int     `json:"quantity"`
    UnitPrice      float64 `json:"unit_price"`
    DiscountAmount float64 `json:"discount_amount"`
}

func main() {
    url := "https://production.trackstarhq.com/wms/orders"

    orderReq := OrderRequest{
        WarehouseCustomerID: "customer_12345",
        ReferenceID:         "order_2024_001",
        OrderNumber:         "ORD-001",
        ChannelObject: ChannelObject{
            ChannelID:   "Online Store",
            ChannelName: "shopify",
        },
        TradingPartner:   "Direct",
        ShippingMethodID: "1234",
        ShippingMethod:   "fedex_ground",
        ServiceLevel:     "Standard",
        TotalPrice:       79.98,
        TotalTax:         6.40,
        ShipToAddress: Address{
            Name:        "John Doe",
            Company:     nil,
            Address1:    "123 Main St",
            Address2:    "Apt 4B",
            City:        "Anytown",
            State:       "NY",
            ZipCode:     "12345",
            Country:     "US",
            PhoneNumber: "+1234567890",
            Email:       "john@example.com",
        },
        LineItems: []LineItem{
            {
                ProductID:      "prod_widget_001",
                SKU:            "WIDGET-001",
                Quantity:       2,
                UnitPrice:      29.99,
                DiscountAmount: 1.5,
            },
            {
                ProductID:      "prod_gadget_002",
                SKU:            "GADGET-002",
                Quantity:       1,
                UnitPrice:      19.99,
                DiscountAmount: 1.5,
            },
        },
    }

    jsonData, _ := json.Marshal(orderReq)

    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
    req.Header.Set("Content-Type", "application/json")
    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()

    fmt.Println("Response Status:", resp.Status)
}
import java.io.IOException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

public class TrackstarOrderExample {
    public static void main(String[] args) throws IOException, InterruptedException {
        String url = "https://production.trackstarhq.com/wms/orders";

        String jsonPayload = """
        {
            "warehouse_customer_id": "customer_12345",
            "reference_id": "order_2024_001",
            "order_number": "ORD-001",
            "channel_object": {
                "channel_id": "Online Store",
                "channel_name": "shopify"
            },
            "trading_partner": "Direct",
            "shipping_method_id": "1234",
            "shipping_method": "fedex_ground",
            "service_level": "Standard",
            "total_price": 79.98,
            "total_tax": 6.40,
            "ship_to_address": {
                "name": "John Doe",
                "company": null,
                "address1": "123 Main St",
                "address2": "Apt 4B",
                "city": "Anytown",
                "state": "NY",
                "zip_code": "12345",
                "country": "US",
                "phone_number": "+1234567890",
                "email": "john@example.com"
            },
            "line_items": [
                {
                    "product_id": "prod_widget_001",
                    "sku": "WIDGET-001",
                    "quantity": 2,
                    "unit_price": 29.99,
                    "discount_amount": 1.5
                },
                {
                    "product_id": "prod_gadget_002",
                    "sku": "GADGET-002",
                    "quantity": 1,
                    "unit_price": 19.99,
                    "discount_amount": 1.5
                }
            ]
        }
        """;

        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("x-trackstar-api-key", "YOUR_API_KEY")
                .header("x-trackstar-access-token", "YOUR_ACCESS_TOKEN")
                .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
                .build();

        HttpClient client = HttpClient.newHttpClient();
        HttpResponse<String> response = client.send(request,
                HttpResponse.BodyHandlers.ofString());

        System.out.println("Status Code: " + response.statusCode());
        System.out.println("Response: " + response.body());
    }
}
require 'net/http'
require 'json'

url = URI('https://production.trackstarhq.com/wms/orders')

payload = {
  warehouse_customer_id: "customer_12345",
  reference_id: "order_2024_001",
  order_number: "ORD-001",
  channel_object: {
    channel_id: "Online Store",
    channel_name: "shopify"
  },
  trading_partner: "Direct",
  shipping_method_id: "1234",
  shipping_method: "fedex_ground",
  service_level: "Standard",
  total_price: 79.98,
  total_tax: 6.40,
  ship_to_address: {
    name: "John Doe",
    company: nil,
    address1: "123 Main St",
    address2: "Apt 4B",
    city: "Anytown",
    state: "NY",
    zip_code: "12345",
    country: "US",
    phone_number: "+1234567890",
    email: "john@example.com"
  },
  line_items: [
    {
      product_id: "prod_widget_001",
      sku: "WIDGET-001",
      quantity: 2,
      unit_price: 29.99,
      discount_amount: 1.5
    },
    {
      product_id: "prod_gadget_002",
      sku: "GADGET-002",
      quantity: 1,
      unit_price: 19.99,
      discount_amount: 1.5
    }
  ]
}

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request['Content-Type'] = 'application/json'
request['x-trackstar-api-key'] = 'YOUR_API_KEY'
request['x-trackstar-access-token'] = 'YOUR_ACCESS_TOKEN'
request.body = payload.to_json

response = http.request(request)
puts "Status: #{response.code}"
puts "Response: #{response.body}"

Response

The API will return the created order with a unique Trackstar order ID:
{
  "data": {
    "id": "order_abc123",
    "warehouse_customer_id": "customer_12345",
    "warehouse_id": "warehouse_main",
    "created_date": "2024-01-15T10:00:00Z",
    "updated_date": "2024-01-15T10:00:00Z",
    "reference_id": "order_2024_001",
    "order_number": "ORD-001",
    "status": "open",
    "raw_status": "new_order",
    "channel": "shopify",
    "channel_object": {
      "channel_id": "Online Store",
      "channel_name": "shopify"
    },
    "type": "d2c",
    "trading_partner": "Direct",
    "shipping_method": "fedex_ground",
    "is_third_party_freight": false,
    "third_party_freight_account_number": null,
    "first_party_freight_account_number": null,
    "invoice_currency_code": "USD",
    "total_price": 79.98,
    "total_tax": 6.40,
    "total_discount": 3.00,
    "total_shipping": 5.99,
    "ship_to_address": {
      "name": "John Doe",
      "company": null,
      "address1": "123 Main St",
      "address2": "Apt 4B",
      "city": "Anytown",
      "state": "NY",
      "zip_code": "12345",
      "country": "US",
      "phone_number": "+1234567890",
      "email": "john@example.com"
    },
    "line_items": [
      {
        "product_id": "prod_widget_001",
        "sku": "WIDGET-001",
        "quantity": 2,
        "unit_price": 29.99,
        "is_picked": false,
        "discount_amount": 1.5
      },
      {
        "product_id": "prod_gadget_002",
        "sku": "GADGET-002",
        "quantity": 1,
        "unit_price": 19.99,
        "is_picked": false,
        "discount_amount": 1.5
      }
    ],
    "tags": ["rush_order"],
    "required_ship_date": "2024-01-18T00:00:00Z",
    "saturday_delivery": false,
    "signature_required": false,
    "international_duty_paid_by": null,
    "shipments": [],
    "external_system_url": "https://wms.example.com/orders/order_abc123",
    "trackstar_tags": ["high-priority", {"customer_type": "premium"}],
    "additional_fields": {
      "order_notes": "Handle with care",
      "customer_tier": "gold"
    }
  }
}

Tracking Order Status and Fulfillments

Once an order is created, you can track its progress using the Get Order endpoint.

Fetching an Order

curl -X GET https://production.trackstarhq.com/wms/orders/order_abc123 \
  -H "x-trackstar-api-key: YOUR_API_KEY" \
  -H "x-trackstar-access-token: YOUR_ACCESS_TOKEN"
import requests

url = "https://production.trackstarhq.com/wms/orders/order_abc123"

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/orders/order_abc123";

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/orders/order_abc123";

$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/orders/order_abc123"

    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("Response:", string(body))
}
import java.io.IOException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

public class TrackstarGetOrderExample {
    public static void main(String[] args) throws IOException, InterruptedException {
        String url = "https://production.trackstarhq.com/wms/orders/order_abc123";

        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();

        HttpClient client = HttpClient.newHttpClient();
        HttpResponse<String> response = client.send(request,
                HttpResponse.BodyHandlers.ofString());

        System.out.println("Status Code: " + response.statusCode());
        System.out.println("Response: " + response.body());
    }
}
require 'net/http'

url = URI('https://production.trackstarhq.com/wms/orders/order_abc123')

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": "order_abc123",
    "warehouse_customer_id": "customer_12345",
    "warehouse_id": "warehouse_main",
    "created_date": "2024-01-15T10:00:00Z",
    "updated_date": "2024-01-16T14:30:00Z",
    "reference_id": "order_2024_001",
    "order_number": "ORD-001",
    "status": "fulfilled",
    "raw_status": "shipped",
    "channel": "shopify",
    "channel_object": {
      "channel_id": "Online Store",
      "channel_name": "shopify"
    },
    "type": "d2c",
    "trading_partner": "Direct",
    "shipping_method": "fedex_ground",
    "is_third_party_freight": false,
    "third_party_freight_account_number": null,
    "first_party_freight_account_number": null,
    "invoice_currency_code": "USD",
    "total_price": 79.98,
    "total_tax": 6.40,
    "total_discount": 3.00,
    "total_shipping": 5.99,
    "ship_to_address": {
      "name": "John Doe",
      "company": null,
      "address1": "123 Main St",
      "address2": "Apt 4B",
      "city": "Anytown",
      "state": "NY",
      "zip_code": "12345",
      "country": "US",
      "phone_number": "+1234567890",
      "email": "john@example.com"
    },
    "line_items": [
      {
        "product_id": "prod_widget_001",
        "sku": "WIDGET-001",
        "quantity": 2,
        "unit_price": 29.99,
        "is_picked": true,
        "discount_amount": 1.5
      },
      {
        "product_id": "prod_gadget_002",
        "sku": "GADGET-002",
        "quantity": 1,
        "unit_price": 19.99,
        "is_picked": true,
        "discount_amount": 1.5
      }
    ],
    "tags": ["rush_order"],
    "required_ship_date": "2024-01-18T00:00:00Z",
    "saturday_delivery": false,
    "signature_required": false,
    "international_duty_paid_by": null,
    "shipments": [
      {
        "shipment_id": "shipment_abc123",
        "warehouse_id": "warehouse_main",
        "shipped_date": "2024-01-16T15:45:00Z",
        "raw_status": "shipped",
        "status": "shipped",
        "shipping_method": "fedex_ground",
        "line_items": [
          {
            "inventory_item_id": "inv_widget001_main",
            "sku": "WIDGET-001",
            "quantity": 2,
            "parent_product_id": null
          },
          {
            "inventory_item_id": "inv_gadget002_main",
            "sku": "GADGET-002",
            "quantity": 1,
            "parent_product_id": null
          }
        ],
        "ship_to_address": {
          "full_name": "John Doe",
          "company": null,
          "address1": "123 Main St",
          "address2": "Apt 4B",
          "address3": null,
          "city": "Anytown",
          "state": "NY",
          "postal_code": "12345",
          "country": "US"
        },
        "ship_from_address": {
          "address1": "456 Warehouse Blvd",
          "address2": null,
          "address3": null,
          "city": "Distribution City",
          "state": "NJ",
          "postal_code": "07001",
          "country": "US"
        },
        "packages": [
          {
            "package_id": "pkg_001",
            "package_name": "12x9x4",
            "tracking_number": "1Z999AA1234567890",
            "tracking_url": "https://www.fedex.com/apps/fedextrack/?tracknumbers=1Z999AA1234567890",
            "shipping_method": "fedex_ground",
            "carrier": "FedEx",
            "shipping_method_id": "fedex_ground",
            "shipping_method_name": "FedEx Ground",
            "carrier_id": "fedex",
            "carrier_name": "FedEx",
            "scac": "FEDX",
            "shipping_cost": 8.95,
            "measurements": {
              "length": 12.0,
              "width": 9.0,
              "height": 4.0,
              "unit": "in",
              "weight": 2.5,
              "weight_unit": "lb"
            },
            "line_items": [
              {
                "inventory_item_id": "inv_widget001_main",
                "sku": "WIDGET-001",
                "quantity": 2,
                "lot_id": null,
                "expiration_date": null,
                "parent_product_id": null
              },
              {
                "inventory_item_id": "inv_gadget002_main",
                "sku": "GADGET-002",
                "quantity": 1,
                "lot_id": null,
                "expiration_date": null,
                "parent_product_id": null
              }
            ]
          }
        ]
      }
    ],
    "external_system_url": "https://wms.example.com/orders/order_abc123",
    "trackstar_tags": ["high-priority", {"customer_type": "premium"}],
    "additional_fields": {
      "order_notes": "Handle with care",
      "customer_tier": "gold"
    }
  }
}

Real-time Updates

Utilize webhooks to get notified each time there is an update to an order by subscribing to order.updated and/or order.shipment.created events.

Order Status Workflow

Orders progress through various fulfillment stages as they move through the warehouse system. For detailed information about all available order statuses and their meanings, see the Orders Info page.