---
# System prepended metadata

title: Awfar API
tags: [Awfar]

---

Awfar API
===

###### tags: `Awfar`

All functionalities are accessible from an Awfar API host:

https://awfarxpress.com/api/v1/dev

## API Key
Get your own API_KEY from personal page in your account.


## Authentications

Two header elements are mandatory for authentication purposes:

```
token: API_KEY
Content-Type: application/json
```

## API's List

### Add New Package

To add a new package to your awfar account.

##### EndPoint 
```
/add-package
```

##### Method
```
POST
```

##### Request

```json=
{
    "senderName": "Abdallah",
    "customerName": "Ahmed",
    "mobile": "0597185554",
    "city": "جدة",
    "noOfPackages": 2,
    "neighborhood": "alremal",
    "weight": 10,
    "needPay": false,
    "price": 0,
    "packagePrice": 100,
    "packageContent": "books",
    "shipperMobile": "0597185554",
    "shipperCity": "الدمام",
    "shipperDistrict": "ALremal",
    "shipperAddress": "al-naser street",
}
```

##### Response

Returns trackId for added package. 

```json=
{
      statusCode: 200,
      data: 12345678,
      message: "Success",
}
```

---

### Get List Of Valied Cities

City must be a valid to add a new package.

##### EndPoint 
```
/cities-list
```

##### Method
```
GET
```

##### Request

To get the list of shipper valid cities
```json=
/cities-list?type=from
```

To get the list of customer valid cities
```json=
/cities-list?type=to
```

##### Response

Returns a list of cities. 

```json=
{
      statusCode: 200,
      data: [
          {
              "name": "جدة"
          },{
              "name": "الطائف"
          },{
              "name": "ذهبان"
          },{
              "name": "الدمام"
          },
      ],
      message: "Success",
}
```

---
### Track Package

To know if your packages delivered or not.

##### EndPoint 
```
/track-package
```

##### Method
```
POST
```

##### Request

```json=
{
    "trackId": [70703054, 90742811],
}
```

##### Response

Returns just the packages that delivered. 

```json=
{
      "statusCode": 200,
      "data": [
        {
            "packagePositionId": 1,
            "trackId": 70703054,
            "status": "تم الغاء الشحنة",
            "trackList": [
                {
                    "id": 77872,
                    "note": "ملغاه - تم تسليمها للمرسل",
                    "createdAt": "2021-09-16T11:43:03.546Z"
                }
            ]
        },
        {
            "packagePositionId": 7,
            "trackId": 90742811,
            "status": "تم التوصيل للمستقبل",
            "trackList": [
                {
                    "id": 74398
                    "note": "تم التوصيل للعميل"
                    "createdAt": "2021-09-10T16:32:32.966Z"
                },{
                    "id": 74389,
                    "note": "جاري التوصيل للعميل",
                    "createdAt": "2021-09-10T16:32:32.966Z"
                },
                {
                    "id": 74388,
                    "note": "تم الاستلام في فرع مستودع الرياض",
                    "createdAt": "2021-09-10T16:32:03.960Z"
                },
                {
                    "id": 74387,
                    "note": "مرحلة الفرز",
                    "createdAt": "2021-09-10T16:32:03.957Z"
                },
                {
                    "id": 74386,
                    "note": "تم الاستلام من المندوب",
                    "createdAt": "2021-09-10T16:32:03.954Z"
                },
                {
                    "id": 74385,
                    "note": "طلب جديد",
                    "createdAt": "2021-09-10T16:31:05.531Z"
                }
            ]
        },
      ],
      "message": "Success"
}
```

---

### Print Packages Label

To print your packages label.

##### EndPoint 

https://awfarxpress.com/package-bill/trackId-trackId-trackId/token

##### Example 

https://awfarxpress.com/package-bill/12345678-12567891/eyJhbGciOiJIUzI1NiIertsInR5cVCJ9.eyJ1c2VySWQiOjIsInVzZXJUeXBlIjoidHJhZGVretyIiwiYXBpIXQiOjE2MTIwNDE4OTV9.wkKuCAAIgRFtooCpttRG2wJrhdtZkQElxTXVnSqbGrj5vKs


##### Method
```
GET
```

##### Response

It will open a page and start printing labels. 

