---
# System prepended metadata

title: Miare API Documentation <sub>v2</sub>

---


# Miare API Documentation <sub>v2</sub>

  

## Entities

### Trip

```json

{

"id": "trp_3vDjjkd21b",

"area_id": "are_5veSjkd21g",

"state": "pickup",

"pickup": {

"name": "رستوران بزرگمهر",

"phone_number": "02188664422",

"address": "تهران، صادقیه، بلوار آیت الله کاشانی",

"image": "https://example.com/restaurants/bm_logo.png",

"location": {

"lat": 35.7586449,

"lng": 51.41356149

},

},

"courses": [

"id": "cor_6vjQjkd44k",

"name": "علی علوی",

"phone_number": "09123456789",

"address": "تهران، خیابان استاد معین، پلاک ۱۲",

"location": {

"lat": 35.737004,

"lng": 51.413569

},

"manifest_items": [

"name": "پیتزا پپرونی خانواده",

"quantity": 1

},

"name": "نوشابه",

"quantity": 2

],

"dropped_off_at": "2019-04-12T15:10:52+0000"

],

"created_at": "2019-04-12T13:59:42+0000",

"assigned_at": "2019-04-12T13:59:59+0000",

"picked_up_at": "2019-04-12T14:10:42+0000",

"ended_at": "2019-04-12T15:10:52+0000",

"tracking_url": "https://mia.re/t/73c939d1/",

"courier": {

"name": "Robo Courier",

"image": "https://files.miare.ir/avatars/gheuIej.jpg"

},

"test_mode": true,

"estimated_price": 75000,

"price": 76000

}

```

  
  

## Resources

  

### Create Trip

#### Request

```

POST

/api/v2/trips

```

```json

{

"pickup_name": "رستوران بزرگمهر",

"pickup_phone_number": "02188664422",

"pickup_address": "تهران، صادقیه، بلوار آیت الله کاشانی",

"pickup_latitude": 35.7586449,

"pickup_longitude": 51.41356149,

"pickup_image": "https://example.com/restaurants/bm_logo.png",

"pickup_deadline": "2019-04-12T13:59:42+0000",

"courses": [

"name": "علی علوی",

"phone_number": "09123456789",

"address": "تهران، خیابان استاد معین، پلاک ۱۲",

"latitude": 35.737004,

"longitude": 51.413569,

"manifest_items": [

"name": "پیتزا پپرونی خانواده",

"quantity": 1

},

"name": "نوشابه",

"quantity": 2

],

"test_mode": true,

"robo_assign": "00:01:00",

"robo_pickup": "00:12:00",

"robo_dropoffs": [

"00:21:00"

],

"robo_end": "00:25:00"

}

```

  

#### Response

```json

Trip

```

  

### Cancel Trip

#### Request

```

POST

/api/v2/trips/<trip_id>/cancel

```

  

#### Response

```json

Trip

```

  

### Add Course

#### Request

```

POST

/api/v2/trips/<trip_id>/courses

```

```json

{

"name": "علی علوی",

"phone_number": "09123456789",

"address": "تهران، خیابان استاد معین، پلاک ۱۲",

"latitude": 35.737004,

"longitude": 51.413569,

"manifest_items": [

"name": "پیتزا پپرونی خانواده",

"quantity": 1

},

"name": "نوشابه",

"quantity": 2

],

"robo_dropoff": "00:31:00"

}

```

#### Response

```

Trip

```

  

### Remove Course

#### Request

```

POST

/api/v2/trips/<trip_id>/courses/<course_id>/remove

```

#### Response

```

Trip

```

  

### List Trips

#### Request

```

GET

PATH: /api/v2/trips

PARAMS:

[area_id]

[state] (pickup)

[from_date] (2019-04-12)

[to_date] (2019-04-15)

```

  

#### Response

```

[Trip]

```

  

### Get Trip

#### Request

```

GET

PATH: /api/v2/trips/<trip_id>

```

  

#### Response

```

Trip

```

  

### List Areas

#### Request

```

GET

PATH: /api/v2/areas

```

  

#### Response

```json

[

"id": "are_5veSjkd21g",

"name": "تهران - ظفر",

"max_ongoing_trips": 7,

"ongoing_trips": 5,

"polygon": [

"lat": 35.737004,

"lng": 51.413569

},

"lat": 35.737504,

"lng": 51.413269

},

"lat": 35.737604,

"lng": 51.413969

},

"lat": 35.737004,

"lng": 51.413569

]

```

  

## Webhook

### Event

```json

{

"type": "event.status", // [event.status, event.checkout]

"id": "evt_KC9LLdlTwr7udF",

"trip_id": "trp_3vDjjkd21b",

"course_id": "cor_4fT4jDN30a",

"status": "dropoff", // [assign, pickup, dropoff, end]

"price": 76000,

"data": Trip,

"created": "2019-04-12T13:59:42+0000",

"test_mode": false

}

```

  
  

----------

  
  

<!--stackedit_data:

eyJoaXN0b3J5IjpbLTUwMzY0MjQzM119

-->
<!--stackedit_data:
eyJoaXN0b3J5IjpbMzQ2Nzc5NzQ2LC01MDM2NDI0MzMsLTExNz
g2MzQzMTAsLTUwMzY0MjQzM119
-->
