> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ocpplab.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ocpplab.io/_mcp/server.

# Locations along a route

GET https://api.ocpplab.io/emsp/locations/route

Locations within ``buffer_km`` of an encoded polyline (Google format, precision 5), in order along the route. Same filters as the map. Returns at most ``limit`` locations with no next page: shorten the route or ``buffer_km`` to narrow it.

Reference: https://docs.ocpplab.io/api-reference/emsp/locations/route

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `connector_types` (list of string, optional) — Only these OCPI connector standards, e.g. ``IEC_62196_T2``. Repeat for more than one.
- `cpo_ids` (list of string, optional) — Only these CPOs, as ``CC*PID``. Repeat for more than one.
- `polyline` (string, required) — The route as a Google encoded polyline, precision 5.
- `buffer_km` (double, optional, default: 2) — Distance from the route in km (default 2, max 20).
- `limit` (integer, optional, default: 50) — Maximum results (default 50, max 200).
- `network_id` (integer, optional, nullable) — Only locations this network reaches. Not together with token_group_id.
- `token_group_id` (integer, optional, nullable) — Only locations the group's networks reach. Not together with network_id.
- `min_power` (double, optional, nullable) — Minimum connector power in kW.
- `available_only` (boolean, optional, default: false) — Only locations with an EVSE free right now.
- `own` (boolean, optional, nullable) — true: only your own OCPP chargers. false: only partner (roaming) locations.

## Response

### 200

Locations near the route, in order along it.

- `data` (list of LocationSummary, required)

## Errors

### 400 Bad Request Error

The polyline does not decode

- `detail` (string, required) — Human-readable error message returned by the API.

### 401 Unauthorized Error

Missing or invalid Bearer token

- `detail` (string, required) — Human-readable error message returned by the API.

### 422 Unprocessable Entity Error

The request does not match the schema

- `detail` (list of ValidationError, optional) — One entry per invalid field.

### 429 Too Many Requests Error

Gateway rate limit reached; retry after the given seconds

- `detail` (string, required) — Human-readable error message returned by the API.

### 502 Bad Gateway Error

Gateway unreachable, failing, or misconfigured

- `detail` (string, required) — Human-readable error message returned by the API.

### 504 Gateway Timeout Error

Gateway timed out

- `detail` (string, required) — Human-readable error message returned by the API.

## Types

### LocationSummary

One location with EVSE and connector rollups, for maps and lists.

- `uid` (string, required)
- `country_code` (string, required)
- `party_id` (string, required)
- `location_id` (string, required)
- `source` (string, required)
- `evse_count` (integer, required)
- `available_count` (integer, required)
- `connector_standards` (list of string, required)
- `tariff_ids` (list of string, required)
- `name` (string, optional, nullable)
- `address` (string, optional, nullable)
- `city` (string, optional, nullable)
- `country` (string, optional, nullable)
- `latitude` (double, optional, nullable)
- `longitude` (double, optional, nullable)
- `max_power_kw` (double, optional, nullable)

### ValidationError

Why one field is invalid.

- `loc` (list of ValidationErrorLocItems, required) — Where the field is: ``body`` / ``query`` / ``path`` / ``header``, then its name.
- `msg` (string, required) — What is wrong, in English.
- `type` (string, required) — Machine-readable error code, e.g. ``missing``.
- `input` (any, optional) — The value that was sent.
- `ctx` (ValidationErrorCtx, optional) — Details of the rule that failed, e.g. `{"le": 200}`.

### ValidationErrorLocItems

### ValidationErrorCtx

Details of the rule that failed, e.g. `{"le": 200}`.

## Examples

**Response**

```json
{
  "data": [
    {
      "uid": "3f2b8c1d-6e4a-4b7f-9c2d-8a1e5f0b7c34",
      "country_code": "NL",
      "party_id": "ABC",
      "location_id": "LOC-AMS-001",
      "source": "PARTNER_OCPI",
      "evse_count": 4,
      "available_count": 3,
      "connector_standards": [
        "IEC_62196_T2_COMBO"
      ],
      "tariff_ids": [
        "TARIFF-DC-FAST"
      ],
      "name": "Amsterdam Zuid",
      "address": "Strawinskylaan 1",
      "city": "Amsterdam",
      "country": "NLD",
      "latitude": 52.338,
      "longitude": 4.872,
      "max_power_kw": 150
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.ocpplab.io/emsp/locations/route"

querystring = {"polyline":"_p~iF~ps|U_ulLnnqC_mqNvxq`@","buffer_km":"2","min_power":"50"}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.ocpplab.io/emsp/locations/route?polyline=_p%7EiF%7Eps%7CU_ulLnnqC_mqNvxq%60%40&buffer_km=2&min_power=50';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.ocpplab.io/emsp/locations/route?polyline=_p%7EiF%7Eps%7CU_ulLnnqC_mqNvxq%60%40&buffer_km=2&min_power=50"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.ocpplab.io/emsp/locations/route?polyline=_p%7EiF%7Eps%7CU_ulLnnqC_mqNvxq%60%40&buffer_km=2&min_power=50")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.ocpplab.io/emsp/locations/route?polyline=_p%7EiF%7Eps%7CU_ulLnnqC_mqNvxq%60%40&buffer_km=2&min_power=50")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.ocpplab.io/emsp/locations/route?polyline=_p%7EiF%7Eps%7CU_ulLnnqC_mqNvxq%60%40&buffer_km=2&min_power=50', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.ocpplab.io/emsp/locations/route?polyline=_p%7EiF%7Eps%7CU_ulLnnqC_mqNvxq%60%40&buffer_km=2&min_power=50");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.ocpplab.io/emsp/locations/route?polyline=_p%7EiF%7Eps%7CU_ulLnnqC_mqNvxq%60%40&buffer_km=2&min_power=50")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```