Request
This section describes the request method and the contents of each request header. If the request fails, see Troubleshooting for details about the error.
Request Method
Table 1 Request Method
| Method | URL |
|---|---|
POST | https://apis-navi.kakaomobility.com/v1/origins/directions |
Request Headers
Table 2 Request Headers
| Parameter | Description |
|---|---|
| Authorization | KakaoAK ${REST_API_KEY} {REST_API_KEY}: The REST API key issued from Kakao Developers |
| Content-Type | application/json |
Sample Request
bash
curl -v -X POST "https://apis-navi.kakaomobility.com/v1/origins/directions" \
-H "Content-Type: application/json" \
-H "Authorization: KakaoAK ${REST_API_KEY}" \ // The REST API key issued from Kakao Developers
-d '{
"origins": [
{
"x": "127.1331694942593",
"y": "37.4463137562622",
"key": "0"
},
{
"x": "127.13243772760565",
"y": "37.44148514309502",
"key": "1"
}
],
"destination": {
"x": "127.14816492905383",
"y": "37.4401690139602"
},
"radius": 5000
}'The request parameters are as follows:
Table 3 Request Parameters
| Name | Type | Description | Required |
|---|---|---|---|
origins | Object[] | Origins; up to 30 origins are allowed | Required |
x | Double | X coordinate (longitude) | Required |
y | Double | Y coordinate (latitude) | Required |
key | String | An arbitrary string to identify each origin | Required |
destination | Object | Destination | Required |
name | String | Destination name | Optional |
x | Double | X coordinate (longitude) | Required |
y | Double | Y coordinate (latitude) | Required |
radius | Int | Radius to find routes in meters (Maximum: 10000) | Required |
priority | String | Route search priority option Use one of the following: TIME: The fastest routeDISTANCE: The shortest route(Default: TIME) | Optional |
avoid | String[] | Route search restriction options The following values are available: ferries: Ferry routestoll: Toll roadsmotorway: Motorwaysschoolzone: School zonesuturn: U-turns(Default: null)To use multiple restriction options, connect them as follows (Example: [" ferries", "motorway"]) | Optional |
roadevent | Int | Option to reflect road closure information caused by traffic incidents (traffic obstructions such as accidents, events, disasters, or road construction)0: Reflect full lane closure (entire road closure) information1: Do not reflect full lane closure information near the origin and destination2: Do not reflect full lane closure information for any section(Default: 0) | Optional |
Response
Upon a successful response, the success status of the request is delivered as an HTTP status code, and the response body is delivered in JSON format.
Sample Response
bash
{
"trans_id": "a2653095f26445dba15d736c5714d86a",
"routes": [
{
"result_code": 0,
"result_msg": "길찾기 성공",
"key": "0",
"summary": {
"distance": 2305,
"duration": 615
}
},
{
"result_code": 0,
"result_msg": "길찾기 성공",
"key": "1",
"summary": {
"distance": 1878,
"duration": 408
}
}
]
}The response object information is as follows:
Table 4 Response Object
| Name | Type | Description | Required |
|---|---|---|---|
trans_id | String | Unique identifier of a route request | Required |
routes | Object[] | Route information; one entry is created for each route | Required |
result_code | Int | Route search result code | Required |
result_msg | String | Route search result message | Required |
key | String | The value of key specified for each origin in origins | Required |
summary | Object | Route summary information | Required |
distance | Int | Total distance of the search result in meters | Required |
duration | Int | Time required to reach the destination in seconds | Required |