Track Packages
Buy with Prime API is now available for early access
Sign up for early access to the Buy with Prime API using the 'Sign Up' button below. The API may change as Amazon receives feedback and iterates on it.
You can get tracking information for outbound packages and return packages. Tracking information includes the current status of the package, estimated delivery date, and the history of status and location changes. You can display tracking information for shoppers on your site, or you can provide a URL that shows tracking information without requiring authentication. You can also use tracking information to update your order management system.
To get tracking information for a package, you use the tracking number and carrier code from the order
query response. Tracking numbers are created by the carriers and expire after 90 days. You can also get the tracking number and carrier code when you Get package information for all line items in an order.
Tracking information includes milestones that indicate the status of a package. For a list of milestones, see PackageMilestoneStatus
. Buy with Prime publishes PACKAGE_TRACKER_MILESTONE_CHANGED
events when a milestone is updated. For details, see PACKAGE_TRACKER_MILESTONE_CHANGED
.
Get the latest outbound package tracking status
The following example retrieves the latest status of a packageTracker
along with estimated delivery date. In this example, the package trackingNumber
is example-tracking-number
and it is in OutForDelivery
state.
Request
query packageTracker {
packageTracker(
packageTrackerInput: {
packageTrackerIdentifier : {
trackingNumber: "example-tracking-number",
carrierCode: "example-carrier-code"
}
}
) {
packageTrackerIdentifier {
trackingNumber,
carrierCode
}
estimatedDeliveryDate {
earliest
latest
}
latestMilestone {
status {
code
message {
language
content
}
}
occurredAt
}
trackingUrl
}
}
Response
{
"data": {
"packageTracker": {
"packageTrackerIdentifier" : {
"trackingNumber": "example-tracking-number",
"carrierCode": "example-carrier-code"
},
"estimatedDeliveryDate": {
"earliest": "2024-05-025T14:12:16Z",
"latest": "2024-05-027T14:12:16Z"
},
"latestMilestone": {
"status": {
"code": "OutForDelivery",
"message": {
"language": "en-US",
"content": "Carrier is about to deliver the product(s)"
},
},
"occurredAt": "2024-05-026T14:12:16Z"
},
"trackingUrl": "https://www.swiship.com/track?id=example-tracking-number"
}
}
}
Get the complete tracking milestone history for an outbound package
The following example retrieves the milestone history for a packageTracker
.
Request
query packageTracker {
packageTracker(
packageTrackerInput: {
packageTrackerIdentifier : {
trackingNumber: "example-tracking-number",
carrierCode: "example-carrier-code"
}
}
) {
packageTrackerIdentifier {
trackingNumber
carrierCode
}
milestones {
status {
code
message {
language
content
}
}
address {
locality
region
country
}
occurredAt
}
}
}
Response
{
"data": {
"packageTracker": {
"packageTrackerIdentifier" : {
"trackingNumber": "example-tracking-number",
"carrierCode": "example-carrier-code"
},
"milestones": [
{
"status": {
"code": "Delivered",
"message": {
"language": "en-US",
"content": "The product(s) was delivered successfully."
},
},
"address": {
"locality": "Redmond",
"region": "WA",
"country": "US"
}
"occurredAt": "2024-05-026T15:20:32Z"
},
{
"status": {
"code": "OutForDelivery",
"message": {
"language": "en-US",
"content": "Carrier is about to deliver the product(s)"
},
},
"address": {
"locality": "Redmond",
"region": "WA",
"country": "US"
}
"occurredAt": "2024-05-026T08:15:16Z"
},
{
"status": {
"code": "InTransit",
"message": {
"language": "en-US",
"content": "Carrier has accepted or picked up shipment from shipper. The shipment is on the way."
},
},
"address": {
"locality": "Redmond",
"region": "WA",
"country": "US"
}
"occurredAt": "2024-05-026T06:14:16Z"
},
{
"status": {
"code": "InTransit",
"message": {
"language": "en-US",
"content": "Carrier has accepted or picked up shipment from shipper. The shipment is on the way."
},
},
"address": {
"locality": "Albuquerque",
"region": "NM",
"country": "US"
},
"occurredAt": "2024-05-026T02:53:41Z"
},
{
"status": {
"code": "InfoReceived",
"message": {
"language": "en-US",
"content": "Carrier has received request from shipper and is about to pick up the shipment."
},
},
"address": {
"locality": "Albuquerque",
"region": "NM",
"country": "US"
},
"occurredAt": "2024-05-026T00:12:16Z"
}
]
}
}
}
Get a tracking URL for an outbound package
The following example retrieves the tracking URL of the package which you can display for shoppers. When shoppers go to the URL, they can see the tracking details of an outbound package without any authentication.
Request
query packageTracker {
packageTracker(
packageTrackerInput: {
packageTrackerIdentifier : {
trackingNumber: "example-tracking-number",
carrierCode: "example-carrier-code"
}
}
) {
packageTrackerIdentifier {
trackingNumber
carrierCode
}
estimatedDeliveryDate {
earliest
latest
}
trackingUrl
}
}
Response
{
"data": {
"packageTracker": {
"packageTrackerIdentifier" : {
"trackingNumber": "example-tracking-number",
"carrierCode": "example-carrier-code"
},
"estimatedDeliveryDate": {
"earliest": "2024-05-025T14:12:16Z",
"latest": "2024-05-027T14:12:16Z"
},
"trackingUrl": "https://www.swiship.com/track?id=example-tracking-number"
}
}
}
Get return package tracking information
To get package tracking information, you need a tracking number and a carrier code. For details, see Get all returns that have been initiated for an order.
The following example retrieves the latest status of a packageTracker
for a return package.
Request
query packageTracker {
packageTracker(
packageTrackerInput: {
packageTrackerIdentifier : {
trackingNumber: "example-tracking-number",
carrierCode: "example-carrier-code"
}
}
) {
packageTrackerIdentifier {
trackingNumber
carrierCode
}
estimatedDeliveryDate {
earliest
latest
}
latestMilestone {
status {
code
message {
language
content
}
}
occurredAt
}
}
}
Response
{
"data": {
"packageTracker": {
"packageTrackerIdentifier" : {
"trackingNumber": "example-tracking-number",
"carrierCode": "example-carrier-code"
},
"estimatedDeliveryDate": {
"earliest": "2024-05-025T14:12:16Z",
"latest": "2024-05-027T14:12:16Z"
},
"latestMilestone": {
"status": {
"code": "OutForDelivery",
"message": {
"language": "en-US",
"content": "Carrier is about to deliver the product(s)."
},
},
"occurredAt": "2024-05-026T14:12:16Z"
}
}
}
}
API operations
You use the following queries and events to track packages.
Queries
Name | Description |
---|---|
packageTracker | Gets the package tracking information. |
Events
Event | When Event is Published |
---|---|
PACKAGE_TRACKER_MILESTONE_CHANGED | A milestone of a Buy with Prime tracking number was updated. A milestone represents an event that occurs during the delivery process for the associated tracking number. |
PACKAGE_DELIVERY_CANCELLED | One or more items were successfully cancelled from the specified order prior to delivery. |
PACKAGE_DELIVERED | One or more items were delivered to their destination. |
PACKAGE_DELIVERY_IN_TRANSIT | One or more items in the specified order were fulfilled. |
RETURN_PACKAGE_DELIVERED | Represents that a returned Buy with Prime item was delivered to the fulfillment center. |
RETURN_PACKAGE_DELIVERY_FAILED | Represents that a returned Buy with Prime item failed to be delivered to the fulfillment center. |
RETURN_PACKAGE_IN_TRANSIT | Represents that a returned Buy with Prime item was dropped off at the carrier location. |
Updated 9 days ago