Trackings

Create trackings, update trackings, and get tracking results.

Pro Tip!

You can always use/:id to replace /:slug/:tracking_number.
e.g. DELETE /trackings/:id


PUT /trackings/:slug/:tracking_number

Headers

aftership-api-key: YOUR_API_KEY
Content-Type: application/json

Parameters

Optional Parameters
ParameterTypeDescription
smsesArrayPhone number(s) to receive sms notifications.
emailsArrayEmail address(es) to receive email notifications.
titleStringTitle of the tracking.
customer_nameStringCustomer name of the tracking.
order_idStringText field for order ID
order_id_pathStringText field for order path
custom_fieldsStringCustom text fields of the tracking.
noteStringText field for the note
languageStringEnter ISO 639-1 Language Code to specify the store, customer or order language.

Body

{
    "tracking": {
        "title": "New Title"
    }
}

Headers

HTTP/1.1 200 OK
Content-Type: application/json
Connection: keep-alive
Date: Mon, 10 Jun 2013 07:38:02 GMT

Attributes

Attributes
AttributeTypeDescription
trackingHash of Tracking ObjectHash describes the tracking information, without the checkpoints.
Tracking Object
AttributeTypeDescription
created_atDateTimeDate and time of the tracking created.
updated_atDateTimeDate and time of the tracking last updated.
idStringA unique identifier generated by AfterShip for the tracking.
tracking_postal_codeStringThe postal code of receiver's address. Required by some couriers, such asdeutsch-post
tracking_ship_dateStringShipping date inYYYYMMDDformat. Required by some couriers, such asdeutsch-post
tracking_account_numberStringAccount number of the shipper for a specific courier. Required by some couriers, such asdynamic-logistics
tracking_origin_countryStringOrigin Country of the shipment for a specific courier. Required by some couriers, such asdhl
tracking_destination_countryStringDestination Country of the shipment for a specific courier. Required by some couriers, such aspostnl-3s
tracking_stateStringLocated state of the shipment for a specific courier. Required by some couriers, such asstar-track-courier
tracking_keyStringKey of the shipment for a specific courier. Required by some couriers, such assic-teliway
slugStringUnique code of courier. Get courier slug here
activeBooleanWhether or not AfterShip will continue tracking the shipments. Value is false when tag (status) is DeliveredExpired, or further updates for 30 days since last update.
androidArray or StringGoogle cloud message registration IDs to receive the push notifications.
Accept either array or comma separated as input.
custom_fieldsHashCustom fields of the tracking.
customer_nameStringCustomer name of the tracking.
delivery_timeNumberTotal delivery time in days.
- Difference of 1st checkpoint time and delivered time for delivered shipments
- Difference of 1st checkpoint time and current time for non-delivered shipments
Value as 0 for pending shipments or delivered shipment with only one checkpoint.
destination_country_iso3StringDestination country of the tracking. ISO Alpha-3 (three letters). If you use postal service to send international shipments, AfterShip will automatically get tracking results from destination postal service based on destination country.
courier_destination_country_iso3StringDestination country of the tracking detected from the courier. ISO Alpha-3 (three letters). Value will be null if the courier doesn't provide the destination country.
emailsArrayEmail address(es) to receive email notifications. Comma separated for multiple values.
expected_deliveryStringExpected delivery date (if any).
Empty String,
YYYY-MM-DD,
YYYY-MM-DDTHH:MM:SS, or
YYYY-MM-DDTHH:MM:SS+TIMEZONE
iosArray or StringApple iOS device IDs to receive the push notifications.
Accept either array or comma separated as input.
order_idStringText field for order ID
order_id_pathStringText field for order path
origin_country_iso3StringOrigin country of the tracking. ISO Alpha-3 (three letters).
unique_tokenStringThe token to generate the direct tracking link: 
https://yourusername.aftership.com/unique_token or 
https://www.aftership.com/unique_token
shipment_package_countNumberNumber of packages under the tracking.
shipment_typeStringShipment type provided by carrier (if any).
shipment_weightNumberShipment weight provied by carrier (if any)
shipment_weight_unitStringWeight unit provied by carrier, either in 
kg or lb (if any)
last_updated_atDateTimeDate and time the tracking was last updated
shipment_pickup_dateDateTimeDate and time the tracking was picked up
shipment_delivery_dateDateTimeDate and time the tracking was delivered
subscribed_smsesArrayPhone number(s) subscribed to receive sms notifications. Comma separated for multiple values
subscribed_emailsArrayEmail address(es) subscribed to receive email notifications. Comma separated for multiple values
signed_byStringSigned by information for delivered shipment (if any).
smsesArrayPhone number(s) to receive sms notifications. The phone number(s) to receive sms notifications. Phone number should begin with `+` and `Area Code` before phone number. Comma separated for multiple values.
sourceStringSource of how this tracking is added.
tagStringCurrent status of tracking. Values include 
  • Pending
  • InfoReceived
  • InTransit
  • OutForDelivery
  • AttemptFail
  • Delivered
  • Exception
  • Expired
(See tag definition)
subtagStringCurrent subtag of tracking. (See subtag definition)
subtag_messageStringNormalized tracking message. (See subtag definition)
titleStringTitle of the tracking.
tracked_countNumberNumber of attempts AfterShip tracks at courier's system.
last_mile_tracking_supportedBoolean or NullIndicates if the shipment is trackable till the final destination.
Three possible values:
  • true
  • false
  • null
languageString or NullStore, customer, or order language of the tracking. ISO 639-1 Language Code .
return_to_senderBooleanWhether or not the shipment is returned to sender. Value istruewhen any of its checkpoints has subtagException_010(returning to sender) orException_011(returned to sender). Otherwise value isfalse
checkpointsArray of Checkpoint ObjectArray of Hash describes the checkpoint information.

Body

{
    "meta": {
        "code": 200
    },
    "data": {
        "tracking": {
            "id": "5b74f4958776db0e00b6f5ed",
            "created_at": "2018-08-16T03:50:45+00:00",
            "updated_at": "2018-08-17T06:25:10+00:00",
            "last_updated_at": "2018-08-17T06:25:10+00:00",
            "tracking_number": "1111111111111",
            "slug": "fedex",
            "active": false,
            "android": [],
            "custom_fields": null,
            "customer_name": null,
            "delivery_time": 2,
            "destination_country_iso3": null,
            "courier_destination_country_iso3": null,
            "emails": [],
            "expected_delivery": null,
            "ios": [],
            "note": null,
            "order_id": null,
            "order_id_path": null,
            "origin_country_iso3": "USA",
            "shipment_package_count": 1,
            "shipment_pickup_date": "2018-07-31T06:00:00",
            "shipment_delivery_date": "2018-08-01T17:19:47",
            "shipment_type": "FedEx Home Delivery",
            "shipment_weight": null,
            "shipment_weight_unit": "kg",
            "signed_by": "Signature not required",
            "smses": [],
            "source": "web",
            "tag": "Delivered",
            "subtag": "Delivered_001",
            "subtag_message": null,
            "title": "1111111111111",
            "tracked_count": 1,
            "last_mile_tracking_supported": null,
            "language": null,
            "unique_token": "deprecated",
            "checkpoints": [
                {
                    "slug": null,
                    "city": null,
                    "created_at": "2018-08-16T03:50:47+00:00",
                    "location": null,
                    "country_name": null,
                    "message": "Shipment information sent to FedEx",
                    "country_iso3": null,
                    "tag": "InfoReceived",
                    "subtag": "InfoReceived_001",
                    "subtag_message": null,
                    "checkpoint_time": "2018-07-31T14:33:00.000Z",
                    "coordinates": [],
                    "state": null,
                    "zip": null
                },
                {
                    "slug": null,
                    "city": "BROOKLYN",
                    "created_at": "2018-08-16T03:50:47+00:00",
                    "location": "BROOKLYN, NY",
                    "country_name": null,
                    "message": "Picked up",
                    "country_iso3": null,
                    "tag": "InTransit",
                    "subtag": "InTransit_002",
                    "subtag_message": null,
                    "checkpoint_time": "2018-07-31T20:47:00.000Z",
                    "coordinates": [],
                    "state": "NY",
                    "zip": null
                },
                {
                    "slug": null,
                    "city": "BROOKLYN",
                    "created_at": "2018-08-16T03:50:47+00:00",
                    "location": "BROOKLYN, NY",
                    "country_name": null,
                    "message": "Arrived at FedEx location",
                    "country_iso3": null,
                    "tag": "InTransit",
                    "subtag": "InTransit_003",
                    "subtag_message": null,
                    "checkpoint_time": "2018-07-31T21:51:00.000Z",
                    "coordinates": [],
                    "state": "NY",
                    "zip": null
                },
                {
                    "slug": null,
                    "city": "BROOKLYN",
                    "created_at": "2018-08-16T03:50:47+00:00",
                    "location": "BROOKLYN, NY",
                    "country_name": null,
                    "message": "Left FedEx origin facility",
                    "country_iso3": null,
                    "tag": "InTransit",
                    "subtag": "InTransit_007",
                    "subtag_message": null,
                    "checkpoint_time": "2018-08-01T00:29:29.000Z",
                    "coordinates": [],
                    "state": "NY",
                    "zip": null
                },
                {
                    "slug": null,
                    "city": "KEASBEY",
                    "created_at": "2018-08-16T03:50:47+00:00",
                    "location": "KEASBEY, NJ",
                    "country_name": null,
                    "message": "Shipment exception - Barcode label unreadable and replaced",
                    "country_iso3": null,
                    "tag": "Exception",
                    "subtag": "Exception_001",
                    "subtag_message": null,
                    "checkpoint_time": "2018-08-01T04:13:04.000Z",
                    "coordinates": [],
                    "state": "NJ",
                    "zip": null
                },
                {
                    "slug": null,
                    "city": "KEASBEY",
                    "created_at": "2018-08-16T03:50:47+00:00",
                    "location": "KEASBEY, NJ",
                    "country_name": null,
                    "message": "Arrived at FedEx location",
                    "country_iso3": null,
                    "tag": "InTransit",
                    "subtag": "InTransit_003",
                    "subtag_message": null,
                    "checkpoint_time": "2018-08-01T04:17:00.000Z",
                    "coordinates": [],
                    "state": "NJ",
                    "zip": null
                },
                {
                    "slug": null,
                    "city": "KEASBEY",
                    "created_at": "2018-08-16T03:50:47+00:00",
                    "location": "KEASBEY, NJ",
                    "country_name": null,
                    "message": "Departed FedEx location",
                    "country_iso3": null,
                    "tag": "InTransit",
                    "subtag": "InTransit_007",
                    "subtag_message": null,
                    "checkpoint_time": "2018-08-01T08:30:14.000Z",
                    "coordinates": [],
                    "state": "NJ",
                    "zip": null
                },
                {
                    "slug": null,
                    "city": "DAYTON",
                    "created_at": "2018-08-16T03:50:47+00:00",
                    "location": "DAYTON, NJ",
                    "country_name": null,
                    "message": "At local FedEx facility",
                    "country_iso3": null,
                    "tag": "InTransit",
                    "subtag": "InTransit_007",
                    "subtag_message": null,
                    "checkpoint_time": "2018-08-01T10:29:00.000Z",
                    "coordinates": [],
                    "state": "NJ",
                    "zip": null
                },
                {
                    "slug": null,
                    "city": "DAYTON",
                    "created_at": "2018-08-16T03:50:47+00:00",
                    "location": "DAYTON, NJ",
                    "country_name": null,
                    "message": "Arrived at FedEx location",
                    "country_iso3": null,
                    "tag": "InTransit",
                    "subtag": "InTransit_003",
                    "subtag_message": null,
                    "checkpoint_time": "2018-08-01T10:31:00.000Z",
                    "coordinates": [],
                    "state": "NJ",
                    "zip": null
                },
                {
                    "slug": null,
                    "city": "DAYTON",
                    "created_at": "2018-08-16T03:50:47+00:00",
                    "location": "DAYTON, NJ",
                    "country_name": null,
                    "message": "On FedEx vehicle for delivery",
                    "country_iso3": null,
                    "tag": "OutForDelivery",
                    "subtag": "OutForDelivery_001",
                    "subtag_message": null,
                    "checkpoint_time": "2018-08-01T10:41:00.000Z",
                    "coordinates": [],
                    "state": "NJ",
                    "zip": null
                },
                {
                    "slug": null,
                    "city": "Deal",
                    "created_at": "2018-08-16T03:50:47+00:00",
                    "location": "Deal, NJ",
                    "country_name": null,
                    "message": "Delivered - Left at front door. Signature Service not requested.",
                    "country_iso3": null,
                    "tag": "Delivered",
                    "subtag": "Delivered_001",
                    "subtag_message": null,
                    "checkpoint_time": "2018-08-01T17:19:47.000Z",
                    "coordinates": [],
                    "state": "NJ",
                    "zip": null
                }
            ],
            "subscribed_smses": [],
            "subscribed_emails": [
                "sample@aftership.com"
            ],
            "return_to_sender": false,
            "tracking_account_number": null,
            "tracking_origin_country": null,
            "tracking_destination_country": null,
            "tracking_key": null,
            "tracking_postal_code": null,
            "tracking_ship_date": null,
            "tracking_state": null
        }
    }
}