{ "openapi": "3.1.0", "info": { "title": "API Overview", "version": "1.0", "description": "> OAS Schema can be downloaded [here](https://stoplight.io/api/v1/projects/automizely/docs-api-aftership-com/nodes/reference/api.v4.json?branch=master&deref=optimizedBundle)\n
", "contact": { "name": "AfterShip Support", "url": "https://www.aftership.com/contact-us", "email": "support@aftership.com" }, "termsOfService": "https://www.aftership.com/terms", "summary": "API Overview" }, "servers": [ { "url": "https://api.aftership.com/v4", "description": "API Endpoint" } ], "paths": { "/trackings": { "get": { "summary": "Get trackings", "responses": { "200": { "description": "Get trackings response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Tracking_response_get_multiple.v1" }, "examples": { "normal response": { "value": { "meta": { "code": 200 }, "data": { "page": 1, "limit": 100, "count": 3, "keyword": "", "slug": "", "origin": [], "destination": [], "tag": "Pending", "fields": "", "created_at_min": "2018-05-19T06:23:00+00:00", "created_at_max": "2018-08-17T06:23:59+00:00", "last_updated_at": "2018-08-17T06:23:59+00:00", "return_to_sender": [], "courier_destination_country_iso3": [], "trackings": [ { "id": "5b74f4958776db0e00b6f5ed", "created_at": "2018-08-16T03:50:45+00:00", "updated_at": "2018-08-16T03:50:54+00:00", "last_updated_at": "2018-08-16T03:50:53+00:00", "tracking_number": "1111111111111", "slug": "fedex", "active": false, "android": [], "custom_fields": null, "customer_name": "John doe", "delivery_time": 2, "destination_country_iso3": "USA", "courier_destination_country_iso3": "USA", "emails": [], "expected_delivery": "2018-08-16", "ios": [], "note": "demo note", "order_id": "123", "order_number": "1234", "order_date": "2021-07-26T11:23:51-05:00", "order_id_path": "/123", "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": 1, "shipment_weight_unit": "kg", "signed_by": "Signature not required", "smses": [], "source": "web", "tag": "Delivered", "subtag": "Delivered_001", "subtag_message": "Delivered", "title": "1111111111111", "tracked_count": 1, "last_mile_tracking_supported": false, "language": null, "unique_token": "deprecated", "checkpoints": [ { "slug": "fedex", "city": "NY", "created_at": "2018-08-16T03:50:47+00:00", "location": "New York", "country_name": "United States", "message": "Shipment information sent to FedEx", "country_iso3": "USA", "tag": "InfoReceived", "subtag": "InfoReceived_001", "subtag_message": "Info Received", "checkpoint_time": "2018-07-31T10:33:00-04:00", "coordinates": [], "state": "NY", "zip": "100001", "raw_tag": "FPX_L_RPIF" } ], "subscribed_smses": [], "subscribed_emails": [], "return_to_sender": false, "tracking_account_number": "123456", "tracking_origin_country": "USA", "tracking_destination_country": "USA", "tracking_key": "123456", "tracking_postal_code": "10001", "tracking_ship_date": "20180816", "tracking_state": "NY", "order_promised_delivery_date": "2018-08-16", "delivery_type": "pickup_at_store", "pickup_location": "Flagship Store", "pickup_note": "Reach out to our staffs when you arrive our stores", "courier_tracking_link": "https://www.fedex.com/fedextrack/?tracknumbers=111111111111&cntry_code=us", "courier_redirect_link": "https://www.fedex.com/track?loc=en_US&tracknum=111111111111&requester=WT/trackdetails", "first_attempted_at": "2018-08-01T13:19:47-04:00", "on_time_status": "trending-on-time", "on_time_difference": 0, "order_tags": [] }, { "id": "5b0516676a810a1400eb5c1c", "created_at": "2018-05-23T07:21:11+00:00", "updated_at": "2018-06-22T07:21:57+00:00", "last_updated_at": "2018-06-22T07:21:57+00:00", "tracking_number": "2222222222222", "slug": "ups", "active": false, "android": [], "custom_fields": null, "customer_name": "John Doe", "delivery_time": 0, "destination_country_iso3": "USA", "courier_destination_country_iso3": "USA", "emails": [ "asdfasdf@asdf.com" ], "expected_delivery": "2018-08-16", "ios": [], "note": "sample note", "order_id": "123", "order_number": "1234", "order_id_path": "/123", "origin_country_iso3": "USA", "shipment_package_count": 0, "shipment_pickup_date": "2018-08-16", "shipment_delivery_date": "2018-08-16", "shipment_type": "FedEx Home Delivery", "shipment_weight": 1, "shipment_weight_unit": "kg", "signed_by": "John Doe", "smses": [ "+85261234567", "+85291234567" ], "source": "web", "tag": "Expired", "subtag": "Expired_001", "subtag_message": "Expired", "title": "12ASDF121312", "tracked_count": 42, "last_mile_tracking_supported": false, "language": "en", "unique_token": "deprecated", "checkpoints": [], "subscribed_smses": [ "+85222222222", "+8533333333" ], "subscribed_emails": [ "yoyo@yoyo.com", "yoyo2@yoyo.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, "order_promised_delivery_date": "2018-08-16", "delivery_type": "FedEx Home Delivery", "pickup_location": "Store front", "pickup_note": "some notes", "courier_tracking_link": "https://www.fedex.com/fedextrack/?tracknumbers=2222222222222&cntry_code=us", "courier_redirect_link": "https://www.fedex.com/track?loc=en_US&tracknum=2222222222222&requester=WT/trackdetails", "first_attempted_at": "2018-08-16", "on_time_status": "trending-on-time", "on_time_difference": 0, "order_tags": [] }, { "id": "5b04e2cbd560281400b70284", "created_at": "2018-05-23T03:40:59+00:00", "updated_at": "2018-07-11T08:34:34+00:00", "last_updated_at": "2018-07-11T08:34:34+00:00", "tracking_number": "1231231231231", "slug": "usps", "active": false, "android": [], "custom_fields": null, "customer_name": null, "delivery_time": 0, "destination_country_iso3": null, "courier_destination_country_iso3": null, "emails": [ "asdfsaddf@asdf.com", "asdfasd@asdfasdfasdfasd.com" ], "expected_delivery": null, "ios": [], "note": null, "order_id": null, "order_number": "1234", "order_id_path": null, "origin_country_iso3": "USA", "shipment_package_count": 0, "shipment_pickup_date": null, "shipment_delivery_date": null, "shipment_type": null, "shipment_weight": null, "shipment_weight_unit": null, "signed_by": null, "smses": [ "+85291234567", "+85291234566" ], "source": "web", "tag": "Expired", "subtag": "Expired_001", "subtag_message": "Expired", "title": "1231231231231", "tracked_count": 1, "last_mile_tracking_supported": false, "language": null, "unique_token": "deprecated", "checkpoints": [], "subscribed_smses": [ "+85290001111" ], "subscribed_emails": [ "asdfasdf@asdf.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, "order_promised_delivery_date": null, "delivery_type": null, "pickup_location": null, "pickup_note": null, "courier_tracking_link": "https://www.fedex.com/fedextrack/?tracknumbers=1231231231231&cntry_code=us", "courier_redirect_link": "https://www.fedex.com/track?loc=en_US&tracknum=1231231231231&requester=WT/trackdetails", "first_attempted_at": null, "on_time_status": "trending-on-time", "on_time_difference": 0, "order_tags": [], "aftership_estimated_delivery_date": { "estimated_delivery_date": "2022-01-03", "confidence_score": null, "estimated_delivery_date_min": "2022-01-01", "estimated_delivery_date_max": "2022-01-06" }, "destination_raw_location": "Sydney, Australia" } ] } } } } } } } }, "operationId": "get-trackings", "description": "Get tracking results of multiple trackings.\n\n ", "parameters": [ { "schema": { "type": "string", "enum": [ "application/json" ], "example": "application/json", "default": "application/json" }, "in": "header", "name": "Content-Type", "description": "Content-Type\n", "required": true }, { "schema": { "type": "number", "minimum": 1, "default": 1, "example": 1 }, "in": "query", "name": "page", "description": "The page to query. Maximum page number is bounded by total number of queried trackings which cannot exceed 500,000 trackings. (Default: 1)" }, { "schema": { "type": "number", "minLength": 1, "maxLength": 200, "minimum": 1, "maximum": 200, "default": 100, "example": 100 }, "in": "query", "name": "limit", "description": "Number of trackings each page contain. (Default: 100, Max: 200)" }, { "schema": { "type": "string", "example": "RA123456789US" }, "in": "query", "name": "keyword", "description": "Search the content of the tracking record fields: `tracking_number`, `title`, `order_id`, `customer_name`, `custom_fields`, `emails`, `smses`" }, { "schema": { "type": "string", "example": "RA123456789US,LE123456789US" }, "in": "query", "name": "tracking_numbers", "description": "Tracking number of shipments. Use comma to separate multiple values (Example: RA123456789US,LE123456789US). Supports up to 50 tracking numbers." }, { "schema": { "type": "string", "pattern": "^[a-z0-9-]+$", "minLength": 1, "example": "usps" }, "in": "query", "name": "slug", "description": "Unique courier code Use comma for multiple values. (Example: dhl,ups,usps)" }, { "schema": { "type": "number", "example": 1 }, "in": "query", "name": "delivery_time", "description": "Total delivery time in days.\n- Difference of 1st checkpoint time and delivered time for delivered shipments\n- Difference of 1st checkpoint time and current time for non-delivered shipments\nValue as `0` for pending shipments or delivered shipment with only one checkpoint." }, { "schema": { "type": "string", "pattern": "^[A-Z,]+$", "example": "USA" }, "in": "query", "name": "origin", "description": "Origin country/region of trackings. Use ISO Alpha-3 (three letters). Use comma for multiple values. (Example: USA,HKG)" }, { "schema": { "type": "string", "pattern": "^[A-Z,]+$", "example": "USA" }, "in": "query", "name": "destination", "description": "Destination country/region of trackings. Use ISO Alpha-3 (three letters). Use comma for multiple values. (Example: USA,HKG)" }, { "schema": { "type": "string", "enum": [ "Pending", "InfoReceived", "InTransit", "OutForDelivery", "AttemptFail", "Delivered", "AvailableForPickup", "Exception", "Expired" ], "example": "InTransit", "pattern": "^[A-Za-z]+$" }, "in": "query", "name": "tag", "description": "Current status of tracking. Values include `Pending`, `InfoReceived`, `InTransit`, `OutForDelivery`, `AttemptFail`, `Delivered`, `AvailableForPickup`, `Exception`, `Expired` (See tag definition)" }, { "schema": { "type": "string", "example": "2013-03-15T16:41:56+08:00", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\+[0-9]{2}:[0-9]{2}$" }, "in": "query", "name": "created_at_min", "description": "Start date and time of trackings created. AfterShip only stores data of 90 days.\n\n(Defaults: 30 days ago, Example: 2013-03-15T16:41:56+08:00)" }, { "schema": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\+[0-9]{2}:[0-9]{2}$", "example": "2013-03-15T16:41:56+08:00" }, "in": "query", "name": "created_at_max", "description": "End date and time of trackings created.\n(Defaults: now, Example: 2013-04-15T16:41:56+08:00)" }, { "schema": { "type": "string", "example": "2013-03-15T16:41:56+08:00", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\+[0-9]{2}:[0-9]{2}$" }, "in": "query", "name": "updated_at_min", "description": "Start date and time of trackings updated. (Example: 2013-04-15T16:41:56+08:00)" }, { "schema": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\+[0-9]{2}:[0-9]{2}$", "example": "2013-03-15T16:41:56+08:00" }, "in": "query", "name": "updated_at_max", "description": "End date and time of trackings updated. (Example: 2013-04-15T16:41:56+08:00)" }, { "schema": { "type": "string", "example": "title", "pattern": "^[a-z0-9,]+$" }, "in": "query", "name": "fields", "description": "List of fields to include in the response. Use comma for multiple values. Available options: `title`, `order_id`, `tag`, `checkpoints`. Example: `title,order_id`" }, { "schema": { "type": "string", "pattern": "^[a-z]{2}$", "example": "en", "minLength": 2, "maxLength": 2 }, "in": "query", "name": "lang", "description": "Default: '' / Example: 'en'\nSupport Chinese to English translation for `china-ems` and `china-post` only" }, { "schema": { "type": "string", "pattern": "^[a-z,]+$", "example": "true" }, "in": "query", "name": "return_to_sender", "description": "Select return to sender, the value should be `true` or `false`, with optional comma separated." }, { "schema": { "type": "string", "pattern": "^[A-Z,]+$", "example": "USA" }, "in": "query", "name": "courier_destination_country_iso3", "description": "Destination country/region of trackings returned by courier. Use ISO Alpha-3 (three letters). Use comma for multiple values. (Example: USA,HKG)" }, { "schema": { "type": "string" }, "in": "query", "description": "Tags you added to your shipments to help categorize and filter them easily. Use a comma to separate multiple values (Example: a,b)", "name": "shipment_tags" } ], "tags": [ "Trackings" ] }, "post": { "summary": "Create a tracking", "operationId": "post-trackings", "responses": { "201": { "description": "Tracking object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Tracking_response.v1" }, "examples": { "normal response": { "value": { "meta": { "code": 201 }, "data": { "tracking": { "id": "5b766a5cc7c33c0e007de3c9", "created_at": "2018-08-17T06:25:32+00:00", "updated_at": "2018-08-17T06:25:32+00:00", "last_updated_at": "2018-08-17T06:25:32+00:00", "tracking_number": "1111111111111", "slug": "fedex", "active": true, "android": [], "custom_fields": null, "customer_name": "John doe", "delivery_time": 0, "destination_country_iso3": "USA", "courier_destination_country_iso3": "USA", "emails": [], "expected_delivery": "2018-08-16", "ios": [], "note": "test note", "order_id": "123", "order_date": "2021-07-26T11:23:51-05:00", "order_id_path": "/123", "origin_country_iso3": "USD", "shipment_package_count": 0, "shipment_pickup_date": "2018-08-16", "shipment_delivery_date": "2018-08-16", "shipment_type": "FedEx Home Delivery", "shipment_weight": 1, "shipment_weight_unit": "kg", "signed_by": "John Doe", "smses": [], "source": "api", "tag": "Pending", "subtag": "Pending_001", "subtag_message": "Pending", "title": "1111111111111", "tracked_count": 0, "last_mile_tracking_supported": false, "language": null, "unique_token": "deprecated", "checkpoints": [], "subscribed_smses": [], "subscribed_emails": [], "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, "order_promised_delivery_date": "2019-05-20", "delivery_type": "pickup_at_store", "pickup_location": "Flagship Store", "pickup_note": "Contact shop keepers when you arrive our stores for shipment pickup", "courier_tracking_link": "https://www.fedex.com/fedextrack/?tracknumbers=1111111111111&cntry_code=us", "courier_redirect_link": "https://www.fedex.com/track?loc=en_US&tracknum=111111111111&requester=WT/trackdetails", "first_attempted_at": "2018-08-16", "on_time_status": "trending-on-time", "on_time_difference": 0, "order_tags": [], "aftership_estimated_delivery_date": null } } } } } } } } }, "description": "Create a tracking.\n\n ", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "tracking": { "type": "object", "required": [ "tracking_number" ], "properties": { "tracking_number": { "type": "string", "minLength": 1, "description": "Tracking number of a shipment.\n\nDuplicated tracking numbers, tracking numbers with invalid tracking number format will not be accepted.\n\nWe only accept tracking numbers with length from 4 to 100\n\nWe currently support the following characters in a tracking number:\n\n- A - Z\n- 0 - 9\n- `-` (Hyphen)\n- . (Period)\n- _ (Underscore)\n- / (Slash)" }, "slug": { "type": "string", "description": "Unique courier code. Get courier codes [here](https://www.aftership.com/docs/tracking/others/supported-couriers)." }, "title": { "type": "string", "minLength": 1, "description": "By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number)." }, "order_id": { "type": "string", "minLength": 1, "description": "A globally-unique identifier for the order." }, "order_id_path": { "type": "string", "minLength": 1, "description": "The URL for the order in your system or store." }, "custom_fields": { "type": "object", "description": "Custom fields that accept an object with string field.\n\n- Maximum charater limit for a key name: 30\n- Maximum count for a key-value pair in a custom field object: 25\n- Maximum value length: 512 charaters\n- Supported value type: String only (object and array are prohibited)" }, "language": { "type": "string", "minLength": 1, "description": "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](https://help.aftership.com/hc/en-us/articles/360001623287-Supported-Language-Parameters) to specify the language." }, "order_promised_delivery_date": { "type": "string", "minLength": 1, "description": "The promised delivery date of the order. It uses the format YYYY-MM-DD. This has no timezone and uses whatever date you provide. Since other EDDs use the shipment recipient’s timezone, we suggest following the same logic here.", "format": "date", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" }, "delivery_type": { "type": "string", "minLength": 1, "description": "Shipment delivery type\n\n- pickup_at_store\n- pickup_at_courier\n- door_to_door", "enum": [ "pickup_at_store", "door_to_door", "pickup_at_courier" ] }, "pickup_location": { "type": "string", "minLength": 1, "description": "Shipment pickup location for receiver" }, "pickup_note": { "type": "string", "minLength": 1, "description": "Shipment pickup note for receiver" }, "tracking_account_number": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_key": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_ship_date": { "type": "string", "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, "emails": { "type": "array", "description": "Email address(es) to receive email notifications. Accept either array or comma separated as input. Supports up to 3 email addresses.", "items": { "type": "string" } }, "smses": { "type": "array", "description": "The phone number(s) to receive sms notifications. Enter `+` andarea `code before` phone number. Accept either array or comma separated as input. Supports up to 3 phone numbers.", "items": { "type": "string" } }, "customer_name": { "type": "string", "description": "Customer name of the tracking." }, "origin_country_iso3": { "type": "string", "description": "The [ISO Alpha-3](https://support.aftership.com/en/article/iso3-country-code-rlpi07/) 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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "CHN" }, "origin_state": { "type": "string", "description": "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": { "type": "string", "description": "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": { "type": "string", "description": "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": { "type": "string", "description": "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_iso3": { "type": "string", "description": "The [ISO Alpha-3](https://support.aftership.com/en/article/iso3-country-code-rlpi07/) 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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "USA" }, "destination_state": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "New York" }, "destination_city": { "type": "string", "description": "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": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "10001" }, "destination_raw_location": { "type": "string", "description": "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": { "type": "string", "description": "Text field for the note" }, "slug_group": { "$ref": "#/components/schemas/Slug_group.v1" }, "order_date": { "type": "string", "description": "Order date in YYYY-MM-DDTHH:mm:ssZ format. e.g. 2021-07-26T11:23:51-05:00" }, "order_number": { "type": "string", "description": "A unique, human-readable identifier for the order." }, "shipment_type": { "type": "string", "description": "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": { "type": "array", "description": "Used to add tags to your shipments to help categorize and filter them easily.", "maxItems": 50, "items": { "type": "string", "maxLength": 32 } }, "courier_connection_id": { "type": "string", "description": "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](https://admin.aftership.com/carrier-connection))" }, "next_couriers": { "type": "array", "description": "If a shipment has multiple carriers, you can use the next_couriers field to tell AfterShip who the second carrier is. This is useful if the first carrier does not send us this information. ", "maxItems": 1, "items": { "type": "object", "required": [ "slug", "tracking_number" ], "properties": { "slug": { "type": "string" }, "tracking_number": { "type": "string", "description": "Tracking number of a shipment.\n\nDuplicated tracking numbers, tracking numbers with invalid tracking number format will not be accepted.\n\nWe only accept tracking numbers with length from 4 to 100\n\nWe currently support the following characters in a tracking number:\n\n- A - Z\n- 0 - 9\n- `-` (Hyphen)\n- . (Period)\n- _ (Underscore)\n- / (Slash)" } } } }, "tracking_origin_country": { "type": "string", "description": "(Legacy) Replaced by `origin_country_iso3`. 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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_destination_country": { "type": "string", "description": "(Legacy) Replaced by `destination_country_iso3`. 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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_postal_code": { "type": "string", "description": "(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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_state": { "type": "string", "description": "(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](../../docs/enum/additional_tracking_fields.md) for more details." } } } }, "required": [ "tracking" ] }, "examples": { "create-tracking": { "value": { "tracking": { "slug": "dhl", "tracking_number": "123456789", "title": "Title Name", "smses": [ "+18555072509", "+18555072501" ], "emails": [ "email@yourdomain.com", "another_email@yourdomain.com" ], "order_id": "ID 1234", "order_number": "1234", "order_id_path": "http://www.aftership.com/order_id=1234", "custom_fields": { "product_name": "iPhone Case", "product_price": "USD19.99" }, "language": "en", "order_promised_delivery_date": "2019-05-20", "delivery_type": "pickup_at_store", "pickup_location": "Flagship Store", "pickup_note": "Reach out to our staffs when you arrive our stores for shipment pickup", "origin_country_iso3": "CHN", "origin_state": "Beijing", "origin_city": "Beijing", "origin_postal_code": "065001", "origin_raw_location": "Lihong Gardon 4A 2301, Chaoyang District, Beijing, BJ, 065001, CHN, China", "destination_country_iso3": "USA", "destination_state": "New York", "destination_city": "New York City", "destination_postal_code": "10001", "destination_raw_location": "13th Street, New York, NY, 10011, USA, United States" } } } } } }, "description": "Create tracking object" }, "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true } ], "tags": [ "Trackings" ] } }, "/trackings/{id}": { "get": { "summary": "Get a tracking by ID", "responses": { "200": { "description": "Tracking object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Tracking_response.v1" }, "examples": { "get-tracking": { "value": { "meta": { "code": 200 }, "data": { "tracking": { "id": "5b7658cec7c33c0e007de3c5", "created_at": "2018-08-17T05:10:38+00:00", "updated_at": "2018-08-17T05:10:46+00:00", "last_updated_at": "2018-08-17T05:10:46+00:00", "tracking_number": "111111111111", "slug": "fedex", "active": false, "android": [], "custom_fields": null, "customer_name": null, "delivery_time": 2, "destination_country_iso3": "JPN", "courier_destination_country_iso3": "JPN", "emails": [], "expected_delivery": null, "ios": [], "note": null, "order_id": null, "order_id_path": null, "order_number": "1234", "origin_country_iso3": "CHN", "shipment_package_count": 1, "shipment_pickup_date": "2018-07-23T08:58:00", "shipment_delivery_date": "2018-07-25T01:10:00", "shipment_type": "FedEx International Economy", "shipment_weight": 4, "shipment_weight_unit": "kg", "signed_by": "..KOSUTOKO", "smses": [], "source": "api", "tag": "Delivered", "subtag": "Delivered_001", "subtag_message": "Delivered", "title": "Title Name", "tracked_count": 1, "last_mile_tracking_supported": null, "language": null, "unique_token": "deprecated", "checkpoints": [ { "slug": "fedex", "city": null, "created_at": "2018-08-17T05:10:41+00:00", "location": null, "country_name": null, "message": "Shipment information sent to FedEx", "country_iso3": null, "tag": "InfoReceived", "subtag": "InfoReceived_001", "subtag_message": "Info Received", "checkpoint_time": "2018-07-23T01:21:39-05:00", "coordinates": [], "state": null, "zip": null, "raw_tag": "FPX_L_RPIF" } ], "subscribed_smses": [], "subscribed_emails": [], "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, "order_promised_delivery_date": "2019-05-02", "delivery_type": "pickup_at_store", "pickup_location": "Flagship Store", "pickup_note": null, "courier_tracking_link": "https://www.fedex.com/fedextrack/?tracknumbers=111111111111&cntry_code=us", "courier_redirect_link": "https://www.fedex.com/track?loc=en_US&tracknum=111111111111&requester=WT/trackdetails", "first_attempted_at": "2018-07-25T10:10:00+09:00", "on_time_status": "trending-on-time", "on_time_difference": 0, "order_tags": [], "aftership_estimated_delivery_date": { "estimated_delivery_date": "2022-01-03", "confidence_score": null, "estimated_delivery_date_min": "2022-01-01", "estimated_delivery_date_max": "2022-01-06" } } } } } } } } } }, "operationId": "get-trackings-:slug-:tracking_number-id", "description": "Get tracking results of a single tracking.\n\n ", "parameters": [ { "schema": { "type": "string", "example": "title,order_id" }, "in": "query", "name": "fields", "description": "List of fields to include in the response. Use comma for multiple values. Fields to include: `tracking_postal_code`, `tracking_ship_date`, `tracking_account_number`, `tracking_key`, `tracking_origin_country`, `tracking_destination_country`, `tracking_state`, `title`, `order_id`, `tag`, `checkpoints`, `checkpoint_time`, `message`, `country_name`" }, { "schema": { "type": "string", "example": "en" }, "in": "query", "name": "lang", "description": "Support Chinese to English translation for `china-ems` and `china-post` only" }, { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true } ], "tags": [ "Trackings" ] }, "parameters": [ { "schema": { "type": "string" }, "name": "id", "in": "path", "required": true, "description": "tracking ID" } ], "put": { "summary": "Update a tracking by ID", "operationId": "put-trackings-slug-tracking_number-id", "responses": { "200": { "description": "Update a tracking", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Tracking_response.v1" }, "examples": { "update-tracking": { "value": { "meta": { "code": 200 }, "data": { "tracking": { "id": "5b7658cec7c33c0e007de3c5", "created_at": "2018-08-17T05:10:38+00:00", "updated_at": "2018-08-17T05:10:46+00:00", "last_updated_at": "2018-08-17T05:10:46+00:00", "tracking_number": "111111111111", "slug": "fedex", "active": false, "android": [], "custom_fields": null, "customer_name": null, "delivery_time": 2, "destination_country_iso3": "JPN", "courier_destination_country_iso3": "JPN", "emails": [], "expected_delivery": null, "ios": [], "note": null, "order_id": null, "order_id_path": null, "origin_country_iso3": "CHN", "shipment_package_count": 1, "shipment_pickup_date": "2018-07-23T08:58:00", "shipment_delivery_date": "2018-07-25T01:10:00", "shipment_type": "FedEx International Economy", "shipment_weight": 4, "shipment_weight_unit": "kg", "signed_by": "..KOSUTOKO", "smses": [], "source": "api", "tag": "Delivered", "subtag": "Delivered_001", "subtag_message": "Delivered", "title": "Title Name", "tracked_count": 1, "last_mile_tracking_supported": null, "language": null, "unique_token": "deprecated", "checkpoints": [ { "slug": "fedex", "city": null, "created_at": "2018-08-17T05:10:41+00:00", "location": null, "country_name": null, "message": "Shipment information sent to FedEx", "country_iso3": null, "tag": "InfoReceived", "subtag": "InfoReceived_001", "subtag_message": "Info Received", "checkpoint_time": "2018-07-23T01:21:39-05:00", "coordinates": [], "state": null, "zip": null, "raw_tag": "FPX_L_RPIF" } ], "subscribed_smses": [], "subscribed_emails": [], "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, "order_promised_delivery_date": "2019-05-02", "delivery_type": "pickup_at_store", "pickup_location": "Flagship Store", "pickup_note": null, "courier_tracking_link": "https://www.fedex.com/fedextrack/?tracknumbers=111111111111&cntry_code=us", "courier_redirect_link": "https://www.fedex.com/track?loc=en_US&tracknum=111111111111&requester=WT/trackdetails", "first_attempted_at": "2018-07-25T10:10:00+09:00", "on_time_status": "trending-on-time", "on_time_difference": 0, "order_tags": [], "aftership_estimated_delivery_date": { "estimated_delivery_date": "2022-01-03", "confidence_score": null, "estimated_delivery_date_min": "2022-01-01", "estimated_delivery_date_max": "2022-01-06" } } } } } } } } } }, "description": "Update a tracking.\n\n ", "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "tracking": { "type": "object", "properties": { "smses": { "type": "array", "description": "The phone number(s) to receive sms notifications. Input `[]` to clear the value of this field. Supports up to 3 phone numbers.", "items": { "type": "string" } }, "emails": { "type": "array", "description": "Email address(es) to receive email notifications. Input `[]` to clear the value of this field. Supports up to 3 email addresses.", "items": { "type": "string" } }, "title": { "type": "string", "description": "By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number)." }, "customer_name": { "type": "string", "description": "Customer name of the tracking." }, "order_id": { "type": "string", "description": "A globally-unique identifier for the order." }, "order_id_path": { "type": "string", "description": "The URL for the order in your system or store." }, "custom_fields": { "type": "object", "additionalProperties": true, "description": "Custom fields that accept an object with string, boolean or number fields.\nInput `null` to clear the value of this field." }, "note": { "type": "string", "description": "Text field for the note.\nInput `\"\"` to clear the value of this field." }, "language": { "type": "string", "description": "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](https://help.aftership.com/hc/en-us/articles/360001623287-Supported-Language-Parameters) to specify the language." }, "order_promised_delivery_date": { "type": "string", "description": "The promised delivery date of the order. It uses the format YYYY-MM-DD. This has no timezone and uses whatever date you provide. Since other EDDs use the shipment recipient’s timezone, we suggest following the same logic here." }, "delivery_type": { "type": "string", "description": "Shipment delivery type\n\n- `pickup_at_store`\n- `pickup_at_courier`\n- `door_to_door`", "enum": [ "pickup_at_store", "pickup_at_courier", "door_to_door" ] }, "pickup_location": { "type": "string", "description": "Shipment pickup location for receiver" }, "pickup_note": { "type": "string", "description": "Shipment pickup note for receiver" }, "slug": { "type": "string", "description": "Unique code of each courier. Provide a single courier.(https://admin.aftership.com/settings/couriers). Get a list of courier slug using [GET /couriers](./api.v4.json/paths/~1couriers/get)" }, "tracking_account_number": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_key": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_ship_date": { "type": "string", "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, "order_number": { "type": "string", "description": "A unique, human-readable identifier for the order." }, "order_date": { "type": "string", "description": "Order date in YYYY-MM-DDTHH:mm:ssZ format. e.g. 2021-07-26T11:23:51-05:00" }, "shipment_type": { "type": "string", "description": "The carrier service type for the shipment. If you provide info for this field, AfterShip will not update it with info from the carrier." }, "origin_country_iso3": { "type": "string", "description": "The [ISO Alpha-3](https://support.aftership.com/en/article/iso3-country-code-rlpi07/) 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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "CHN" }, "origin_state": { "type": "string", "description": "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": { "type": "string", "description": "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": { "type": "string", "description": "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": { "type": "string", "description": "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_iso3": { "type": "string", "description": "The [ISO Alpha-3](https://support.aftership.com/en/article/iso3-country-code-rlpi07/) 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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "USA" }, "destination_state": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "New York" }, "destination_city": { "type": "string", "description": "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": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "10001" }, "destination_raw_location": { "type": "string", "description": "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" }, "tracking_origin_country": { "type": "string", "description": "(Legacy) Replaced by `origin_country_iso3`. 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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_destination_country": { "type": "string", "description": "(Legacy) Replaced by `destination_country_iso3`. 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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_postal_code": { "type": "string", "description": "(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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_state": { "type": "string", "description": "(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](../../docs/enum/additional_tracking_fields.md) for more details." } } } } }, "examples": { "update-tracking-request": { "value": { "tracking": { "title": "New Title", "note": "some notes" } } } } } }, "description": "" }, "tags": [ "Trackings" ] }, "delete": { "summary": "Delete a tracking by ID", "operationId": "delete-trackings-slug-tracking_number-id", "responses": { "200": { "description": "Delete tracking", "content": { "application/json": { "schema": { "type": "object", "properties": { "meta": { "$ref": "#/components/schemas/Meta.v1" }, "data": { "type": "object", "properties": { "tracking": { "type": "object", "properties": { "id": { "type": "string", "description": "Tracking id" }, "tracking_number": { "type": "string", "description": "Tracking number" }, "slug": { "type": "string", "description": "Unique code of courier. Get the slugs from [here](./api.v4.json/paths/~1couriers/get)." }, "tracking_account_number": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_key": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_ship_date": { "type": [ "string", "null" ], "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_origin_country": { "type": [ "string", "null" ], "description": "(Legacy) 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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_destination_country": { "type": [ "string", "null" ], "description": "(Legacy) 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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_postal_code": { "type": [ "string", "null" ], "description": "(Legacy) 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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_state": { "type": [ "string", "null" ], "description": "(Legacy) 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](../../docs/enum/additional_tracking_fields.md) for more details." } } } } } } }, "examples": { "delete tracking": { "value": { "meta": { "code": 200 }, "data": { "tracking": { "id": "5b7658cec7c33c0e007de3c5", "tracking_number": "772857780801111", "slug": "fedex", "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 } } } } } } } } }, "description": "Delete a tracking.\n\n ", "parameters": [ { "schema": { "type": "string", "enum": [ "application/json" ], "default": "application/json" }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true } ], "tags": [ "Trackings" ] } }, "/trackings/{id}/retrack": { "parameters": [ { "schema": { "type": "string" }, "name": "id", "in": "path", "required": true, "description": "tracking id" } ], "post": { "summary": "Retrack an expired tracking by ID", "operationId": "post-trackings-slug-tracking_number-retrack-id", "responses": { "200": { "description": "Partial tracking object", "content": { "application/json": { "schema": { "type": "object", "properties": { "meta": { "$ref": "#/components/schemas/Meta.v1" }, "data": { "type": "object", "properties": { "tracking": { "type": "object", "properties": { "id": { "type": "string", "description": "A unique identifier generated by AfterShip for the tracking." }, "tracking_number": { "type": "string", "description": "Tracking number." }, "slug": { "type": "string", "description": "Unique code of courier. Get the slugs from [here](./api.v4.json/paths/~1couriers/get)." }, "tracking_account_number": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_origin_country": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_destination_country": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_key": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_ship_date": { "type": [ "string", "null" ], "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_postal_code": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_state": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "active": { "type": "boolean", "description": "Whether or not AfterShip will continue tracking the shipments. Value is `false` when tag (status) is `Delivered`, `Expired`, or further updates for 30 days since last update." } } } } } } } } }, "headers": {} } }, "description": "Retrack an expired tracking. Max 3 times per tracking.\n\n ", "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "description": "Content-Type", "name": "Content-Type", "required": true } ], "tags": [ "Trackings" ] } }, "/trackings/{id}/mark-as-completed": { "parameters": [ { "schema": { "type": "string" }, "name": "id", "in": "path", "required": true, "description": "tracking id" } ], "post": { "summary": "Mark tracking as completed by ID", "operationId": "post-trackings-slug-tracking_number-mark-as-completed-id", "responses": { "200": { "description": "Tracking object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Tracking_response.v1" } } } } }, "description": "Mark a tracking as completed. The tracking won't auto update until retrack it.\n\n ", "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "reason": { "type": "string", "enum": [ "DELIVERED", "LOST", "RETURNED_TO_SENDER" ], "description": "One of `DELIVERED`, `LOST` or `RETURNED_TO_SENDER`.\n\n- Mark the tracking as completed with `DELIVERED`. The tag of the tracking will be updated to `Delivered` and the subtag will be updated to `Delivered_001`.\n- Mark the tracking as completed with `LOST`. The tag of the tracking will be updated to `Exception` and the subtag will be updated to `Exception_013`.\n- Mark the tracking as completed with `RETURNED_TO_SENDER`. The tag of the tracking will be updated to `Exception` and the subtag will be updated to `Exception_011`." } }, "required": [ "reason" ] } } }, "description": "" }, "tags": [ "Trackings" ] } }, "/trackings/{slug}/{tracking_number}": { "get": { "summary": "Get a tracking (Legacy)", "responses": { "200": { "description": "Tracking object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Tracking_response.v1" }, "examples": { "get-tracking": { "value": { "meta": { "code": 200 }, "data": { "tracking": { "id": "5b7658cec7c33c0e007de3c5", "created_at": "2018-08-17T05:10:38+00:00", "updated_at": "2018-08-17T05:10:46+00:00", "last_updated_at": "2018-08-17T05:10:46+00:00", "tracking_number": "111111111111", "slug": "fedex", "active": false, "android": [], "custom_fields": null, "customer_name": null, "delivery_time": 2, "destination_country_iso3": "JPN", "courier_destination_country_iso3": "JPN", "emails": [], "expected_delivery": null, "ios": [], "note": null, "order_id": null, "order_id_path": null, "order_number": "1234", "origin_country_iso3": "CHN", "shipment_package_count": 1, "shipment_pickup_date": "2018-07-23T08:58:00", "shipment_delivery_date": "2018-07-25T01:10:00", "shipment_type": "FedEx International Economy", "shipment_weight": 4, "shipment_weight_unit": "kg", "signed_by": "..KOSUTOKO", "smses": [], "source": "api", "tag": "Delivered", "subtag": "Delivered_001", "subtag_message": "Delivered", "title": "Title Name", "tracked_count": 1, "last_mile_tracking_supported": null, "language": null, "unique_token": "deprecated", "checkpoints": [ { "slug": "fedex", "city": null, "created_at": "2018-08-17T05:10:41+00:00", "location": null, "country_name": null, "message": "Shipment information sent to FedEx", "country_iso3": null, "tag": "InfoReceived", "subtag": "InfoReceived_001", "subtag_message": "Info Received", "checkpoint_time": "2018-07-23T01:21:39-05:00", "coordinates": [], "state": null, "zip": null, "raw_tag": "FPX_L_RPIF" } ], "subscribed_smses": [], "subscribed_emails": [], "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, "order_promised_delivery_date": "2019-05-02", "delivery_type": "pickup_at_store", "pickup_location": "Flagship Store", "pickup_note": null, "courier_tracking_link": "https://www.fedex.com/fedextrack/?tracknumbers=111111111111&cntry_code=us", "courier_redirect_link": "https://www.fedex.com/track?loc=en_US&tracknum=111111111111&requester=WT/trackdetails", "first_attempted_at": "2018-07-25T10:10:00+09:00", "on_time_status": "trending-on-time", "on_time_difference": 0, "order_tags": [], "aftership_estimated_delivery_date": { "estimated_delivery_date": "2022-01-03", "confidence_score": null, "estimated_delivery_date_min": "2022-01-01", "estimated_delivery_date_max": "2022-01-06" } } } } } } } } } }, "operationId": "get-trackings-:slug-:tracking_number", "description": "Get tracking results of a single tracking.\n\n ", "parameters": [ { "schema": { "type": "string", "example": "title,order_id" }, "in": "query", "name": "fields", "description": "List of fields to include in the response. Use comma for multiple values. Fields to include: `tracking_postal_code`, `tracking_ship_date`, `tracking_account_number`, `tracking_key`, `tracking_origin_country`, `tracking_destination_country`, `tracking_state`, `title`, `order_id`, `tag`, `checkpoints`, `checkpoint_time`, `message`, `country_name`" }, { "schema": { "type": "string", "example": "en" }, "in": "query", "name": "lang", "description": "Support Chinese to English translation for `china-ems` and `china-post` only" }, { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_account_number", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_origin_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_destination_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_key", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_postal_code", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_ship_date", "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_state", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." } ], "tags": [ "Trackings" ] }, "parameters": [ { "schema": { "type": "string" }, "name": "slug", "in": "path", "required": true, "description": "Tracking slug" }, { "schema": { "type": "string" }, "name": "tracking_number", "in": "path", "required": true, "description": "Tracking number" } ], "put": { "summary": "Update a tracking (Legacy)", "operationId": "put-trackings-slug-tracking_number", "responses": { "200": { "description": "Update a tracking", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Tracking_response.v1" }, "examples": { "update-tracking": { "value": { "meta": { "code": 200 }, "data": { "tracking": { "id": "5b7658cec7c33c0e007de3c5", "created_at": "2018-08-17T05:10:38+00:00", "updated_at": "2018-08-17T05:10:46+00:00", "last_updated_at": "2018-08-17T05:10:46+00:00", "tracking_number": "111111111111", "slug": "fedex", "active": false, "android": [], "custom_fields": null, "customer_name": null, "delivery_time": 2, "destination_country_iso3": "JPN", "courier_destination_country_iso3": "JPN", "emails": [], "expected_delivery": null, "ios": [], "note": null, "order_id": null, "order_id_path": null, "origin_country_iso3": "CHN", "shipment_package_count": 1, "shipment_pickup_date": "2018-07-23T08:58:00", "shipment_delivery_date": "2018-07-25T01:10:00", "shipment_type": "FedEx International Economy", "shipment_weight": 4, "shipment_weight_unit": "kg", "signed_by": "..KOSUTOKO", "smses": [], "source": "api", "tag": "Delivered", "subtag": "Delivered_001", "subtag_message": "Delivered", "title": "Title Name", "tracked_count": 1, "last_mile_tracking_supported": null, "language": null, "unique_token": "deprecated", "checkpoints": [ { "slug": "fedex", "city": null, "created_at": "2018-08-17T05:10:41+00:00", "location": null, "country_name": null, "message": "Shipment information sent to FedEx", "country_iso3": null, "tag": "InfoReceived", "subtag": "InfoReceived_001", "subtag_message": "Info Received", "checkpoint_time": "2018-07-23T01:21:39-05:00", "coordinates": [], "state": null, "zip": null, "raw_tag": "FPX_L_RPIF" } ], "subscribed_smses": [], "subscribed_emails": [], "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, "order_promised_delivery_date": "2019-05-02", "delivery_type": "pickup_at_store", "pickup_location": "Flagship Store", "pickup_note": null, "courier_tracking_link": "https://www.fedex.com/fedextrack/?tracknumbers=111111111111&cntry_code=us", "courier_redirect_link": "https://www.fedex.com/track?loc=en_US&tracknum=111111111111&requester=WT/trackdetails", "first_attempted_at": "2018-07-25T10:10:00+09:00", "on_time_status": "trending-on-time", "on_time_difference": 0, "order_tags": [], "aftership_estimated_delivery_date": { "estimated_delivery_date": "2022-01-03", "confidence_score": null, "estimated_delivery_date_min": "2022-01-01", "estimated_delivery_date_max": "2022-01-06" } } } } } } } } } }, "description": "Update a tracking.\n\n ", "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_account_number", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_origin_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_destination_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_key", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_postal_code", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_ship_date", "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_state", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "tracking": { "type": "object", "properties": { "smses": { "type": "array", "description": "The phone number(s) to receive sms notifications. Supports up to 3 phone numbers.", "items": { "type": "string" } }, "emails": { "type": "array", "description": "Email address(es) to receive email notifications. Supports up to 3 email addresses.", "items": { "type": "string" } }, "title": { "type": "string", "description": "By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number)." }, "customer_name": { "type": "string", "description": "Customer name of the tracking." }, "order_id": { "type": "string", "description": "A globally-unique identifier for the order." }, "order_id_path": { "type": "string", "description": "The URL for the order in your system or store." }, "custom_fields": { "type": "object", "additionalProperties": true, "description": "Custom fields that accept an object with string, boolean or number fields." }, "note": { "type": "string", "description": "Text field for the note" }, "language": { "type": "string", "description": "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](https://help.aftership.com/hc/en-us/articles/360001623287-Supported-Language-Parameters) to specify the language." }, "order_promised_delivery_date": { "type": "string", "description": "The promised delivery date of the order. It uses the format YYYY-MM-DD. This has no timezone and uses whatever date you provide. Since other EDDs use the shipment recipient’s timezone, we suggest following the same logic here." }, "delivery_type": { "type": "string", "description": "Shipment delivery type\n\n- `pickup_at_store`\n- `pickup_at_courier`\n- `door_to_door`", "enum": [ "pickup_at_store", "pickup_at_courier", "door_to_door" ] }, "pickup_location": { "type": "string", "description": "Shipment pickup location for receiver" }, "pickup_note": { "type": "string", "description": "Shipment pickup note for receiver" }, "slug": { "type": "string", "description": "Unique code of each courier. Provide a single courier.(https://admin.aftership.com/settings/couriers). Get a list of courier slug using [GET /couriers](./api.v4.json/paths/~1couriers/get)" }, "tracking_account_number": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_origin_country": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_destination_country": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_key": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_postal_code": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_ship_date": { "type": "string", "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_state": { "type": "string", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "order_number": { "type": "string", "description": "A unique, human-readable identifier for the order." }, "order_date": { "type": "string", "description": "Order date in YYYY-MM-DDTHH:mm:ssZ format. e.g. 2021-07-26T11:23:51-05:00" } } } } }, "examples": { "update-tracking-request": { "value": { "tracking": { "title": "New Title", "note": "some notes" } } } } } }, "description": "" }, "tags": [ "Trackings" ] }, "delete": { "summary": "Delete a tracking (Legacy)", "operationId": "delete-trackings-slug-tracking_number", "responses": { "200": { "description": "Delete tracking", "content": { "application/json": { "schema": { "type": "object", "properties": { "meta": { "$ref": "#/components/schemas/Meta.v1" }, "data": { "type": "object", "properties": { "tracking": { "type": "object", "properties": { "id": { "type": "string", "description": "Tracking id" }, "tracking_number": { "type": "string", "description": "Tracking number" }, "slug": { "type": "string", "description": "Unique code of courier. Get the slugs from [here](./api.v4.json/paths/~1couriers/get)." }, "tracking_account_number": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_origin_country": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_destination_country": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_key": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_ship_date": { "type": [ "string", "null" ], "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_postal_code": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_state": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." } } } } } } }, "examples": { "delete tracking": { "value": { "meta": { "code": 200 }, "data": { "tracking": { "id": "5b7658cec7c33c0e007de3c5", "tracking_number": "772857780801111", "slug": "fedex", "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 } } } } } } } } }, "description": "Delete a tracking.\n\n ", "parameters": [ { "schema": { "type": "string", "enum": [ "application/json" ], "default": "application/json" }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_account_number", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_origin_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_destination_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_key", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_postal_code", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_ship_date", "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_state", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." } ], "tags": [ "Trackings" ] } }, "/trackings/{slug}/{tracking_number}/retrack": { "parameters": [ { "schema": { "type": "string" }, "name": "slug", "in": "path", "required": true, "description": "Tracking slug" }, { "schema": { "type": "string" }, "name": "tracking_number", "in": "path", "required": true, "description": "Tracking number" } ], "post": { "summary": "Retrack an expired tracking (Legacy)", "operationId": "post-trackings-slug-tracking_number-retrack", "responses": { "200": { "description": "Partial tracking object", "content": { "application/json": { "schema": { "type": "object", "properties": { "meta": { "$ref": "#/components/schemas/Meta.v1" }, "data": { "type": "object", "properties": { "tracking": { "type": "object", "properties": { "id": { "type": "string", "description": "A unique identifier generated by AfterShip for the tracking." }, "tracking_number": { "type": "string", "description": "Tracking number." }, "slug": { "type": "string", "description": "Unique code of courier. Get the slugs from [here](./api.v4.json/paths/~1couriers/get)." }, "tracking_account_number": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_origin_country": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_destination_country": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_key": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_ship_date": { "type": [ "string", "null" ], "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_postal_code": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "tracking_state": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, "active": { "type": "boolean", "description": "Whether or not AfterShip will continue tracking the shipments. Value is `false` when tag (status) is `Delivered`, `Expired`, or further updates for 30 days since last update." } } } } } } } } }, "headers": {} } }, "description": "Retrack an expired tracking. Max 3 times per tracking.\n\n ", "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "description": "Content-Type", "name": "Content-Type", "required": true }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_account_number", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_origin_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_destination_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_key", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_postal_code", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_ship_date", "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_state", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." } ], "tags": [ "Trackings" ] } }, "/trackings/{slug}/{tracking_number}/mark-as-completed": { "parameters": [ { "schema": { "type": "string" }, "name": "slug", "in": "path", "required": true, "description": "Tracking slug" }, { "schema": { "type": "string" }, "name": "tracking_number", "in": "path", "required": true, "description": "Tracking number" } ], "post": { "summary": "Mark tracking as completed (Legacy)", "operationId": "post-trackings-slug-tracking_number-mark-as-completed", "responses": { "200": { "description": "Tracking object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Tracking_response.v1" } } } } }, "description": "Mark a tracking as completed. The tracking won't auto update until retrack it.\n\n ", "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_account_number", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_origin_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_destination_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_key", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_postal_code", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_ship_date", "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_state", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "reason": { "type": "string", "enum": [ "DELIVERED", "LOST", "RETURNED_TO_SENDER" ], "description": "One of `DELIVERED`, `LOST` or `RETURNED_TO_SENDER`.\n\n- Mark the tracking as completed with `DELIVERED`. The tag of the tracking will be updated to `Delivered` and the subtag will be updated to `Delivered_001`.\n- Mark the tracking as completed with `LOST`. The tag of the tracking will be updated to `Exception` and the subtag will be updated to `Exception_013`.\n- Mark the tracking as completed with `RETURNED_TO_SENDER`. The tag of the tracking will be updated to `Exception` and the subtag will be updated to `Exception_011`." } }, "required": [ "reason" ] } } }, "description": "" }, "tags": [ "Trackings" ] } }, "/couriers": { "get": { "summary": "Get user activated couriers", "responses": { "200": { "description": "Couriers object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Courier_response.v1" }, "examples": { "get-user-couriers": { "value": { "meta": { "code": 200 }, "data": { "total": 1, "couriers": [ { "slug": "postnl-3s", "name": "PostNL International 3S", "phone": "+31 (0)900 0990", "other_name": "TNT Post parcel service United Kingdom", "web_url": "http://www.postnl.nl/voorthuis/", "required_fields": [ "tracking_destination_country" ], "optional_fields": [ "tracking_account_number" ], "default_language": "en", "support_languages": [ "en" ], "service_from_country_iso3": [ "NLD" ] } ] } } } } } } } }, "operationId": "get-couriers", "description": "Return a list of [couriers activated at your AfterShip account](https://admin.aftership.com/settings/couriers).\n\n ", "parameters": [ { "schema": { "type": "string", "enum": [ "application/json" ], "example": "application/json", "default": "application/json" }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true } ], "tags": [ "Couriers" ] } }, "/couriers/detect": { "post": { "summary": "Detect courier", "operationId": "post-couriers-detect", "responses": { "200": { "description": "Couriers object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Courier_response.v1" }, "examples": { "get couriers": { "value": { "meta": { "code": 200 }, "data": { "total": 1, "couriers": [ { "slug": "postnl-3s", "name": "PostNL International 3S", "phone": "+31 (0)900 0990", "other_name": "TNT Post parcel service United Kingdom", "web_url": "http://www.postnl.nl/voorthuis/", "required_fields": [ "tracking_destination_country" ], "optional_fields": [ "tracking_account_number" ], "default_language": "en", "support_languages": [ "en" ], "service_from_country_iso3": [ "NLD" ] } ] } } }, "cannot detect courier": { "value": { "meta": { "code": 200 }, "data": { "total": 0, "couriers": [] } } } } } } } }, "description": "Return a list of matched couriers based on tracking number format and [selected couriers](https://admin.aftership.com/settings/couriers) or a list of couriers.\n\n ", "parameters": [ { "schema": { "type": "string", "example": "application/json", "enum": [ "application/json" ], "default": "application/json" }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "tracking": { "type": "object", "description": "Detect courier request", "properties": { "tracking_number": { "type": "string", "description": "Tracking number of a shipment.", "example": "RA123456879US" }, "slug": { "description": "If not specified, Aftership will automatically detect the courier based on the tracking number format and your [selected couriers](https://admin.aftership.com/settings/couriers). Use array or comma separated to input a list of couriers for auto detect. Cannot be used with slug_group at the same time.", "oneOf": [ { "type": "array", "description": "List of courier slugs", "items": { "type": "string", "pattern": "^[a-z0-9-,]+$" } }, { "type": "string", "pattern": "^[a-z-,]+$", "description": "Courier slug, can be separated by comma" } ] }, "tracking_postal_code": { "description": "The postal code of receiver's address. Required by some couriers. Refer to [this page](../../docs/enum/additional_tracking_fields.md) for more details", "type": "string" }, "tracking_ship_date": { "type": "string", "description": "Shipping date in `YYYYMMDD` format. Required by some couriers. Refer to [this page](../../docs/enum/additional_tracking_fields.md) for more details" }, "tracking_account_number": { "type": "string", "description": "Account number of the shipper for a specific courier. Required by some couriers. Refer to [this page](../../docs/enum/additional_tracking_fields.md) for more details" }, "tracking_key": { "type": "string", "description": "Key of the shipment for a specific courier. Required by some couriers. Refer to [this page](../../docs/enum/additional_tracking_fields.md) for more details" }, "tracking_origin_country": { "type": "string", "description": "Origin Country/Region of the shipment for a specific courier. Required by some couriers." }, "tracking_destination_country": { "type": "string", "description": "Destination Country/Region of the shipment for a specific courier. Required by some couriers. Refer to [this page](../../docs/enum/additional_tracking_fields.md) for more details" }, "tracking_state": { "type": "string", "description": "State of the destination shipping address of the \nshipment. Required by some couriers." }, "slug_group": { "$ref": "#/components/schemas/Slug_group.v1" }, "origin_country_iso3": { "type": "string", "description": "Enter [ISO Alpha-3](https://support.aftership.com/en/article/iso3-country-code-rlpi07/) (three letters) to specify the origin of the shipment (e.g. USA for United States)." }, "destination_country_iso3": { "type": "string", "description": "Enter [ISO Alpha-3](https://support.aftership.com/en/article/iso3-country-code-rlpi07/) (three letters) to specify the destination of the shipment (e.g. USA for United States)." } }, "required": [ "tracking_number" ] } } }, "examples": { "with tracking number only": { "value": { "tracking": { "tracking_number": "906587618687" } } }, "with tracking number and slug": { "value": { "tracking": { "tracking_number": "906587618686", "slug": "usps" } } }, "with multiple slug": { "value": { "tracking": { "tracking_number": "906587618687", "slug": "usps,ups" } } }, "with additional fields": { "value": { "tracking": { "tracking_number": "906587618687", "tracking_postal_code": "DA15BU", "tracking_ship_date": "20131231", "tracking_account_number": "1234567890", "slug": [ "dhl", "ups", "fedex" ] } } } } } }, "description": "Detect courier request" }, "tags": [ "Couriers" ] } }, "/couriers/all": { "get": { "summary": "Get all couriers", "responses": { "200": { "description": "Couriers object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Courier_response.v1" }, "examples": { "get-all-couriers": { "value": { "meta": { "code": 200 }, "data": { "total": 3, "couriers": [ { "slug": "india-post-int", "name": "India Post International", "phone": "+91 1800 11 2011", "other_name": "भारतीय डाक, Speed Post & eMO, EMS, IPS Web", "web_url": "http://www.indiapost.gov.in/", "required_fields": [], "optional_fields": [] }, { "slug": "italy-sda", "name": "Italy SDA", "phone": "+39 199 113366", "other_name": "SDA Express Courier", "web_url": "http://www.sda.it/", "required_fields": [], "optional_fields": [] }, { "slug": "bpost", "name": "Belgium Post", "phone": "+32 2 276 22 74", "other_name": "bpost, Belgian Post", "web_url": "http://www.bpost.be/", "required_fields": [], "optional_fields": [] } ] } } } } } } } }, "operationId": "get-couriers-all", "description": "Return a list of all couriers.\n\n ", "parameters": [ { "schema": { "type": "string", "enum": [ "application/json" ], "example": "application/json", "default": "application/json" }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true } ], "tags": [ "Couriers" ] } }, "/last_checkpoint/{tracking_id}": { "get": { "summary": "Get last checkpoint by tracking ID", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "meta": { "$ref": "#/components/schemas/Meta.v1" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "Tracking id" }, "tracking_number": { "type": "string", "description": "Tracking number." }, "slug": { "type": "string", "description": "Unique code of courier." }, "tag": { "$ref": "#/components/schemas/Tag.v1" }, "subtag": { "type": "string", "description": "Current subtag of tracking. ([See subtag definition](../../docs/enum/delivery_sub_statuses.md))" }, "subtag_message": { "type": "string", "description": "Normalized tracking message. ([See subtag message definition](../../docs/enum/delivery_sub_statuses.md))" }, "checkpoint": { "$ref": "#/components/schemas/Checkpoint.v4" } } } } }, "examples": { "last checkpoint": { "value": { "meta": { "code": 200 }, "data": { "id": "5b74f4958776db0e00b6f5ed", "tracking_number": "111111111111", "slug": "fedex", "tag": "Delivered", "subtag": "Delivered_001", "subtag_message": "Delivered", "checkpoint": { "slug": "fedex", "created_at": "2018-08-16T03:50:47+00:00", "checkpoint_time": "2018-08-01T13:19:47-04:00", "city": "Deal", "coordinates": [], "country_iso3": null, "country_name": null, "message": "Delivered - Left at front door. Signature Service not requested.", "state": "NJ", "tag": "Delivered", "subtag": "Delivered_001", "subtag_message": "Delivered", "zip": null, "raw_tag": "FPX_L_RPIF" } } } } } } } } }, "operationId": "get-last_checkpoint-id", "description": "Return the tracking information of the last checkpoint of a single tracking.\n\n ", "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true }, { "schema": { "type": "string", "example": "city,tag" }, "in": "query", "name": "fields", "description": "List of fields to include in the response. Use comma for multiple values. Fields to include: `slug`, `created_at`, `checkpoint_time`, `city`, `coordinates`, `country_iso3`, `country_name`, `message`, `state`, `tag`, `zip`" }, { "schema": { "type": "string", "example": "en" }, "in": "query", "name": "lang", "description": "Support Chinese to English translation for `china-ems` and `china-post` only" } ], "tags": [ "Last Checkpoints" ] }, "parameters": [ { "schema": { "type": "string" }, "name": "tracking_id", "in": "path", "required": true, "description": "tracking id" } ] }, "/last_checkpoint/{slug}/{tracking_number}": { "get": { "summary": "Get last checkpoint (Legacy)", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "meta": { "$ref": "#/components/schemas/Meta.v1" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "Tracking id" }, "tracking_number": { "type": "string", "description": "Tracking number." }, "slug": { "type": "string", "description": "Unique code of courier." }, "tag": { "$ref": "#/components/schemas/Tag.v1" }, "subtag": { "type": "string", "description": "Current subtag of tracking. ([See subtag definition](../../docs/enum/delivery_sub_statuses.md))" }, "subtag_message": { "type": "string", "description": "Normalized tracking message. ([See subtag message definition](../../docs/enum/delivery_sub_statuses.md))" }, "checkpoint": { "$ref": "#/components/schemas/Checkpoint.v4" } } } } }, "examples": { "last checkpoint": { "value": { "meta": { "code": 200 }, "data": { "id": "5b74f4958776db0e00b6f5ed", "tracking_number": "111111111111", "slug": "fedex", "tag": "Delivered", "subtag": "Delivered_001", "subtag_message": "Delivered", "checkpoint": { "slug": "fedex", "created_at": "2018-08-16T03:50:47+00:00", "checkpoint_time": "2018-08-01T13:19:47-04:00", "city": "Deal", "coordinates": [], "country_iso3": null, "country_name": null, "message": "Delivered - Left at front door. Signature Service not requested.", "state": "NJ", "tag": "Delivered", "subtag": "Delivered_001", "subtag_message": "Delivered", "zip": null, "raw_tag": "FPX_L_RPIF" } } } } } } } } }, "operationId": "get-last_checkpoint", "description": "Return the tracking information of the last checkpoint of a single tracking.\n\n ", "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true }, { "schema": { "type": "string", "example": "city,tag" }, "in": "query", "name": "fields", "description": "List of fields to include in the response. Use comma for multiple values. Fields to include: `slug`, `created_at`, `checkpoint_time`, `city`, `coordinates`, `country_iso3`, `country_name`, `message`, `state`, `tag`, `zip`" }, { "schema": { "type": "string", "example": "en" }, "in": "query", "name": "lang", "description": "Support Chinese to English translation for `china-ems` and `china-post` only" }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_account_number", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_origin_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_destination_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_key", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_postal_code", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_ship_date", "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_state", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." } ], "tags": [ "Last Checkpoints" ] }, "parameters": [ { "schema": { "type": "string" }, "name": "slug", "in": "path", "required": true, "description": "Tracking slug" }, { "schema": { "type": "string" }, "name": "tracking_number", "in": "path", "required": true, "description": "Tracking number" } ] }, "/notifications/{tracking_id}": { "get": { "summary": "Get tracking notification by tracking ID", "responses": { "200": { "description": "Tracking notification", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Notification_response.v1" }, "examples": { "tracking notification": { "value": { "meta": { "code": 200 }, "data": { "notification": { "emails": [], "smses": [ "+85261236888" ] } } } } } } } } }, "operationId": "get-notifications-id", "description": "Get contact information for the users to notify when the tracking changes. Please note that only customer receivers will be returned. Any `email`, `sms` or `webhook` that belongs to the Store will not be returned.\n\n ", "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true } ], "tags": [ "Notifications" ] }, "parameters": [ { "schema": { "type": "string" }, "name": "tracking_id", "in": "path", "required": true, "description": "tracking id" } ] }, "/notifications/{tracking_id}/add": { "parameters": [ { "schema": { "type": "string" }, "name": "tracking_id", "in": "path", "required": true, "description": "tracking id" } ], "post": { "summary": "Add a notification by tracking ID", "operationId": "post-notifications-slug-tracking_number-add-id", "responses": { "200": { "description": "Tracking notification", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Notification_response.v1" }, "examples": { "tracking-notification-add": { "value": { "meta": { "code": 200 }, "data": { "notification": { "emails": [], "smses": [ "+85261236888" ] } } } } } } } } }, "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true } ], "description": "Add notification receivers to a tracking number.\n\n ", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "notification": { "$ref": "#/components/schemas/Notification_request.v1" } } } } } }, "tags": [ "Notifications" ] } }, "/notifications/{tracking_id}/remove": { "parameters": [ { "schema": { "type": "string" }, "name": "tracking_id", "in": "path", "required": true, "description": "tracking id" } ], "post": { "summary": "Remove a notification by tracking ID", "responses": { "200": { "description": "Tracking notification", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Notification_response.v1" }, "examples": { "tracking-notification-remove": { "value": { "meta": { "code": 200 }, "data": { "notification": { "emails": [], "smses": [ "+85261236888" ] } } } } } } } } }, "description": "Remove notification receivers from a tracking number.\n\n ", "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true } ], "operationId": "post-notifications-slug-tracking_number-remove-id", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "notification": { "$ref": "#/components/schemas/Notification_request.v1" } } } } } }, "tags": [ "Notifications" ] } }, "/notifications/{slug}/{tracking_number}": { "get": { "summary": "Get tracking notification (Legacy)", "responses": { "200": { "description": "Tracking notification", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Notification_response.v1" }, "examples": { "tracking notification": { "value": { "meta": { "code": 200 }, "data": { "notification": { "emails": [], "smses": [ "+85261236888" ] } } } } } } } } }, "operationId": "get-notifications", "description": "Get contact information for the users to notify when the tracking changes. Please note that only customer receivers will be returned. Any `email`, `sms` or `webhook` that belongs to the Store will not be returned.\n\n ", "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_account_number", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_origin_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_destination_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_key", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_postal_code", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_ship_date", "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_state", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." } ], "tags": [ "Notifications" ] }, "parameters": [ { "schema": { "type": "string" }, "name": "slug", "in": "path", "required": true, "description": "Tracking slug" }, { "schema": { "type": "string" }, "name": "tracking_number", "in": "path", "required": true, "description": "Tracking number" } ] }, "/notifications/{slug}/{tracking_number}/add": { "parameters": [ { "schema": { "type": "string" }, "name": "slug", "in": "path", "required": true, "description": "Tracking slug" }, { "schema": { "type": "string" }, "name": "tracking_number", "in": "path", "required": true, "description": "Tracking number" } ], "post": { "summary": "Add a notification (Legacy)", "operationId": "post-notifications-slug-tracking_number-add", "responses": { "200": { "description": "Tracking notification", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Notification_response.v1" }, "examples": { "tracking-notification-add": { "value": { "meta": { "code": 200 }, "data": { "notification": { "emails": [], "smses": [ "+85261236888" ] } } } } } } } } }, "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_account_number", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_origin_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_destination_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_key", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_postal_code", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_ship_date", "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_state", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." } ], "description": "Add notification receivers to a tracking number.\n\n ", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "notification": { "$ref": "#/components/schemas/Notification_request.v1" } } } } } }, "tags": [ "Notifications" ] } }, "/notifications/{slug}/{tracking_number}/remove": { "parameters": [ { "schema": { "type": "string" }, "name": "slug", "in": "path", "required": true, "description": "Tracking slug" }, { "schema": { "type": "string" }, "name": "tracking_number", "in": "path", "required": true, "description": "Tracking number" } ], "post": { "summary": "Remove a notification (Legacy)", "responses": { "200": { "description": "Tracking notification", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Notification_response.v1" }, "examples": { "tracking-notification-remove": { "value": { "meta": { "code": 200 }, "data": { "notification": { "emails": [], "smses": [ "+85261236888" ] } } } } } } } } }, "description": "Remove notification receivers from a tracking number.\n\n ", "parameters": [ { "schema": { "type": "string", "default": "application/json", "enum": [ "application/json" ] }, "in": "header", "name": "Content-Type", "description": "Content-Type", "required": true }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_account_number", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_origin_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_destination_country", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_key", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_postal_code", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_ship_date", "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details." }, { "schema": { "type": "string" }, "in": "query", "name": "tracking_state", "description": "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](../../docs/enum/additional_tracking_fields.md) for more details." } ], "operationId": "post-notifications-slug-tracking_number-remove", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "notification": { "$ref": "#/components/schemas/Notification_request.v1" } } } } } }, "tags": [ "Notifications" ] } }, "/estimated-delivery-date/predict-batch": { "post": { "summary": "Batch predict the estimated delivery date", "operationId": "post-estimated-delivery-date-predict", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "meta": { "$ref": "#/components/schemas/Meta.v1" }, "data": { "type": "object", "required": [ "estimated_delivery_dates" ], "properties": { "estimated_delivery_dates": { "type": "array", "items": { "$ref": "#/components/schemas/Estimated_delivery_date_Response.v4" } } } } }, "required": [ "meta", "data" ] }, "examples": { "200": { "value": { "meta": { "code": 200 }, "data": { "estimated_delivery_dates": [ { "slug": "fedex", "service_type_name": "FEDEX HOME DELIVERY", "origin_address": { "country": "USA", "state": "WA", "postal_code": "98108", "raw_location": "Seattle, Washington, 98108, USA, United States", "city": null }, "destination_address": { "country": "USA", "state": "CA", "postal_code": "92019", "raw_location": "El Cajon, California, 92019, USA, United States", "city": null }, "weight": { "unit": "kg", "value": 1 }, "package_count": 1, "pickup_time": "2021-07-01 15:00:00", "estimated_pickup": null, "estimated_delivery_date": "2021-07-04", "estimated_delivery_date_min": "2021-07-03", "estimated_delivery_date_max": "2021-07-04" }, { "slug": "fedex", "service_type_name": "FEDEX HOME DELIVERY", "origin_address": { "country": "USA", "state": "WA", "postal_code": "98108", "raw_location": "Seattle, Washington, 98108, USA, United States", "city": null }, "destination_address": { "country": "USA", "state": "CA", "postal_code": "92019", "raw_location": "El Cajon, California, 92019, USA, United States", "city": null }, "weight": null, "package_count": null, "pickup_time": null, "estimated_pickup": { "order_time": "2021-07-01 15:04:05", "order_cutoff_time": "20:00:00", "business_days": [ 1, 2, 3, 4, 5, 6, 7 ], "order_processing_time": { "unit": "day", "value": 0 }, "pickup_time": "2021-07-01 20:00:00" }, "estimated_delivery_date": "2021-07-03", "estimated_delivery_date_min": "2021-07-02", "estimated_delivery_date_max": "2021-07-04" } ] } } } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "meta": { "$ref": "#/components/schemas/Meta.v1" }, "data": { "type": "object" } }, "required": [ "meta", "data" ] }, "examples": { "400": { "value": { "meta": { "code": 400, "message": "some message", "type": "BadRequest" }, "data": {} } } } } } } }, "description": "> The estimated delivery date is provided by AfterShip, based on its AI-predictive model. You can display the EDD on the product page, cart, and order checkout page. It indicates when a customer will receive the order.\n\nYou can use [AfterShip’s AI-powered predictive estimated delivery date API](https://www.aftership.com/features/delivery-date-prediction) to provide expected delivery dates to shoppers for online orders without tracking numbers. You can get the earliest date, the latest date, and the most-likely-arrival date through our AI-predictive EDD API. \n\nDisplay accurate estimated delivery dates on the product page, store cart, and order checkout page to encourage customers to check out faster and give them a better customer experience.\n\n[Contact sales](https://www.aftership.com/contact-sales) to activate this feature.\n\nSupported functionalities require:\n\n1. One `EstimatedDeliveryDate` object for one prediction result.\n2. Maximum 5 `EstimatedDeliveryDate` objects are allowed.\n3. API call will fail if any of the requests `EstimatedDeliveryDate` objects do not meet the specification requirement.\n\n ", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "estimated_delivery_dates": { "type": "array", "maxItems": 5, "minItems": 1, "items": { "$ref": "#/components/schemas/Estimated_delivery_date_Request.v4" } } }, "required": [ "estimated_delivery_dates" ] }, "examples": { "predict": { "value": { "estimated_delivery_dates": [ { "slug": "fedex", "service_type_name": "FEDEX HOME DELIVERY", "origin_address": { "country": "USA", "state": "WA", "city": "Seattle", "postal_code": "98108", "raw_location": "Seattle, Washington, 98108, USA, United States" }, "destination_address": { "country": "USA", "state": "CA", "postal_code": "92019", "raw_location": "El Cajon, California, 92019, USA, United States" }, "weight": { "unit": "kg", "value": 1 }, "package_count": 1, "pickup_time": "2021-07-01 15:00:00" }, { "slug": "fedex", "service_type_name": "FEDEX HOME DELIVERY", "origin_address": { "country": "USA", "state": "WA", "postal_code": "98108", "raw_location": "Seattle, Washington, 98108, USA, United States" }, "destination_address": { "country": "USA", "state": "California", "postal_code": "92019", "raw_location": "El Cajon, California, 92019, USA, United States" }, "weight": null, "package_count": null, "estimated_pickup": { "order_time": "2021-07-01 15:04:05", "order_cutoff_time": "20:00:00", "business_days": [ 1, 2, 3, 4, 5, 6, 7 ], "order_processing_time": { "unit": "day", "value": 0 } } } ] } } } } }, "description": "" }, "tags": [ "Estimated delivery date" ] }, "parameters": [] } }, "tags": [ { "name": "Trackings" }, { "name": "Couriers" }, { "name": "Last Checkpoints" }, { "name": "Notifications" }, { "name": "Estimated delivery date" } ], "components": { "securitySchemes": { "as-api-key": { "name": "as-api-key", "type": "apiKey", "in": "header", "description": "> For legacy API keys (those created before Jul 7, 2022), you must use the `aftership-api-key` header key. Legacy API keys also do not support AES or RSA authentication signatures. For more information, check [authentication](../../docs/quickstart/authentication.md)." }, "aftership-api-key": { "name": "aftership-api-key", "type": "apiKey", "in": "header", "description": "" } }, "schemas": { "Additional_fields.v1": { "type": "string", "title": "additional_fields", "description": "All available additional fields ", "enum": [ "tracking_account_number", "tracking_postal_code", "tracking_ship_date", "tracking_key", "tracking_origin_country", "tracking_destination_country", "tracking_state" ], "example": "tracking_account_number", "pattern": "^[a-z_0-9]+$" }, "Slug_group.v1": { "type": "string", "title": "slug_group", "description": "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](../../docs/enum/slug_groups.md)) ", "enum": [ "amazon-group", "fedex-group", "toll-group", "taqbin-group", "tnt-group", "cj-group", "hermes-group", "dpd-group", "gls-group", "dhl-group", "fastway-group", "asendia-group" ] }, "Tag.v1": { "type": "string", "title": "tag", "enum": [ "Pending", "InfoReceived", "InTransit", "OutForDelivery", "AttemptFail", "Delivered", "AvailableForPickup", "Exception", "Expired" ], "description": "Current status of tracking. ([See tag definition](../../docs/enum/delivery_statuses.md)) ", "example": "Delivered" }, "Notification_request.v1": { "title": "notification", "type": "object", "properties": { "emails": { "description": "Email address(es) to receive email notifications.\nAccept either array or comma separated as input.", "oneOf": [ { "type": "string", "properties": {}, "description": "Email addresses, comma separated. Supports up to 3 email addresses." }, { "type": "array", "description": "Email address array", "items": { "type": "string" } } ] }, "smses": { "description": "The phone number(s) to receive sms notifications. Enter `+` and `area code` before phone number.\nAccept either array or comma separated as input.", "oneOf": [ { "type": "string", "properties": {}, "description": "Phone number, comma separated. Supports up to 3 phone numbers." }, { "type": "array", "description": "Phone number array", "items": { "type": "string" } } ] } }, "description": "Notification request object" }, "Checkpoint.v4": { "title": "Checkpoint", "type": "object", "description": "Object describes checkpoint information.\n\n ", "x-tags": [ "Resource" ], "properties": { "created_at": { "type": "string", "minLength": 1, "description": "The date and time of the checkpoint event was added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0.", "example": "2023-01-18T08:47:10+00:00" }, "slug": { "type": "string", "minLength": 1, "description": "The unique code of courier for this checkpoint. Get courier slug [here](../../reference/api.v4.json/paths/~1couriers/get)", "example": "fedex" }, "checkpoint_time": { "type": "string", "minLength": 1, "description": "The date and time of the checkpoint event, provided by the carrier. It uses the timezone of the checkpoint. The format may differ depending on how the carrier provides it:\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ", "example": "2022-01-01T18:47:10-05:00" }, "location": { "type": [ "string", "null" ], "minLength": 1, "description": "Location info provided by carrier", "example": "13th Street, New York, NY 10011, USA, United States" }, "city": { "type": [ "string", "null" ], "minLength": 1, "description": "City info provided by carrier", "example": "New York" }, "state": { "type": [ "string", "null" ], "minLength": 1, "description": "State info provided by carrier", "example": "NY" }, "zip": { "type": [ "string", "null" ], "minLength": 1, "description": "Postal code info provided by carrier", "example": "10011" }, "coordinates": { "type": "array", "description": "Deprecated as of March 2013", "items": { "type": "number" }, "example": null }, "country_iso3": { "type": [ "string", "null" ], "description": "Country/Region ISO Alpha-3 (three letters) of the checkpoint", "example": "USA" }, "country_name": { "type": [ "string", "null" ], "description": "Country/Region name of the checkpoint, may also contain other location info.", "example": "United States" }, "message": { "type": "string", "minLength": 1, "description": "Checkpoint message", "example": "Package delivered" }, "tag": { "$ref": "#/components/schemas/Tag.v1" }, "subtag": { "type": "string", "minLength": 1, "description": "Current subtag of checkpoint. ([See subtag definition](../../docs/enum/delivery_sub_statuses.md))", "example": "Delivered_002" }, "subtag_message": { "type": "string", "minLength": 1, "description": "Normalized checkpoint message. ([See subtag message definition](../../docs/enum/delivery_sub_statuses.md))", "example": "Picked up by customer" }, "raw_tag": { "type": [ "string", "null" ], "minLength": 1, "description": "Checkpoint raw status provided by courier", "example": "RO" } } }, "Courier.v4": { "title": "Courier", "type": "object", "description": "Courier object\n\n ", "x-tags": [ "Resource" ], "properties": { "slug": { "type": "string", "description": "Unique code of courier. Get the slugs from [here](../../reference/api.v4.json/paths/~1couriers/get).", "example": "postnl-3s", "pattern": "^[a-z0-9-]+$" }, "name": { "type": "string", "description": "Name of courier", "example": "PostNL International 3S" }, "phone": { "type": "string", "description": "Contact phone number of courier", "example": "+31 (0)900 0990" }, "other_name": { "type": "string", "description": "Other name of courier", "example": "TNT Post parcel service United Kingdom" }, "web_url": { "type": "string", "description": "Website link of courier", "format": "uri", "example": "http://www.postnl.nl/voorthuis/", "nullable": true }, "required_fields": { "type": "array", "description": "The extra fields need for tracking, such as `tracking_account_number`, `tracking_postal_code`, `tracking_ship_date`, `tracking_key`, `tracking_destination_country`", "minItems": 0, "nullable": true, "items": { "$ref": "#/components/schemas/Additional_fields.v1" } }, "optional_fields": { "type": "array", "description": "The extra fields which are optional for tracking. Basically it's the same as required_fields, but the difference is that only some of the tracking numbers require these fields.", "minItems": 0, "nullable": true, "items": { "$ref": "#/components/schemas/Additional_fields.v1" } }, "default_language": { "type": "string", "description": "Default language of tracking results", "minLength": 2, "maxLength": 2, "pattern": "^[a-z]{2}$", "example": "en", "nullable": true }, "support_languages": { "type": "array", "description": "Other supported languages", "uniqueItems": false, "minItems": 1, "nullable": true, "items": { "type": "string", "minLength": 2, "maxLength": 2, "pattern": "^[a-z]{2}$", "example": "en" } }, "service_from_country_iso3": { "type": "array", "description": "Country/Region code (ISO Alpha-3) where the courier provides service", "minItems": 1, "nullable": true, "items": { "type": "string", "minLength": 3, "maxLength": 3, "pattern": "^[A-Z]{3}$", "example": "NLD" } } } }, "Estimated_delivery_date_Request.v4": { "description": "", "x-stoplight": { "id": "buezc13rd1k96" }, "type": "object", "x-examples": { "example-1": { "slug": "fedex", "service_type_name": "FEDEX HOME DELIVERY", "origin_address": { "country": "USA", "state": "WA", "postal_code": "98108", "raw_location": "Seattle, Washington, 98108, USA, United States" }, "destination_address": { "country": "USA", "state": "CA", "postal_code": "92019", "raw_location": "El Cajon, California, 92019, USA, United States" }, "weight": null, "package_count": null, "estimated_pickup": { "order_time": "2021-07-01 15:04:05", "order_cutoff_time": "20:00:00", "business_days": [ 1, 2, 3, 4, 5, 6, 7 ], "order_processing_time": { "unit": "day", "value": 0 } }, "estimated_delivery_date": "2021-07-07", "estimated_delivery_date_min": "2021-07-03", "estimated_delivery_date_max": "2021-07-10" } }, "title": "EstimatedDeliveryDate", "properties": { "slug": { "type": "string", "description": "AfterShip's unique code of courier. Please refer to https://track.aftership.com/couriers/download.", "minLength": 1, "example": "fedex" }, "service_type_name": { "type": [ "string", "null" ], "description": "Shipping and delivery options provided by the carrier.", "minLength": 1, "example": "FEDEX HOME DELIVERY" }, "origin_address": { "type": "object", "description": "The location from where the package is picked up by the carrier to be delivered to the final destination.", "required": [ "country" ], "properties": { "country": { "type": "string", "description": "The country/region of the origin location from where the package is picked up by the carrier to be delivered to the final destination. Use 3 letters of ISO 3166-1 country/region code.", "minLength": 1, "example": "USA" }, "state": { "type": [ "string", "null" ], "description": "State, province, or the equivalent location of the origin address.\nEither `origin_address.state` or `origin_address.postal_code` is required.", "minLength": 1, "example": "WA", "maxLength": 256 }, "city": { "type": [ "string", "null" ], "description": "City of the origin address.", "minLength": 1, "example": "Seattle", "maxLength": 256 }, "postal_code": { "type": [ "string", "null" ], "description": "Postal code of the origin address.\nEither `origin_address.state` or `origin_address.postal_code` is required.", "minLength": 1, "example": "98108", "maxLength": 256 }, "raw_location": { "type": [ "string", "null" ], "description": "Raw location of the origin address. A raw address will help AI to identify the accurate location of the origin address.", "minLength": 1, "example": "Seattle, Washington, 98108, USA, United States", "maxLength": 512 } } }, "destination_address": { "type": "object", "description": "The final destination of the customer where the delivery will be made.", "required": [ "country" ], "properties": { "country": { "type": "string", "description": "The country/region of the destination location where the package will be delivered. Use 3 letters of ISO 3166-1 country code.", "minLength": 1 }, "state": { "type": [ "string", "null" ], "description": "State, province, or the equivalent location of the destination address where the package will be delivered.\nEither `destination_address.state` or `destination_address.postal_code` is required.", "minLength": 1, "maxLength": 256 }, "city": { "type": [ "string", "null" ], "description": "City of the destination address where the package will be delivered.", "minLength": 1, "maxLength": 256 }, "postal_code": { "type": [ "string", "null" ], "description": "Postal code of the destination address.\nEither `destination_address.state` or `destination_address.postal_code` is required.", "minLength": 1, "maxLength": 256 }, "raw_location": { "type": [ "string", "null" ], "description": "Raw location of the destination address. A raw address will help AI to identify the accurate location of the destination address.", "minLength": 1, "maxLength": 512 } } }, "weight": { "type": [ "object", "null" ], "description": "AfterShip uses this object to calculate the total weight of the order.", "properties": { "unit": { "type": "string", "description": "The weight unit of the package. ", "example": "kg" }, "value": { "type": "number", "description": "The weight of the shipment.", "example": 1 } }, "required": [ "unit", "value" ] }, "package_count": { "type": [ "integer", "null" ], "description": "The number of packages.", "example": 1 }, "pickup_time": { "type": [ "string", "null" ], "example": "2021-07-01 06:42:30", "description": "The local pickup time of the package. \n\nEither `pickup_time` or `estimated_pickup` is required." }, "estimated_pickup": { "type": [ "object", "null" ], "description": "The local pickup time of the package.\nEither `pickup_time` or `estimated_pickup` is required.", "properties": { "order_time": { "type": "string", "description": "The local order time of the package.", "minLength": 1, "example": "2021-07-01 15:04:05" }, "order_cutoff_time": { "type": [ "string", "null" ], "description": "Order cut off time.\nAfterShip will set 18:00:00 as the default value.", "minLength": 1, "example": "20:00:00" }, "business_days": { "type": [ "array", "null" ], "description": "Operating days in a week. Number refers to the weekday.\nE.g., [1,2,3,4,5] means operating days are from Monday to Friday.\nAfterShip will set [1,2,3,4,5] as the default value.", "items": { "type": "integer", "description": "Operating days in a week. Number refers to the weekday.\nE.g., [1,2,3,4,5] means operating days are from Monday to Friday.\nAfterShip will set [1,2,3,4,5] as the default value.", "example": 0 } }, "order_processing_time": { "type": [ "object", "null" ], "description": "", "properties": { "unit": { "type": "string", "minLength": 1, "example": "day", "description": "Processing time of an order, from being placed to being picked up. Only support day as value now.\nAfterShip will set day as the default value." }, "value": { "type": "number", "example": 0, "description": "Processing time of an order, from being placed to being picked up.\nAfterShip will set 0 as the default value." } } } }, "required": [ "order_time" ] } }, "required": [ "slug", "origin_address", "destination_address" ] }, "Estimated_delivery_date_Response.v4": { "description": "", "x-stoplight": { "id": "40b6fc86060b5" }, "type": "object", "x-examples": { "example-1": { "slug": "fedex", "service_type_name": "FEDEX HOME DELIVERY", "origin_address": { "country": "USA", "state": "WA", "postal_code": "98108", "raw_location": "Seattle, Washington, 98108, USA, United States" }, "destination_address": { "country": "USA", "state": "CA", "postal_code": "92019", "raw_location": "El Cajon, California, 92019, USA, United States" }, "weight": null, "package_count": null, "estimated_pickup": { "order_time": "2021-07-01 15:04:05", "order_cutoff_time": "20:00:00", "business_days": [ 1, 2, 3, 4, 5, 6, 7 ], "order_processing_time": { "unit": "day", "value": 0 } }, "estimated_delivery_date": "2021-07-07", "estimated_delivery_date_min": "2021-07-03", "estimated_delivery_date_max": "2021-07-10" } }, "title": "EstimatedDeliveryDate", "properties": { "slug": { "type": "string", "description": "AfterShip's unique code of courier. Please refer to https://track.aftership.com/couriers/download.", "minLength": 1, "example": "fedex" }, "service_type_name": { "type": [ "string", "null" ], "description": "Shipping and delivery options provided by the carrier.", "minLength": 1, "example": "FEDEX HOME DELIVERY" }, "origin_address": { "type": "object", "description": "The location from where the package is picked up by the carrier to be delivered to the final destination.", "required": [ "country" ], "properties": { "country": { "type": "string", "description": "The country/region of the origin location from where the package is picked up by the carrier to be delivered to the final destination. Use 3 letters of ISO 3166-1 country/region code.", "minLength": 1, "example": "USA" }, "state": { "type": [ "string", "null" ], "description": "State, province, or the equivalent location of the origin address.\nEither `origin_address.state` or `origin_address.postal_code` is required.", "minLength": 1, "example": "WA", "maxLength": 256 }, "city": { "type": [ "string", "null" ], "description": "City of the origin address.", "minLength": 1, "example": "Seattle", "maxLength": 256 }, "postal_code": { "type": [ "string", "null" ], "description": "Postal code of the origin address.\nEither `origin_address.state` or `origin_address.postal_code` is required.", "minLength": 1, "example": "98108", "maxLength": 256 }, "raw_location": { "type": [ "string", "null" ], "description": "Raw location of the origin address. A raw address will help AI to identify the accurate location of the origin address.", "minLength": 1, "example": "Seattle, Washington, 98108, USA, United States", "maxLength": 512 } } }, "destination_address": { "type": "object", "description": "The final destination of the customer where the delivery will be made.", "required": [ "country" ], "properties": { "country": { "type": "string", "description": "The country/region of the destination location where the package will be delivered. Use 3 letters of ISO 3166-1 country code.", "minLength": 1 }, "state": { "type": [ "string", "null" ], "description": "State, province, or the equivalent location of the destination address where the package will be delivered.\nEither `destination_address.state` or `destination_address.postal_code` is required.", "minLength": 1, "maxLength": 256 }, "city": { "type": [ "string", "null" ], "description": "City of the destination address where the package will be delivered.", "minLength": 1, "maxLength": 256 }, "postal_code": { "type": [ "string", "null" ], "description": "Postal code of the destination address.\nEither `destination_address.state` or `destination_address.postal_code` is required.", "minLength": 1, "maxLength": 256 }, "raw_location": { "type": [ "string", "null" ], "description": "Raw location of the destination address. A raw address will help AI to identify the accurate location of the destination address.", "minLength": 1, "maxLength": 512 } } }, "weight": { "type": [ "object", "null" ], "description": "AfterShip uses this object to calculate the total weight of the order.", "properties": { "unit": { "type": "string", "description": "The weight unit of the package. ", "example": "kg" }, "value": { "type": "number", "description": "The weight of the shipment.", "example": 1 } }, "required": [ "unit", "value" ] }, "package_count": { "type": [ "integer", "null" ], "description": "The number of packages.", "example": 1 }, "pickup_time": { "type": [ "string", "null" ], "example": "2021-07-01 06:42:30", "description": "The local pickup time of the package. \n\nEither `pickup_time` or `estimated_pickup` is required." }, "estimated_pickup": { "type": [ "object", "null" ], "description": "The local pickup time of the package.\nEither `pickup_time` or `estimated_pickup` is required.", "properties": { "order_time": { "type": "string", "description": "The local order time of the package.", "minLength": 1, "example": "2021-07-01 15:04:05" }, "order_cutoff_time": { "type": [ "string", "null" ], "description": "Order cut off time.\nAfterShip will set 18:00:00 as the default value.", "minLength": 1, "example": "20:00:00" }, "business_days": { "type": [ "array", "null" ], "description": "Operating days in a week. Number refers to the weekday.\nE.g., [1,2,3,4,5] means operating days are from Monday to Friday.\nAfterShip will set [1,2,3,4,5] as the default value.", "items": { "type": "integer", "description": "Operating days in a week. Number refers to the weekday.\nE.g., [1,2,3,4,5] means operating days are from Monday to Friday.\nAfterShip will set [1,2,3,4,5] as the default value.", "example": 0 } }, "order_processing_time": { "type": [ "object", "null" ], "description": "", "properties": { "unit": { "type": "string", "minLength": 1, "example": "day", "description": "Processing time of an order, from being placed to being picked up. Only support day as value now.\nAfterShip will set day as the default value." }, "value": { "type": "number", "example": 0, "description": "Processing time of an order, from being placed to being picked up.\nAfterShip will set 0 as the default value." } } }, "pickup_time": { "type": [ "string", "null" ], "example": "2021-07-01 20:00:00", "description": "The local pickup time of the package. " } }, "required": [ "order_time" ] }, "estimated_delivery_date": { "type": "string", "description": "The estimated arrival date of the shipment, provided by AfterShip.", "minLength": 1, "example": "2021-07-03" }, "estimated_delivery_date_min": { "type": "string", "description": "The earliest estimated delivery date of the shipment, provided by AfterShip.", "minLength": 1, "example": "2021-07-02" }, "estimated_delivery_date_max": { "type": "string", "description": "The latest estimated delivery date of the shipment, provided by AfterShip.", "minLength": 1, "example": "2021-07-04" } }, "required": [ "slug", "origin_address", "destination_address" ] }, "Notification.v4": { "title": "Notification", "type": "object", "description": "Object describes the notification information.\n\n ", "properties": { "emails": { "type": "array", "description": "Email address(es) to receive email notifications.", "items": { "type": "string" } }, "smses": { "type": "array", "description": "The phone number(s) to receive sms notifications. ", "items": { "type": "string" } } }, "x-tags": [ "Resource" ] }, "Tracking.v4": { "description": "Object describes the tracking information. ", "type": "object", "title": "Tracking", "x-tags": [ "Resource" ], "examples": [], "properties": { "id": { "type": "string", "minLength": 1, "description": "Tracking ID.", "example": "my2uktymyz72xld1f7l3h01z" }, "created_at": { "type": "string", "minLength": 1, "description": "The date and time the shipment was imported or added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0.", "example": "2023-01-18T08:47:10+00:00" }, "updated_at": { "type": "string", "minLength": 1, "description": "The date and time the shipment was updated. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0.", "example": "2023-01-18T17:47:10+00:00" }, "last_updated_at": { "type": "string", "description": "(Legacy) The date and time the shipment was updated. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0.", "example": "2023-01-18T17:47:10+00:00" }, "tracking_number": { "type": "string", "minLength": 1, "description": "Tracking number.", "example": "61293150000079650811" }, "slug": { "type": "string", "minLength": 1, "description": "Unique courier code. When importing a shipment with no courier slug and the tracking number can’t be recognized, the courier will be marked as `unrecognized`. Get courier codes [here](https://www.aftership.com/docs/tracking/others/supported-couriers).", "example": "fedex" }, "active": { "type": "boolean", "description": "Whether or not AfterShip will continue tracking the shipments. Value is `false` when tag (status) is `Delivered`, `Expired`, or further updates for 30 days since last update.", "example": false }, "custom_fields": { "type": "object", "nullable": true, "additionalProperties": { "type": "string" }, "description": "Custom fields of the tracking.", "example": { "store_name": "my-store" } }, "customer_name": { "type": [ "string", "null" ], "description": "Customer name of the tracking.", "example": "Steve Young" }, "delivery_time": { "type": [ "integer", "null" ], "description": "Total delivery time in days.\n\n- Difference of 1st checkpoint time and delivered time for delivered shipments\n- Difference of 1st checkpoint time and current time for non-delivered shipments\n\nValue as `0` for pending shipments or delivered shipment with only one checkpoint.", "example": 9 }, "origin_country_iso3": { "type": [ "string", "null" ], "minLength": 1, "description": "The [ISO Alpha-3](https://support.aftership.com/en/article/iso3-country-code-rlpi07/) code (3 letters) for the origin country/region. E.g. USA for the United States.", "example": "CHN" }, "origin_state": { "type": [ "string", "null" ], "description": "The state of the sender’s address.", "example": "Beijing" }, "origin_city": { "type": [ "string", "null" ], "description": "The city of the sender’s address.", "example": "Beijing" }, "origin_postal_code": { "type": [ "string", "null" ], "description": "The postal code of the sender’s address.", "example": "065001" }, "origin_raw_location": { "type": [ "string", "null" ], "description": "The sender address that the shipment is shipping from.", "example": "Lihong Gardon 4A 2301, Chaoyang District, Beijing, BJ, 065001, CHN, China" }, "destination_country_iso3": { "type": [ "string", "null" ], "description": "The [ISO Alpha-3](https://support.aftership.com/en/article/iso3-country-code-rlpi07/) code (3 letters) for the destination country/region. E.g. USA for the United States.", "example": "USA" }, "destination_state": { "type": [ "string", "null" ], "description": "The state of the recipient’s address.", "example": "New York" }, "destination_city": { "type": [ "string", "null" ], "description": "The city of the recipient’s address.", "example": "New York City" }, "destination_postal_code": { "type": [ "string", "null" ], "description": "The postal code of the recipient’s address.", "example": "10001" }, "destination_raw_location": { "type": [ "string", "null" ], "description": "The shipping address that the shipment is shipping to.", "example": "13th Street, New York, NY, 10011, USA, United States" }, "courier_destination_country_iso3": { "type": [ "string", "null" ], "description": "Destination country/region 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.", "example": "USA" }, "emails": { "type": "array", "description": "Email address(es) to receive email notifications.", "items": { "type": "string" }, "example": [ "example@aftership.com" ] }, "expected_delivery": { "type": [ "string", "null" ], "minLength": 1, "description": "The estimated delivery date provided by the carrier. It uses the shipment recipient’s timezone and the format may differ depending on how the carrier provides it:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ", "example": "2022-01-05T12:11:11+01:00" }, "note": { "type": [ "string", "null" ], "description": "Text field for the note.", "example": "note" }, "order_id": { "type": [ "string", "null" ], "description": "A globally-unique identifier for the order.", "example": "6845a095a27a4caeb27487806f058add" }, "order_id_path": { "type": [ "string", "null" ], "description": "The URL for the order in your system or store.", "example": "https://www.aftership.com/my-orders/6845a095a27a4caeb27487806f058add" }, "order_date": { "type": [ "string", "null" ], "description": "The date and time the order was created in your system or store. It uses the format: `YYYY-MM-DDTHH:mm:ssZ` based on whichever timezone you provide.", "example": "2022-01-20T15:56:12+08:00" }, "shipment_package_count": { "type": [ "number", "null" ], "description": "Number of packages under the tracking.", "example": 1 }, "shipment_pickup_date": { "type": [ "string", "null" ], "minLength": 1, "description": "The date and time the shipment was picked up by the carrier. It uses the timezone where the pickup occured. The format may differ depending on how the carrier provides it:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ", "example": "2022-01-21T15:00:00" }, "shipment_delivery_date": { "type": [ "string", "null" ], "minLength": 1, "description": "The date and time the shipment was delivered. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ", "example": "2022-01-29T11:23:00" }, "shipment_type": { "type": [ "string", "null" ], "minLength": 1, "description": "The carrier service type for the shipment.", "example": "FedEx SmartPost" }, "shipment_weight": { "type": [ "number", "null" ], "description": "Shipment weight provied by carrier.", "example": 0.7 }, "shipment_weight_unit": { "type": [ "string", "null" ], "description": "Weight unit provied by carrier.", "example": "kg" }, "signed_by": { "type": [ "string", "null" ], "description": "Signed by information for delivered shipment.", "example": "Steve Young" }, "smses": { "type": "array", "description": "The phone number(s) to receive sms notifications. Phone number should begin with `+` and `Area Code` before phone number. Comma separated for multiple values.", "items": { "type": "string" }, "example": [ "+8613800138000" ] }, "source": { "type": "string", "minLength": 1, "description": "Source of how this tracking is added.", "example": "api" }, "tag": { "$ref": "#/components/schemas/Tag.v1" }, "subtag": { "type": "string", "minLength": 1, "description": "Current subtag of tracking. ([See subtag definition](../../docs/enum/delivery_sub_statuses.md))", "example": "Delivered_002" }, "subtag_message": { "type": "string", "minLength": 1, "description": "Normalized tracking message. ([See subtag definition](../../docs/enum/delivery_sub_statuses.md))", "example": "Picked up by customer" }, "title": { "type": "string", "minLength": 1, "description": "By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number).", "example": "61293150000079650811" }, "tracked_count": { "type": "number", "description": "Number of attempts AfterShip tracks at courier's system.", "example": 13 }, "last_mile_tracking_supported": { "type": "boolean", "description": "Indicates if the shipment is trackable till the final destination.\nThree possible values:\n- true\n- false\n- null", "example": true }, "language": { "description": "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.", "type": [ "string", "null" ], "example": "en" }, "unique_token": { "type": "string", "minLength": 1, "deprecated": true, "description": "Deprecated", "example": "Deprecated" }, "checkpoints": { "type": "array", "description": "Array of checkpoint object describes the checkpoint information.", "items": { "$ref": "#/components/schemas/Checkpoint.v4" } }, "subscribed_smses": { "type": "array", "description": "Phone number(s) subscribed to receive sms notifications. Comma separated for multiple values", "items": { "type": "string" }, "example": [] }, "subscribed_emails": { "type": "array", "description": "Email address(es) subscribed to receive email notifications. Comma separated for multiple values", "items": { "type": "string" }, "example": [] }, "return_to_sender": { "type": "boolean", "description": "Whether or not the shipment is returned to sender. Value is `true` when any of its checkpoints has subtag `Exception_010` (returning to sender) or `Exception_011` (returned to sender). Otherwise value is `false`.", "example": false }, "order_promised_delivery_date": { "type": [ "string", "null" ], "description": "The promised delivery date of the order. It uses the format `YYYY-MM-DD`. This has no timezone and uses whatever date you provide.", "example": "2022-01-01" }, "delivery_type": { "type": [ "string", "null" ], "description": "Shipment delivery type\n- pickup_at_store\n- pickup_at_courier\n- door_to_door", "example": "pickup_at_store" }, "pickup_location": { "type": [ "string", "null" ], "description": "Shipment pickup location for receiver", "example": "13th Street, New York, NY 10011, USA, United States" }, "pickup_note": { "type": [ "string", "null" ], "description": "Shipment pickup note for receiver", "example": "No notes" }, "courier_tracking_link": { "type": [ "string", "null" ], "minLength": 1, "description": "Official tracking URL of the courier (if any)", "example": "https://www.fedex.com/apps/fedextrack/?tracknumbers=61293150000079650811&cntry_code=US" }, "first_attempted_at": { "type": [ "string", "null" ], "minLength": 1, "description": "The date and time of the carrier’s first attempt to deliver the package to the recipient. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ", "example": "2022-01-01T17:00:00-05:00" }, "courier_redirect_link": { "type": "string", "minLength": 1, "description": "Delivery instructions (delivery date or address) can be modified by visiting the link if supported by a carrier.", "example": "https://www.fedex.com/apps/fedextrack/?action=track&tracknumbers=61293150000079650811&cntry_code=US" }, "tracking_account_number": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": null }, "tracking_key": { "type": [ "string", "null" ], "description": "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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": null }, "tracking_ship_date": { "type": [ "string", "null" ], "description": "Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on [additional tracking fields](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "20220101" }, "on_time_status": { "type": [ "string", "null" ], "description": "Whether the tracking is delivered on time or not.", "example": "on-time" }, "on_time_difference": { "type": [ "number", "null" ], "description": "The difference days of the on time.", "example": 0 }, "order_tags": { "type": "array", "description": "The tags of the order.", "items": { "type": "string" }, "example": [ "Exception" ] }, "aftership_estimated_delivery_date": { "type": [ "object", "null" ], "description": "The estimated delivery date of the shipment provided by AfterShip’s AI and shown to the recipients. It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone.", "properties": { "estimated_delivery_date": { "type": "string", "description": "The estimated arrival date of the shipment.", "example": "2022-01-03" }, "confidence_score": { "type": [ "null", "number" ], "description": "The reliability of the estimated delivery date based on the trend of the transit time for the similar delivery route and the carrier's delivery performance, range from 0.0 to 1.0 (Beta feature).", "example": null }, "estimated_delivery_date_min": { "type": "string", "description": "Earliest estimated delivery date of the shipment.", "example": "2022-01-02" }, "estimated_delivery_date_max": { "type": "string", "description": "Latest estimated delivery date of the shipment.", "example": "2022-01-04" } } }, "custom_estimated_delivery_date": { "type": [ "object", "null" ], "description": "Estimated delivery time of the shipment based on your [custom EDD settings](https://admin.aftership.com/settings/promised-delivery-date). It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone.", "properties": { "type": { "type": "string", "enum": [ "range", "specific" ], "example": "specific", "description": "The format of the EDD. Either a single date or a date range." }, "datetime": { "type": [ "string", "null" ], "description": "The specific EDD date.", "example": "2022-01-05" }, "datetime_min": { "type": [ "string", "null" ], "description": "For a date range EDD format, the date for the lower end of the range.", "example": null }, "datetime_max": { "type": [ "string", "null" ], "description": "For a date range EDD format, the date for the upper end of the range.", "example": null } } }, "order_number": { "type": [ "string", "null" ], "description": "A unique, human-readable identifier for the order.", "example": "162654659775" }, "first_estimated_delivery": { "type": [ "object", "null" ], "description": "The shipment’s original estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone.", "properties": { "type": { "type": "string", "enum": [ "range", "specific" ], "example": "specific", "description": "The format of the EDD. Either a single date or a date range." }, "source": { "type": "string", "description": "The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings.", "enum": [ "Carrier EDD", "AI Predictive EDD", "Custom EDD", "Order EDD" ], "example": "Carrier EDD" }, "datetime": { "type": [ "string", "null" ], "description": "The latest EDD time.", "example": "2022-01-05T12:11:11+01:00" }, "datetime_min": { "type": [ "string", "null" ], "description": "For a date range EDD format, the date and time for the lower end of the range.", "example": null }, "datetime_max": { "type": [ "string", "null" ], "description": "For a date range EDD format, the date and time for the upper end of the range.", "example": null } } }, "latest_estimated_delivery": { "type": [ "object", "null" ], "description": "The most recently calculated estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone.", "properties": { "type": { "type": "string", "enum": [ "range", "specific" ], "example": "specific", "description": "The format of the EDD. Either a single date or a date range." }, "source": { "type": "string", "description": "The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings.", "enum": [ "Carrier EDD", "AI Predictive EDD", "Custom EDD", "Order EDD" ], "example": "AI Predictive EDD" }, "datetime": { "type": [ "string", "null" ], "description": "The latest EDD time.", "example": "2022-01-05T12:11:11+01:00" }, "datetime_min": { "type": [ "string", "null" ], "description": "For a date range EDD format, the date and time for the lower end of the range.", "example": null }, "datetime_max": { "type": [ "string", "null" ], "description": "For a date range EDD format, the date and time for the upper end of the range.", "example": null } } }, "shipment_tags": { "type": "array", "description": "Used to add tags to your shipments to help categorize and filter them easily.", "maxItems": 50, "items": { "type": "string", "maxLength": 32 }, "example": [ "Returned" ] }, "courier_connection_id": { "type": "string", "description": "The courier connection id tells which carrier account you’ve used to handle a shipment so we can track it.", "minLength": 1, "example": "8e1261bde336436abbc7cb3eee8cd707" }, "next_couriers": { "type": "array", "description": "The next couriers get the second carrier information from user or AfterShip.", "items": { "type": "object", "properties": { "slug": { "type": "string", "description": "Unique code of courier. Get courier [here](../../reference/api.v4.json/paths/~1couriers/get)", "example": "usps" }, "tracking_number": { "type": "string", "description": "Tracking number.", "example": "61293150000079650811" }, "source": { "type": "string", "description": "Source of next couriers.", "enum": [ "user", "system" ], "example": "system" } }, "required": [ "slug", "tracking_number" ] } }, "tracking_origin_country": { "type": [ "string", "null" ], "description": "(Legacy) Replaced by `origin_country_iso3`. 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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "CHN" }, "tracking_destination_country": { "type": [ "string", "null" ], "description": "(Legacy) Replaced by `destination_country_iso3`. 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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "USA" }, "tracking_postal_code": { "type": [ "string", "null" ], "description": "(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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "90213" }, "tracking_state": { "type": [ "string", "null" ], "description": "(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](../../docs/enum/additional_tracking_fields.md) for more details.", "example": "CA" } } }, "Courier_response.v1": { "title": "Courier response", "type": "object", "description": "Model of all couriers endpoint response", "properties": { "meta": { "$ref": "#/components/schemas/Meta.v1" }, "data": { "type": "object", "properties": { "total": { "type": "number", "description": "Total count of courier objects" }, "couriers": { "type": "array", "description": "Array of [Courier](../../model/resource/courier.v4.json) object.", "items": { "$ref": "#/components/schemas/Courier.v4" } } } } }, "required": [ "meta", "data" ] }, "Meta.v1": { "title": "meta", "type": "object", "description": "Meta data", "properties": { "code": { "type": "number", "example": 200, "description": "meta code" }, "message": { "type": "string", "description": "error message, only exist if the response status is not 2xx" }, "type": { "type": "string", "enum": [ "BadRequest", "Unauthorized", "Forbidden", "NotFound", "TooManyRequests", "InternalError" ], "description": "error type, only exist if the response status is not 2xx" } }, "required": [ "code" ] }, "Notification_response.v1": { "title": "notification_response", "type": "object", "properties": { "meta": { "$ref": "#/components/schemas/Meta.v1" }, "data": { "type": "object", "properties": { "notification": { "$ref": "#/components/schemas/Notification.v4" } } } } }, "Tracking_response.v1": { "title": "Tracking response", "type": "object", "description": "Tracking response for returning single tracking", "properties": { "meta": { "$ref": "#/components/schemas/Meta.v1" }, "data": { "type": "object", "properties": { "tracking": { "$ref": "#/components/schemas/Tracking.v4" } } } }, "required": [ "meta", "data" ] }, "Tracking_response_get_multiple.v1": { "title": "Tracking response for get trackings", "type": "object", "description": "Tracking response for getting tracking", "properties": { "meta": { "$ref": "#/components/schemas/Meta.v1" }, "data": { "type": "object", "description": "", "properties": { "page": { "type": "number", "description": "Page to show. (Default: 1)" }, "limit": { "type": "number", "description": "Number of trackings each page contain. (Default: 100, Max: 200)" }, "count": { "type": "number", "description": "Number of returned trackings" }, "keyword": { "type": "string", "description": "Search the content of the tracking record fields: `tracking_number`, `title`, `order_id`, `customer_name`, `custom_fields`, `order_id`, `emails`, `smses`" }, "slug": { "type": "string", "description": "Unique [courier code](../../reference/api.v4.json/paths/~1couriers/get) Use comma for multiple values. (Example: `dhl`, `ups`, `usps`)" }, "origin": { "type": "array", "description": "Origin country/region of trackings. Use [ISO Alpha-3 (three letters)](https://support.aftership.com/en/article/iso3-country-code-rlpi07/). Use comma for multiple values. (Example: `USA`, `HKG`)", "items": { "type": "string" } }, "destination": { "type": "array", "description": "Destination country/region of trackings. Use [ISO Alpha-3 (three letters)](https://support.aftership.com/en/article/iso3-country-code-rlpi07/). Use comma for multiple values. (Example: `USA`, `HKG`)", "items": { "type": "string" } }, "tag": { "$ref": "#/components/schemas/Tag.v1" }, "created_at_min": { "type": "string", "description": "Start date and time of trackings created. AfterShip only stores data of 90 days." }, "created_at_max": { "type": "string", "description": "End date and time of trackings created." }, "last_updated_at": { "type": "string", "description": "Date and time the tracking was last updated" }, "return_to_sender": { "type": "array", "description": "Whether or not the shipment is returned to sender. Value is `true` when any of its checkpoints has subtag `Exception_010` (returning to sender) or `Exception_011` (returned to sender). Otherwise value is `false`", "items": { "type": "boolean" } }, "courier_destination_country_iso3": { "type": "array", "description": "Destination country/region 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.", "items": { "type": "string" } }, "trackings": { "description": "Array of [tracking object](../../model/resource/tracking.v4.json)", "type": "array", "items": { "$ref": "#/components/schemas/Tracking.v4" } } } } }, "required": [ "meta" ] } } }, "security": [ { "as-api-key": [] }, { "aftership-api-key": [] } ] }