> 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.

# List OCPI + OCPP location templates

GET https://api.ocpplab.io/ocpi/templates/locations

Return ready-to-use request body templates for creating an OCPI CPO location with OCPP charger metadata. Filter by ocpi_version, ocpp_version, or connector_type. The public API validates query filters with Pydantic, then the service layer reads the local template gallery from config JSON.

Reference: https://docs.ocpplab.io/api-reference/ocpi/templates/list

## Authentication

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

## Request

### Query parameters

- `ocpp_version` (enum, optional, nullable) — Filter to templates for one OCPP version.
  - Allowed values: `ocpp1.6`, `ocpp2.0.1`
- `ocpi_version` (enum, optional, nullable) — Filter to templates for one OCPI version.
  - Allowed values: `2.1.1`, `2.2.1`
- `connector_type` (string, optional, nullable) — Filter to templates whose charger connector_type matches.
- `include_all` (boolean, optional, default: false) — When false, return the recommended four OCPP×OCPI templates. When true, return the extended gallery.

## Response

### 200

Matching location templates and the applied filters.

- `count` (integer, required)
- `filters` (OcppTemplateFiltersResponse, required) — Filters echoed by the local template gallery.
- `templates` (list of OcppLocationTemplateResponse, required)

## Errors

### 400 Bad Request Error

Invalid template filter

- `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.

### 500 Internal Server Error

Template gallery source failed

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

## Types

### OcppTemplateFiltersResponse

Filters echoed by the local template gallery.

- `ocpp_version` (string, optional, nullable)
- `ocpi_version` (string, optional, nullable)
- `connector_type` (string, optional, nullable)
- `include_all` (boolean, optional, default: false)

### OcppLocationTemplateResponse

One ready-to-POST OCPP + OCPI location template.

- `name` (string, required)
- `slug` (string, required)
- `description` (string, required)
- `cpo_name` (string, required)
- `cpo_slug` (string, required)
- `party_id` (string, required)
- `ocpp_version` (string, required)
- `ocpi_version` (string, required)
- `connector_type` (string, required)
- `body` (map from string to any, required) — Request body directly usable with the OCPP + OCPI create endpoint.

### 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
{
  "count": 0,
  "filters": {
    "connector_type": "NO_MATCHING_CONNECTOR",
    "include_all": false
  },
  "templates": []
}
```

**SDK Code**

```python
import requests

url = "https://api.ocpplab.io/ocpi/templates/locations"

querystring = {"connector_type":"NO_MATCHING_CONNECTOR"}

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

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

print(response.json())
```

```javascript
const url = 'https://api.ocpplab.io/ocpi/templates/locations?connector_type=NO_MATCHING_CONNECTOR';
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/ocpi/templates/locations?connector_type=NO_MATCHING_CONNECTOR"

	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/ocpi/templates/locations?connector_type=NO_MATCHING_CONNECTOR")

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/ocpi/templates/locations?connector_type=NO_MATCHING_CONNECTOR")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.ocpplab.io/ocpi/templates/locations?connector_type=NO_MATCHING_CONNECTOR', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.ocpplab.io/ocpi/templates/locations?connector_type=NO_MATCHING_CONNECTOR");
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/ocpi/templates/locations?connector_type=NO_MATCHING_CONNECTOR")! 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()
```