# YunExpress Tracking API

Empower Your Dev Team with the YunExpress Tracking API via AfterShip.

Integrate seamless YunExpress tracking integration with a robust RESTful API and webhooks to automate YunExpress delivery updates in real-time.

### YunExpress Tracking Integration

With an AfterShip developer account, you'll experience fast tracking updates and industry-leading 99.9% API uptime. Enhance your logistics now with the YunExpress Tracking API.

## Create a tracking

Creates a new tracking object.

### Parameters
- `tracking_number` string **required**: Tracking number of a shipment. Duplicated tracking numbers, tracking numbers with invalid formatting will not be accepted. Only accept tracking numbers with length from 4 to 100.
- `slug` string, static `yunexpress`.
- `title` string: By default, this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number).
- `order_id` string: A globally unique identifier for the order.
- `order_promised_delivery_date` string: The promised delivery date of the order. Format `YYYY-MM-DD`.

### Returns

Returns a tracking object if the call succeeded.

```bash
curl --request POST \
     --url https://api.aftership.com/tracking/2024-04/trackings \
     --header 'Content-Type: application/json' \
     --data '{"tracking":{"slug":"yunexpress","title":"Title Name","smses":["+18555072509","+18555072501"],"emails":["email@yourdomain.com","another_email@yourdomain.com"],"order_id":"ID 1234","language":"en","pickup_note":"Reach out to our staff when you arrive for shipment pickup","origin_city":"Beijing","order_number":"1234","origin_state":"Beijing","order_id_path":"http://www.aftership.com/order_id=1234","custom_fields":{"product_name":"iPhone Case","product_price":"USD19.99"},"delivery_type":"pickup_at_store","tracking_number":"123456789","pickup_location":"Flagship Store","destination_city":"New York City","destination_state":"New York","origin_postal_code":"065001","origin_country_iso3":"CHN","origin_raw_location":"Lihong Gardon 4A 2301, Chaoyang District, Beijing, BJ, 065001, CHN, China","destination_postal_code":"10001","destination_country_iso3":"USA","destination_raw_location":"13th Street, New York, NY, 10011, USA, United States","order_promised_delivery_date":"2019-05-20"}}'
```

### Retrieve a tracking

Retrieves the details of an existing tracking. Supply the unique tracking ID, and AfterShip will return the corresponding tracking information.

### Parameters
- `fields` string: List of fields to include in the response.
- `lang` string: Translate checkpoint messages from the carrier’s provided language to the target language.

### Returns

Returns a tracking object if a valid identifier was provided.

```bash
curl --request GET \
     --url https://api.aftership.com/tracking/2024-04/trackings/id \
     --header 'Content-Type: application/json'
```

### Update a tracking

Updates the specific tracking by setting the values of the parameters passed.

### Parameters
- `smses` array[string]: Phone number(s) to receive SMS notifications.
- `emails` array[string]: Email address(es) to receive email notifications.
- `title` string: Customize the title.
- `customer_name` string: Customer name of the tracking.
- `order_id` string: A globally unique identifier for the order.
- `note` string: Text field for the note.

### Returns

Returns the tracking object if the update succeeded.

```bash
curl --request PUT \
     --url https://api.aftership.com/tracking/2024-04/trackings/id \
     --header 'Content-Type: application/json' \
     --data '{"value":{"tracking":{"note":"some notes","title":"New Title"}}}'
```

### Delete a tracking

Delete a tracking.

### Parameters
- `id` string **required**: Tracking ID.

### Returns

Returns a deleted object on success. Otherwise, this call raises an error.

```bash
curl --request DELETE \
     --url https://api.aftership.com/tracking/2024-04/trackings/id \
     --header 'Content-Type: application/json'
```

## Why use AfterShip API for YunExpress Integration

Integrating directly with YunExpress's API requires significant time and resources. AfterShip provides a unified RESTful API that supports YunExpress and over 1,200 global carriers, reducing the development overhead.

- **Cost-saving and faster integration**
- **Comprehensive developer resources**
- **Unified carrier management**

## AfterShip's YunExpress Tracking API: Building seamless shipment visibility

Effortlessly integrate AfterShip's YunExpress shipment tracking API into your systems to deliver a unified tracking experience. With over 8 billion shipments tracked, AfterShip ensures reliability across multiple carriers.

## Frequently Asked Questions

### How to generate YunExpress API key?

To ensure secure access, AfterShip requires an API key in the header of each request. You can request a free API key by submitting the form.

### Do I need a YunExpress developer account to use this API?

No, you don't need a YunExpress account. AfterShip has partnered with YunExpress for direct access to tracking data.
