MapScale Docs
•••
MapScale API
POST/v1/route

Calculate a route with a JSON body

Calculate a route between ordered waypoints using a JSON request body.

LIVE API PLAYGROUND

Sign in or create an account

Continue to run live requests directly from the docs.

Sends this request to the live API and shows the real response.

Equivalent request
curl \
  -X POST \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"coordinates":[[100.5018,13.7563],[100.5348,13.7466]],"profile":"driving","alternatives":false,"lang":"th"}' \
  "https://api.mapscale.io/v1/route"
Response
Default response
{
  "code": "Ok",
  "routes": [
    {
      "distance": 5420,
      "duration": 780,
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [
            100.5018,
            13.7563
          ],
          [
            100.5348,
            13.7466
          ]
        ]
      },
      "legs": [
        {
          "distance": 5420,
          "duration": 780
        }
      ]
    }
  ],
  "waypoints": [
    {
      "location": [
        100.5018,
        13.7563
      ]
    },
    {
      "location": [
        100.5348,
        13.7466
      ]
    }
  ]
}

Request body

Required · application/json

application/json
{
  "coordinates": [
    [
      100.5018,
      13.7563
    ],
    [
      100.5348,
      13.7466
    ]
  ],
  "profile": "driving",
  "alternatives": false,
  "lang": "th"
}

Responses

200Route computedapplication/json
400Invalid requestapplication/json
401mapscale/effect-api/UnauthorizedFailureapplication/json
403mapscale/effect-api/ForbiddenFailureapplication/json
404No route was foundapplication/json
429mapscale/effect-api/RateLimitedFailureapplication/json
500mapscale/effect-api/MiddlewareInternalFailureapplication/json
502Upstream routing engine failureapplication/json
503Upstream routing engine unavailable | mapscale/effect-api/UpstreamUnavailableFailureapplication/json

On this page