Create a tracking

post
/trackings

Create a tracking.

[url](../../docs/enum/additional_tracking_fields.md)[url](../../docs/enum/confidence_codes.md)[url](../../docs/enum/delivery_sub_statuses.md)[url](../../docs/enum/delivery_statuses.md)[url](../../docs/enum/slug_groups.md)[url](../../model/resource/tracking.json)[url](../../model/resource/checkpoint.json)[url](../../model/resource/courier.json)[url](../../model/resource/notification.json)[url](../../model/enum/additional_fields.v1.json)[url](../../model/enum/slug_group.v1.json)[url](../../model/enum/tag.v1.json)[url](../../reference/api.json/paths/~1trackings/get)[url](../../reference/api.json/paths/~1trackings/post)[url](../../reference/api.json/paths/~1trackings~1{slug}~1{tracking_number}/get)[url](../../reference/api.json/paths/~1trackings~1{slug}~1{tracking_number}/put)[url](../../reference/api.json/paths/~1trackings~1{slug}~1{tracking_number}/delete)[url](../../reference/api.json/paths/~1trackings~1{slug}~1{tracking_number}~1retrack/post)[url](../../reference/api.json/paths/~1trackings~1{slug}~1{tracking_number}~1mark-as-completed/post)[url](../../reference/api.json/paths/~1couriers/get)[url](../../reference/api.json/paths/~1couriers~1detect/post)[url](../../reference/api.json/paths/~1couriers~1all/get)[url](../../reference/api.json/paths/~1last_checkpoint~1{slug}~1{tracking_number}/get)[url](../../reference/api.json/paths/~1notifications~1{slug}~1{tracking_number}/get)[url](../../reference/api.json/paths/~1notifications~1{slug}~1{tracking_number}~1add/post)[url](../../reference/api.json/paths/~1notifications~1{slug}~1{tracking_number}~1remove/post) [url](../../docs/quickstart/authentication.md)
Content-Type
string
required

Content-Type

Allowed value:
application/json
Default:
application/json

Create tracking object

tracking_number
string
required

Tracking number of a shipment.Show all...

>= 1 characters
slug
string

Unique courier code. Get courier codes here.

title
string

By default this field shows the tracking_number, but you can customize it as you wish with any info (e.g. the order number).

>= 1 characters
order_id
string

A globally-unique identifier for the order.

>= 1 characters
order_id_path
string

The URL for the order in your system or store.

>= 1 characters
custom_fields
object

Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any personal data in custom fields.Show all...

language
string

The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language. Use an ISO 639-1 Language Code to specify the language.

>= 1 characters
order_promised_delivery_date
string<date>

The promised delivery date of the order. It uses the formats:

  • YYYY-MM-DD
  • YYYY-MM-DDTHH:mm:ss
  • YYYY-MM-DDTHH:mm:ssZ
>= 1 characters
delivery_type
string

Shipment delivery typeShow all...

>= 1 characters
Allowed values:
pickup_at_storedoor_to_doorpickup_at_courier
pickup_location
string

Shipment pickup location for receiver

>= 1 characters
pickup_note
string

Shipment pickup note for receiver

>= 1 characters
tracking_account_number
string

Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on additional tracking fields for more details.

tracking_key
string

Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on additional tracking fields for more details.

tracking_ship_date
string

The date and time when the shipment is shipped by the merchant and ready for pickup by the carrier. The field supports the following formats:

  • YYYY-MM-DD
  • YYYY-MM-DDTHH:mm:ss
  • YYYY-MM-DDTHH:mm:ssZ

The field serves two key purposes:

  • Calculate processing time metrics in the Order-to-delivery Analytics dashboard. To ensure accurate analytics, it's recommended to include timezone information when configuring this value
  • Required by certain carriers to retrieve tracking information as an additional tracking field.
origin_country_region
string

The ISO Alpha-3 code (3 letters) for the origin country/region. E.g. USA for the United States. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. Also the additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on additional tracking fields for more details.

Example:
CHN
origin_state
string

The state of the sender’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc.

Example:
Beijing
origin_city
string

The city of the sender’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc.

Example:
Beijing
origin_postal_code
string

The postal of the sender’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc.

Example:
065001
origin_raw_location
string

The sender address that the shipment is shipping from. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc.

Example:
Lihong Gardon 4A 2301, Chaoyang District, Beijing, BJ, 065001, CHN, China
destination_country_region
string

The ISO Alpha-3 code (3 letters) for the destination country/region. E.g. USA for the United States. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. Also the additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on additional tracking fields for more details.

Example:
USA
destination_state
string

The state of the recipient’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. Also the additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on additional tracking fields for more details.

Example:
New York
destination_city
string

The city of the recipient’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc.

Example:
New York City
destination_postal_code
string

The postal of the recipient’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. Also the additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on additional tracking fields for more details.

Example:
10001
destination_raw_location
string

The shipping address that the shipment is shipping to. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc.

Example:
13th Street, New York, NY, 10011, USA, United States
note
string

Text field for the note

slug_group
string

Slug group is a group of slugs which belong to same courier. For example, when you inpit "fedex-group" as slug_group, AfterShip will detect the tracking with "fedex-uk", "fedex-fims", and other slugs which belong to "fedex". It cannot be used with slug at the same time. (See slug_groups definition)

Allowed values:
amazon-groupfedex-grouptoll-grouptaqbin-grouptnt-groupcj-grouphermes-groupdpd-groupgls-groupdhl-groupfastway-groupasendia-group
order_date
string

Order date in YYYY-MM-DDTHH:mm:ssZ format. e.g. 2021-07-26T11:23:51-05:00

order_number
string

A unique, human-readable identifier for the order.

shipment_type
string

The carrier service type for the shipment. If you provide info for this field, AfterShip will not update it with info from the carrier.

shipment_tags
array[string]

Used to add tags to your shipments to help categorize and filter them easily.

<= 50 items
courier_connection_id
string

If you’ve connected multiple accounts for a single carrier on AfterShip, you can now use the courier_connection_id field to tell AfterShip which carrier account you’ve used to handle a shipment so we can track it. (Get your courier connection id)

tracking_origin_country_region
string

(Legacy) Replaced by origin_country_region. Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on additional tracking fields for more details.

tracking_destination_country_region
string

(Legacy) Replaced by destination_country_region. Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on additional tracking fields for more details.

tracking_postal_code
string

(Legacy) Replaced by destination_postal_code. Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on additional tracking fields for more details.

tracking_state
string

(Legacy) Replaced by destination_state. Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on additional tracking fields for more details.

location_id
string

The location_id refers to the place where you fulfilled the items.

  • If you provide a location_id, the system will automatically use it as the tracking's origin address. However, passing both location_id and any origin address information simultaneously is not allowed.
  • Please make sure you add your locations here before passing the location_id and verify that the location's status is active. Learn more about adding locations here.
shipping_method
string

The shipping_method string refers to the chosen method for delivering the package. Merchants typically offer various shipping methods to consumers during the checkout process, such as, Local Delivery, Free Express Worldwide Shipping, etc

last_mile
object

This field contains information about the last leg of the shipment, starting from the carrier who hands it over to the last-mile carrier, all the way to delivery. Once AfterShip detects that the shipment involves multiple legs and identifies the last-mile carrier, we will populate the last-mile carrier information in this object. Alternatively, the user can provide this information in this field to specify the last-mile carrier, which is helpful if AfterShip is unable to detect it automatically.

tracking_number
string
required

The tracking number of the last-mile carrier.

slug
string

The unique code of the carrier responsible for the last-mile of the shipment. Find all the courier slugs here.

customers
array[object]

The field contains the customer information associated with the tracking. A maximum of three customer objects are allowed.

role
string

The role of the customer, indicating whether the customer is an individual or a company.

>= 1 characters
name
string

Customer name associated with the tracking.

>= 1 characters
phone_number
string

The phone number(s) to receive SMS notifications. Phone numbers should begin with a + sign and include the area code.

email
string

Email address(es) to receive email notifications.

language
string

The preferred language of the customer. If you have set up AfterShip notifications in different languages, we use this to send the tracking updates to the customer in their preferred language.

Auth
:
Parameters
:
Body
preparing...