# Marketplace Orders

## Create a New Order

<mark style="color:green;">`POST`</mark> `/orders/booking`

Creates a booking order at Blowhorn returning an unique tracking number upon successful validation of payload passed.

#### Headers

| Name     | Type   | Description                       |
| -------- | ------ | --------------------------------- |
| API\_KEY | string | Contact Blowhorn team for API Key |

{% tabs %}
{% tab title="200 Order created successfully." %}

```
{
  "status": "PASS",
  "message": {
    "order_number": "YT6U2O",
    "tracking_url": "https://blowhorn.com/track/YT6U2O",
    "estimated_distance": 4.5,
    "estimated_cost": 450
  }
}
```

{% endtab %}

{% tab title="400 Bad request / Validation error" %}

```
{
  "status": "FAIL",
  "message": "`value` for `pickup_time` is mandatory for advanced booking"
}
```

{% endtab %}

{% tab title="401 Unauthorized / Wrong api key" %}

```
{
  "status": "FAIL",
  "message": "Unauthorized / Wrong api key"
}
```

{% endtab %}

{% tab title="500 Unexpected error" %}

```
{
  "status": "FAIL",
  "message": "Unexpected error"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Example Value | Schema" %}

```json
{
  "pickup_time": {
    "type": "later",
    "value": "2018-12-12T10:47:35.408907"
  },
  "pickup": {
    "name": "Home",
    "address": {
      "area": "HSR Layout",
      "city": "Bengaluru",
      "postal_code": 560095,
      "full_address": "245, 2nd Cross, HSR Layout Bengaluru"
    },
    "contact": {
      "name": "Mahadevappa",
      "mobile": 9999999999
    },
    "geopoint": {
      "lat": 12.9081357,
      "lng": 77.64760799999999
    }
  },
  "dropoff": {
    "name": "Work",
    "address": {
      "area": "BTM Layout",
      "city": "Bengaluru",
      "postal_code": 560034,
      "full_address": "245, 3rd Main, BTM Layout Bengaluru"
    },
    "contact": {
      "name": "Raj",
      "mobile": 8888888888
    },
    "geopoint": {
      "lat": 12.9165757,
      "lng": 77.61011630000007
    }
  },
  "waypoints": [
    {
      "sequence_id": "1",
      "name": "Waypoint 1",
      "address": {
        "area": "HSR Layout",
        "city": "Bengaluru",
        "postal_code": 560102,
        "full_address": "2287 16th Cross Rd Vanganahalli 1st Sector HSR Layout Bengaluru 560102"
      },
      "contact": {
        "name": "Puneet",
        "mobile": 7777777777
      },
      "geopoint": {
        "lat": 12.912442595996774,
        "lng": 77.64740069737547
      }
    }
  ],
  "items": [
    "Chair",
    "Table"
  ],
  "num_of_labours": 1,
  "vehicle_class": "Mini-Truck",
  "payment_mode": "Online",
  "price_type": "full-day"
}
```

{% endtab %}
{% endtabs %}

## Postman Collection

We have a Postman collection to make the integration quicker and easier. You can test all our APIs by importing the full API collection through the **'Run in Postman'** button and running them in the Postman app.

[![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/c890eac23a589a598d25)
