Shipment Tracking API

The AST PRO plugin provides a REST API to manage tracking information for WooCommerce orders. It allows adding, retrieving, and deleting tracking entries, along with listing available shipping carriers.

πŸ” How to Get WooCommerce API Keys

To authenticate with the Shipment Tracking API, you’ll need your WooCommerce Consumer Key and Consumer Secret.

πŸ› οΈ Steps to Generate API Keys:

  1. Go to your WordPress dashboard.
  2. Navigate to WooCommerce > Settings > Advanced > REST API.
  3. Click Add Key.
  4. Enter a name (e.g., β€œAST API Access”).
  5. Choose a user (with Admin rights recommended).
  6. Set Permissions to Read/Write.
  7. Click Generate API Key.

βœ… You will now see your Consumer Key and Consumer Secretβ€”copy and store them securely.

blank

🧾 Shipment Tracking API Properties

PropertyTypeRequiredDescription
order_idintegerβœ… YesWooCommerce Order ID.
tracking_providerstringβœ… YesShipping carrier (must match an enabled name or alias).
tracking_numberstringβœ… YesShipment tracking number.
date_shippedstringβœ… YesDate in format: DD-MM-YYYY or MM-DD-YYYY (must match API settings).
status_shippedintegerβœ… Yes0 – No change
1 – Mark order as Shipped
2 – Mark as Partially Shipped
(Default: 0)
replace_trackingbooleanNo0 – Add to existing tracking
1 – Replace all tracking
(Default: 0)
skustringNoComma-separated SKUs (for per-item tracking).
qtystringNoQuantities matching SKUs (for per-item tracking).
shipping_notestringNoOptional note shown to customers along with tracking information

πŸ”„ Add Shipment Tracking to an Order

Endpoint:

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

Example:

curl -X POST https://your-domain.com/wp-json/wc-shipment-tracking/v3/orders/340/shipment-trackings \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
  "tracking_provider": "Fedex",
  "tracking_number": "12345678",
  "date_shipped": "08-07-2024",
  "status_shipped": 1,
  "replace_tracking": 1,
  "shipping_note": "Your order has been shipped in two separate packages."
}'

Response:

"Tracking ID: fb7170d97d0e628bc3b565999d07c6a9"

πŸ“¦ Add Tracking Per Order Item

Endpoint:

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

Example:

curl -X POST https://your-domain.com/wp-json/wc-ast-pro/v3/orders/340/shipment-trackings \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
  "tracking_provider": "USPS",
  "tracking_number": "123456",
  "date_shipped": "2024-07-10",
  "status_shipped": 2,
  "sku": "t-shirt,blue-jeans",
  "qty": "1,1",
  "shipping_note": "Partial shipment – remaining items will ship soon."
}'

Another package:

curl -X POST https://your-domain.com/wp-json/wc-shipment-tracking/v3/orders/340/shipment-trackings \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
  "tracking_provider": "USPS",
  "tracking_number": "456879",
  "date_shipped": "2024-07-12",
  "status_shipped": 1,
  "sku": "t-shirt,blue-jeans",
  "qty": "1,2"
  "shipping_note": "Final shipment for remaining items."
}'

πŸ” Get Shipment Tracking Info

Endpoint:

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

Example:

curl -X GET https://your-domain.com/wp-json/wc-shipment-tracking/v3/orders/340/shipment-trackings \
-u consumer_key:consumer_secret

Response:

{
  "tracking_id": "feb9bde4475fda92cc9408607b7ecb66",
  "tracking_provider": "Fedex",
  "tracking_link": "http://www.fedex.com/Tracking?action=track&tracknumbers=12345678",
  "tracking_number": "12345678",
  "date_shipped": "2024-07-10"
}

❌ Delete Shipment Tracking

Endpoint:

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

Example:

curl -X DELETE https://your-domain.com/wp-json/wc-shipment-tracking/v3/orders/340/shipment-trackings/fa61d174a05d2f34323b51d92823947d \
-u consumer_key:consumer_secret

Response:

"Tracking ID: fa61d174a05d2f34323b51d92823947d"

🧭 Get Shipping Carriers

Endpoint:

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

Example:

curl -X GET https://your-domain.com/wp-json/wc-shipment-tracking/v3/orders/340/shipment-trackings/providers \
-u consumer_key:consumer_secret

Response Sample:

{
  "United States (US)": {
    "USPS": "https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=%number%",
    "UPS": "http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=%number%"
  },
  "India": {
    "Delhivery": "https://www.delhivery.com/track/package/%number%"
  }
}

❗ API Request Errors

Status CodeErrorDescription
200 OKSuccessRequest completed successfully.
201 CreatedTracking AddedTracking successfully created.
400 Bad RequestInvalid Request FormatRequest is malformed or missing required data.
401 UnauthorizedAuthentication FailedAPI keys are missing, incorrect, or lack permissions.
403 ForbiddenAccess DeniedUser lacks the correct privileges.
404 Not FoundResource Not FoundOrder ID or endpoint does not exist.
409 ConflictDuplicate EntryTracking already exists without replace flag.
500 Internal ErrorServer ErrorServer-side issue. Check logs or contact support.

πŸ“¬ Postman Example

To test using Postman:

  1. Method: POST
  2. URL:
https://your-domain.com/wp-json/wc-shipment-tracking/v3/orders/340/shipment-trackings
  1. Authorization:
    • Type: Basic Auth
    • Username: Consumer Key
    • Password: Consumer Secret
  2. Headers:
Content-Type: application/json
  1. Body β†’ Raw β†’ JSON:
{
  "tracking_provider": "UPS",
  "tracking_number": "1Z9999",
  "date_shipped": "10-07-2024",
  "status_shipped": 1
}

βœ… Click Send and confirm the response includes a Tracking ID.

blank
blank

πŸ”„ Bulk Shipment Tracking API

WooCommerce’s REST API supports bulk operations for many resources, but shipment tracking traditionally required updating one order at a time.

To support high-volume fulfillment workflows, AST PRO provides a Bulk Shipment Tracking API, allowing multiple orders and tracking numbers to be added or updated in a single API request.

This feature is designed for merchants, ERPs, OMS systems, shipping platforms, and 3PL providers handling large shipment volumes.

βœ… Key Benefits

  • Add tracking to multiple orders in one API request
  • Reduce API calls and server overhead
  • Improve performance for bulk fulfillment workflows
  • Ideal for automation and system-to-system integrations

πŸ”— API Endpoint

Bulk Add Shipment Tracking

POST /wp-json/wc-shipment-tracking/v3/orders/shipment-trackings/bulk

πŸ” Authentication and permissions are the same as the single shipment tracking API.

πŸ“₯ Request Body (Bulk Format)

The bulk endpoint accepts a shipments array, where each object represents one tracking entry for one order.

Each shipment may have different tracking providers, tracking numbers, and shipment dates.

{
  "shipments": [
    {
      "order_id": 677,
      "tracking_provider": "fedex",
      "tracking_number": "FDX-1110",
      "date_shipped": "2024-07-08",
      "status_shipped": 1,
      "shipping_note": "Partial shipment – remaining items will ship soon."
    },
    {
      "order_id": 675,
      "tracking_provider": "ups",
      "tracking_number": "UPS-2220",
      "date_shipped": "2024-07-09",
      "status_shipped": 1,
      "shipping_note": "Final shipment for this order."
    }
  ]
}

ℹ️ The same order_id may appear multiple times to add multiple tracking numbers to a single order.

🧾 Supported Fields

FieldRequiredDescription
order_idβœ… YesWooCommerce Order ID
tracking_providerβœ… YesCarrier slug or name (e.g. fedex, ups, other)
tracking_numberβœ… YesShipment tracking number
date_shipped❌ OptionalShipment date (YYYY-MM-DD recommended)
status_shipped❌ OptionalShipment status flag
replace_tracking❌ OptionalReplace existing tracking (0 or 1)
custom_tracking_link❌ OptionalCustom tracking URL
products_list❌ OptionalLine-item mapping for partial shipments
shipping_note❌ OptionalOptional customer-visible note shown with tracking details

πŸ“€ Response Format

The bulk API returns an array of tracking objects, using the same format as the single shipment tracking API.

Each object represents one successfully added tracking entry.

βœ… Successful Response Example

[
  {
    "tracking_id": "37fdbfe33f7af11eb6caa04ea0261b0c",
    "tracking_provider": "FedEx",
    "tracking_link": "https://www.fedex.com/fedextrack/?trknbr=FDX-1110",
    "tracking_number": "FDX-1110",
    "date_shipped": "2024-07-08",
    "products_list": ""
  },
  {
    "tracking_id": "c0d318fd8261c2321646d80aeb337614",
    "tracking_provider": "UPS",
    "tracking_link": "https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=UPS-2220",
    "tracking_number": "UPS-2220",
    "date_shipped": "2024-07-09",
    "products_list": ""
  }
]

❌ Failed Shipment Example

If a shipment fails (for example, due to an invalid order ID), the API returns a standard WooCommerce REST API error response:

{
  "code": "woocommerce_rest_order_invalid_id",
  "message": "Invalid order ID.",
  "data": {
    "status": 404
  }
}

⚠️ A failed shipment does not stop the processing of other shipments in the same request.

πŸ§ͺ cURL Example

curl -X POST https://your-domain.com/wp-json/wc-shipment-tracking/v3/orders/shipment-trackings/bulk \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
  "shipments": [
    {
      "order_id": 677,
      "tracking_provider": "fedex",
      "tracking_number": "FDX-1110",
      "date_shipped": "2024-07-08",
      "status_shipped": 1
    },
    {
      "order_id": 675,
      "tracking_provider": "ups",
      "tracking_number": "UPS-2220",
      "date_shipped": "2024-07-09",
      "status_shipped": 1
    }
  ]
}'

$129.00

Billed annually

Buy Now