API Quick Start
AfterShip Tracking helps eCommerce businesses to update and manage their shipment with efficiency.
You can seamlessly manage tracking with AfterShip's Tracking API and use AfterShip's post-purchase services from the admin portal. Or you can store the tracking data through API and webhook, and customize the post-purchase services yourself.
This quickstart guide intends to walk you through 3 common scenarios to let you understand how to use AfterShip Tracking to create & manage your tracking.
Tracking refers to shipment-related information, including a carrier's name, tracking number provided by the carrier, and checkpoints.
For all fields consisting 'tracking,' please refer to Tracking Object.
AfterShip verifies a user's request by adding an
as-api-key in the header.
To get your API key, visit API key, click Create an API key and follow the given instructions to generate your API key.
All endpoints are only accessible via
HTTPS and are located at
Use Create Tracking API
When creating a tracking event, we suggest you provide both the tracking number and other courier information for us.
But if you don't have such info, you can skip it, and we will try to detect the courier for you.
Here are 3 ways to provide the courier's info
1 . If you know the slug of a specific courier, please fill the
slug field (e.g., dhl-germany).
You could refer to AfterShip Tracking's Courier List. Send the Courier Slug (courier's name) accurately according to the List (Column A of the list).
2 . If you know the courier group but are unsure about the slug, please fill the
You could refer to AfterShip Tracking's Slug-Groups List , AfterShip Tracking will detect tracking that belongs to the slug group.
3 . If you don't know the courier, you can skip this field. We will detect the courier for you.
When auto-detecting the courier, we will refer to your
Preferred Courier List that you set on our admin portal.
So we suggest you activate your commonly-used couriers on settings. This will help us map the right courier.
For some couriers, it's mandatory to fill some additional fields for tracking; else your tracking will fail to create.
Please call our Get all couriers API to get the mandatory fields.
Use Update Tracking API
If you want to correct an inaccurate tracking courier, update order information, or add extra information for an existing tracking, you can use the 'Update API'.
1 . Via webhook
AfterShip Tracking can push notifications to you for every tracking update via Webhook. With it, you can store all the tracking details and build up your own tracking page.
To set up your webhook, enter settings to fill in your webhook URL and save it.
You can add multiple webhook URLs, and we will push notifications to all those URLs.
For security concerns, Webhook includes a signature for verification.
Each webhook request includes an aftership-hmac-sha256 header. The signature is a base64-encoded HMAC generated using the sha256 algorithm with webhook request body and the webhook secret of your account.
Sample encrypted signature (nodes)
Sample webhook body
2 . Via API
To retrieve the latest checkpoint, use GET API https://api.aftership.com/tracking/2023-10/last_checkpoint/:slug/:tracking_number
NOTE: GET API limits 10 requests per second and it will show errors if exceeded. Hence, it's not suggested to use the GET API to build your own tracking page.