QUICKSTART
API Quick Start
Authentication
SignString
OAuth
Overview
Getting Started
Scope List
Versioning
Rate Limit
Body Envelope
Request Errors
Try API Endpoints
CHANGELOG
Changelog
Migration Guide
REFERENCE
API Overview
Trackings
Get trackings
get
Create a tracking
post
Get a tracking by ID
get
Update a tracking by ID
put
Delete a tracking by ID
delete
Retrack an expired tracking by ID
post
Mark tracking as completed by ID
post
Get a tracking (Legacy)
get
Update a tracking (Legacy)
put
Delete a tracking (Legacy)
delete
Retrack an expired tracking (Legacy)
post
Mark tracking as completed (Legacy)
post
Couriers
Get user activated couriers
get
Detect courier
post
Get all couriers
get
Last Checkpoints
Get last checkpoint by tracking ID
get
Get last checkpoint (Legacy)
get
Notifications
Get tracking notification by tracking ID
get
Add a notification by tracking ID
post
Remove a notification by tracking ID
post
Get tracking notification (Legacy)
get
Add a notification (Legacy)
post
Remove a notification (Legacy)
post
Estimated delivery date
Batch prediction for the Estimated Delivery Date
post
MODEL
Tracking
Courier
Checkpoint
Notification
ENUM
Additional Tracking Fields
Delivery Statuses
Delivery Sub-statuses
Slug Groups
Events
Confidence Codes
Webhook
Webhook Overview
Webhook Versioning
Webhook Specifications
Webhook Signature
Webhook OAuth 2.0
Webhook Outgoing IPs
Webhook Changelog
OTHERS
Supported Couriers
CSV Upload & CSV Auto-Fetch
Shipment CSV Export
Order CSV Export
SDK
Android SDK
iOS SDK
Java SDK
Node.js SDK
.NET SDK
Python SDK
Ruby Gem
PHP SDK
Golang SDK
Open Source
phone
email-verifier
Support
Contact Support

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.

preparing...

All endpoints are only accessible via HTTPS and are located at api.aftership.com.

Use Create Tracking API
https://api.aftership.com/tracking/2024-04/trackings

Create Tracking API Documentation

preparing...

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 slug_group field.

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
https://api.aftership.com/tracking/2024-04/trackings

Update Tracking API Documentation

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.

Webhook secret

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.

webhook-secret

Sample encrypted signature

Sample webhook body

preparing...

2 . Via API

To retrieve the latest checkpoint, use GET API https://api.aftership.com/tracking/2024-04/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.

Sample Request

preparing...

Sample Response

preparing...