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
Estimated delivery date
Batch prediction for the Estimated Delivery Date
post
Tracking
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
Courier
Get user activated couriers
get
Detect courier
post
Get all couriers
get
Last Checkpoint
Get last checkpoint by tracking ID
get
Get last checkpoint (Legacy)
get
Notification
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
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
Java SDK
Node.js SDK
.NET SDK
Python SDK
Ruby Gem
PHP SDK
Golang SDK
Open Source
phone
email-verifier
Support
Contact Support

Request Errors

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


AfterShip uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that resulted from the provided information (e.g. a required parameter was missing, a charge failed, etc.), and codes in the 5xx range indicate an error with AfterShip's servers.


HTTP Status Codemeta.codemeta.typeSample Error Message
400400BadRequestThe request was invalid or cannot be otherwise served.
4004001BadRequestInvalid JSON data.
4004003BadRequestTracking already exists.
4044004BadRequestTracking does not exist.
4004005BadRequestThe value of tracking_number is invalid.
4004006BadRequesttracking object is required.
4004007BadRequesttracking_number is required.
4004008BadRequestThe value of [field_name] is invalid.
4004009BadRequest[field_name] is required.
4004010BadRequestThe value of slug is invalid.
4004011BadRequestMissing or invalid value of the required fields for this courier. Besides tracking_number, also required: [field_name]
4004012BadRequestThe error message will be one of the following:
1. Unable to import shipment as the carrier is not on your approved list for carrier auto-detection. Add the carrier here: https://admin.aftership.com/settings/couriers
2. Unable to import shipment as we don’t recognize the carrier from this tracking number.
3. Unable to import shipment as the tracking number has an invalid format.
4. Unable to import shipment as this carrier is no longer supported.
5. Unable to import shipment as the tracking number does not belong to a carrier in that group.
4004013BadRequestRetrack is not allowed. You can only retrack an inactive tracking.
4004014BadRequestnotification object is required.
4004015BadRequestThe value of id is invalid.
4004016BadRequestRetrack is not allowed. You can only retrack each shipment once.
4004017BadRequestThe format of tracking_number is invalid.
401401UnauthorizedThe API key is invalid.
403403ForbiddenThe request is understood, but it has been refused or access is not allowed.
404404NotFoundThe URI requested is invalid or the resource requested does not exist.
429429TooManyRequestsYou have exceeded the API call rate limit. The default limit is 10 requests per second.
500 502 503 504500 502 503 504InternalErrorSomething went wrong on AfterShip's end.
preparing...
preparing...
preparing...