Shipment Tracking API

The WooCommerce REST API enable external apps use a set of API endpoints to read and write various parts of WooCommerce data. The AST plugin extends the WooCommerce Rest API and adds Shipment Tracking endpoints that allows to create, view, and delete shipment tracking information in orders.

To use the Shipment Tracking endpoint, you’ll need to generate a Rest API Key for your WooCommerce store. These API keys are the permission for external systems to connect with your store’s API.

How To Get WooCommerce API Keys

To generate API keys for your WooCommerce store, navigate to WooCommerce > Settings > Advanced > Rest API and Select Add Key. You are taken to the Key Details screen:

  1. Add a Description.
  2. Select the User you would like to generate a key for in the dropdown (admin user)
  3. Select a level of access for this API key – Read/Write access.
  4. Select Generate API Key, and WooCommerce will create API keys for that user.

Shipment Tracking Endpoint

The Shipment Tracking endpoint supports the following methods:

  • Add tracking information and fulfill orders
  • Retrieve tracking information from orders
  • Delete tracking information from orders
  • Get the shipping provider’s list

Endpoint URL:<order_id>/shipment-trackings

Please note: the shipment tracking endpoint works with WooCommerce API v1, v2, and v3. In the documentation, only v1 is shown. We are also compatible with old version od the AST PRO REST API endpoint – wc-ast/v3.

Shipment Tracking Properties

These are the available meta field that can be used when updating the Shipment Tracking API:

order_idstringUnique identifier for orderread-only
tracking_numberstringTracking numberRequired
tracking_providerstringTracking provider nameRequired
date_shippeddateDate when the package was shipped – default to the date/time that the tracking was added via the APIOptional
replace_trackingBoolean0 – add the tracking info in addition to tracking info that was already added to the order. 1 – replace the current tracking numbers for the orders (Defaults to 0)Optional
status_shippedInteger0 – do not change the order status, 1 – change order status to “Shipped” (completed), 2 – change the order status to custom status “Partially Shipped” (Defaults to 0).Optional

Add Shipment tracking

This endpoint allows to add new tracking info to orders:w tracking info to orders:

POST /wp-json/wc-shipment-tracking/v3/orders/<order_id>/shipment-trackings/

curl -X POST<order_id>/shipment-tracking
	-u consumer_key:consumer_secret 
	-H "Content-Type: application/json" 
	-d '{
		"tracking_provider": "Fedex",
		"tracking_number": "12345678",
		"date_shipped": "2019-03-08",
		"status_shipped": 1,
		"replace_tracking": 1
//response example:
"Tracking ID: fb7170d97d0e628bc3b565999d07c6a9"

Get shipment tracking

With this endpoint, you can list all tracking info added to an order. You will need to pass the order id and you’ll get a response with an array of tracking numbers added to that order:

GET /wp-json/wc-shipment-tracking/v3/orders/<order_id>/shipment-trackings/

curl -X GET<order_id>/shipment-trackings 
  -u consumer_key:consumer_secret 
  //JSON response:

  "tracking_id": "feb9bde4475fda92cc9408607b7ecb66",
  "tracking_provider": "Fedex",
  "tracking_link": "",
  "tracking_number": "12345678",
  "date_shipped": "2019-03-08",
  "_links": {
    "self": [
        "href": ""
    "collection": [
        "href": ""
    "up": [
        "href": ""

Delete Shipment Tracking

You can delete tracking numbers from orders, you will need to pass the order id and the tracking_id for this tracking number:

DELETE /wp-json/wc-shipment-tracking/v3/orders/<order_id>/shipment-trackings/

curl -X DELETE<order_id>/shipment-trackings/fa61d174a05d2f34323b51d92823947d 
  -u consumer_key:consumer_secret 
//response example:
"Tracking ID: fa61d174a05d2f34323b51d92823947d"

Get Shipping Providers

You can get all the active shipping providers for the order

GET /wp-json/wc-shipment-tracking/v3/orders/<order_id>/shipment-trackings/providers

curl -X GET<order_id>/shipment-trackings/providers
    -u consumer_key:consumer_secret

JSON response example:

    "Austria": {
        "DPD Austria": "",
        "": ""
    "Australia": {
        "Australia Post": "",
        "CouriersPlease": ""
    "Canada": {
        "Canada Post": "",
        "Canpar": ""
    "Chile": {
        "Correos Chile": ""
    "China": {
        "China Post": "",
        "EMS": ""
    "France": {
        "Chronopost": "",
        "Colis Privé": ""
    "India": {
        "Delhivery": ""
    "United States (US)": {
        "DHL US": "",
        "Associated Global Systems": "",
        "DHL Parcel": "",
        "TNT": "",
        "Speedex Courier": "",
        "UPS": "",
        "USPS": ""

API Request Errors

In the events of API request errors, AST uses conventional HTTP response codes in the 4XX and 5XX range to indicate the reason behind the error.

Error CodeError typeSample Error Message
400BadRequestMissing parameter(s): tracking_number
400BadRequestMissing parameter(s): tracking_provider
404Not FoundInvalid order ID
404Not FoundRequests to resources that don’t exist or are missing
401UnauthorizedAuthentication or permission error, e.g. incorrect API keys
500Internal Server ErrorServer error

Postman example 

Please check the screenshot for setup in postman.

Create new request and set method Post. Insert URL and in the Body section insert all the tracking information.


Then go to the Authorization section and select Type Basic Auth. Use REST API Consumer key and consumer secret in the username and password field and click on Send.