# Route

The Routing API will show you how to get where you’re going. \
With the Routing API, you can:

* Provide precise instructions to a destination using various transport modes (e.g., car, public transit, bicycle).
* To request directions, call four values: a start point, destination, and car type, and waypoint (optional).

{% hint style="info" %}
See the [**API Key Issuance page**](https://fatos-doc.fatos.biz/get-your-api-key) for information on using keys.
{% endhint %}

## Routing API

<mark style="color:blue;">`GET`</mark> `https://api.fatos.biz/fatos/api/route`

​Example API Call:\
\
<https://api.fatos.biz/fatos/api/route?key=YOUR\\_API\\_KEY\\&origin=37.483294848898396,126.89654749206602\\&destination=37.51702306480502,127.0416190159097\\&angle=-1\\&rpoption=1\\&unixtime=1604626833\\&gmtoffset=32400\\&cartype=1>

#### Query Parameters

| Name        | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| startname   | string  | Starting place name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| destname    | string  | Destination name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| hipass      | integer | <p>0: None<br>1: Yes<br>Default: 0</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| fueltype    | integer | <p>0: Gasoline<br>1: Diesel<br>2: LPG<br>3: CNG<br>4: Electric<br>5: BioDiesel</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| pattern     | integer | <p>Reflect pattern information<br>0: Ignore<br>1: Reflect pattern information<br>Default: 0</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| gmtoffset   | string  | Timezone                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| unixtime    | string  | Time when requesting for RP                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| traffic     | integer | <p>Reflect traffic information<br>false: Ignore<br>true: Reflect traffic information<br>Default: false</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| carspeed    | integer | <p>0\~255<br>Default: 0</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| reqtype     | string  | <p>0: Initial RP request<br>1. Retry RP request on route deviation<br>2. User RP request<br>3. Periodic RP request<br>4. Request Route detail<br>Default: 0</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| origin      | string  | Start point (lat, lng)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| destination | string  | End point (lat, lng)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| key         | string  | Your API Key                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| via         | number  | Waypoint (lat, lng), In the case of multiple waypoints, list them in order in the query string.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| cartype     | integer | <p>car type <br>101: 2 Axles, less than 16 persons<br>102: 2 Axles, less than 32 persons<br>103: 2 Axles, less than 33 persons<br>104: 3 Axles, between 10 to 20 Ton<br>105: 4 Axles or above (Over 20 Ton)<br>106: 2 Axles, less than 1000cc<br></p><p>11:  Micro Car</p><p><br>111: Truck with dangerous load<br>112: Truck<br>113: Construction Machinery<br>114: Construction Vehicle<br>115: Trailer<br>116: Farm Vehicle<br><br>121: Bus<br>122: Taxi<br>123: Taxi without passenger<br>124: Cart<br>125: HOV<br>126: Emergency<br>127: Motorcycle<br>128: 3 Wheel Motorcycle<br><br>141: Bicycle<br>142: Tricycle<br>143: Pedestrian<br>144: Pet<br>145: WheelChair<br>146: Visually Impaired<br></p> |
| rpoption    | integer | <p>Routing Plan Option<br>Sum of each option value.<br>1: Recommended 1<br>2: Recommended 2<br>4: Highway Priority<br>8: General road Priority<br>16: Shortest Distance<br>32: Free road (in the shortest time)<br>64: Exclude Car-only<br>256: Free road (in the shortest distance)<br><br>ex) rpoption 3 => Recommended 1 + Recommended 2<br></p>                                                                                                                                                                                                                                                                                                                                                          |
| gpsangle    | number  | degrees (0\~359)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "routes": [
    {
      "rpoption": 1,
      "bounds": {
        "lefttop": {
          "lon": 127.006812,
          "lat": 36.081916
        },
        "rightbottom": {
          "lon": 128.36276,
          "lat": 37.560658
        }
      },
      "legs": [
        {
          "distance": {
            "text": "339.7 km",
            "value": 339760
          },
          "duration": {
            "text": "265 min",
            "value": 15909
          },
          "end_location": {
            "lon": 128.325439,
            "lat": 36.144195
          },
          "start_location": {
            "lon": 127.02298,
            "lat": 37.559692
          },
          "step": [
            {
              "distance": {
                "text": "0 m",
                "value": 0
              },
              "duration": {
                "text": "0 sec",
                "value": 0
              },
              "end_location": {
                "lon": 127.022793,
                "lat": 37.559661
              },
              "start_location": {
                "lon": 127.022793,
                "lat": 37.559661
              },
              "polyline": {
                "points": "{zfdFmchfW"
              },
              "instructions": "starting point",
              "roadcategory": 12,
              "maneuver": 49
            },
            {
              // steps omitted
            },
            {
              "distance": {
                "text": "0.1 km",
                "value": 116
              },
              "duration": {
                "text": "56 sec",
                "value": 56
              },
              "end_location": {
                "lon": 127.023163,
                "lat": 37.560658
              },
              "start_location": {
                "lon": 127.022793,
                "lat": 37.559661
              },
              "polyline": {
                "points": "{zfdFmchfWIEUS]YGEGCWA_BI"
              },
              "instructions": "Destination",
              "roadcategory": 12,
              "maneuver": 3
            }
          ],
          "via_waypoint": [
            {
              "location": {
                "lon": 127.123108,
                "lat": 36.123123
              },
              "step_index": 27
            }
          ]
        }
      ],
      "overview_polyline": {
        "points_count": 3986,
        "points": "{zfdFmchfW??IEUS]YGEGCWA_BI?wBtDCP@Z@lCJ`@C\\G`@ULMx@eARS...."
      },
      "summary": "제2중부고속도로|영동고속도로|",
      "warnings": "",
      "waypointOrders": [],
      "rpoption": 1,
      "tollfare": 10500,
      "taxifare": 202000
    }
  ],
  "status": "OK"
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
**Display of Directions Results**

After you receive the requested results, you must decode the result into a geometry code. Call the Fatos.polyLine() function as the decoded result and display the result on the map.
{% endhint %}
