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

# List charger logs

GET https://host.com/ocpp/chargers/{charger_id}/logs

Retrieve OCPP logs for one charger with optional date range and event filters.

Reference: https://docs.ocpplab.com/api-reference/ocpplab-gateway-api/core-resources/chargers/get-logs

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: OCPPLab SDK
  version: 1.0.0
paths:
  /ocpp/chargers/{charger_id}/logs:
    get:
      operationId: get-logs
      summary: List charger logs
      description: >-
        Retrieve OCPP logs for one charger with optional date range and event
        filters.
      tags:
        - subpackage_chargers
      parameters:
        - name: charger_id
          in: path
          description: >-
            Internal charger deployment identifier returned by charger CRUD
            endpoints. Use charger identity for simulator and control endpoints.
          required: true
          schema:
            type: string
        - name: start_date
          in: query
          description: Optional inclusive start timestamp for charger logs.
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: end_date
          in: query
          description: Optional inclusive end timestamp for charger logs.
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: event
          in: query
          description: >-
            Optional OCPP action filter such as `Authorize` or
            `BootNotification`.
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: limit
          in: query
          description: >-
            Maximum number of charger logs to return. The maximum accepted value
            is 1000.
          required: false
          schema:
            type: integer
            default: 1000
        - name: offset
          in: query
          description: Zero-based offset into the filtered charger log result set.
          required: false
          schema:
            type: integer
            default: 0
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Charger logs retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChargerLogListResponse'
        '401':
          description: Missing or invalid bearer token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorResponse'
        '403':
          description: Insufficient permissions or missing required claims
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorResponse'
servers:
  - url: https://host.com
components:
  schemas:
    ChargerLogEntry:
      type: object
      properties:
        direction:
          type: string
        action:
          type: string
        message:
          type:
            - string
            - 'null'
        timestamp:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - direction
        - action
      description: One OCPP log entry returned by the charger logs endpoint.
      title: ChargerLogEntry
    ChargerLogListResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ChargerLogEntry'
        total:
          type: integer
        limit:
          type: integer
        offset:
          type: integer
      required:
        - data
        - total
        - limit
        - offset
      description: Paginated response returned by the charger logs endpoint.
      title: ChargerLogListResponse
    HttpErrorResponse:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message returned by the API.
      required:
        - detail
      description: Standard HTTP error payload returned by the API.
      title: HttpErrorResponse
    ValidationErrorLocItems:
      oneOf:
        - type: string
        - type: integer
      title: ValidationErrorLocItems
    ValidationErrorCtx:
      type: object
      properties: {}
      title: ValidationErrorCtx
    ValidationError:
      type: object
      properties:
        loc:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorLocItems'
        msg:
          type: string
        type:
          type: string
        input:
          description: Any type
        ctx:
          $ref: '#/components/schemas/ValidationErrorCtx'
      required:
        - loc
        - msg
        - type
      title: ValidationError
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
      title: HTTPValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

```

## SDK Code Examples

```python Newest charger logs
import requests

url = "https://host.com/ocpp/chargers/dep-123/logs"

querystring = {"start_date":"2026-04-09T00:00:00Z","end_date":"2026-04-09T23:59:59Z","event":"BootNotification","limit":"1000","offset":"0"}

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

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

print(response.json())
```

```javascript Newest charger logs
const url = 'https://host.com/ocpp/chargers/dep-123/logs?start_date=2026-04-09T00%3A00%3A00Z&end_date=2026-04-09T23%3A59%3A59Z&event=BootNotification&limit=1000&offset=0';
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 Newest charger logs
package main

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

func main() {

	url := "https://host.com/ocpp/chargers/dep-123/logs?start_date=2026-04-09T00%3A00%3A00Z&end_date=2026-04-09T23%3A59%3A59Z&event=BootNotification&limit=1000&offset=0"

	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 Newest charger logs
require 'uri'
require 'net/http'

url = URI("https://host.com/ocpp/chargers/dep-123/logs?start_date=2026-04-09T00%3A00%3A00Z&end_date=2026-04-09T23%3A59%3A59Z&event=BootNotification&limit=1000&offset=0")

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 Newest charger logs
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://host.com/ocpp/chargers/dep-123/logs?start_date=2026-04-09T00%3A00%3A00Z&end_date=2026-04-09T23%3A59%3A59Z&event=BootNotification&limit=1000&offset=0")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://host.com/ocpp/chargers/dep-123/logs?start_date=2026-04-09T00%3A00%3A00Z&end_date=2026-04-09T23%3A59%3A59Z&event=BootNotification&limit=1000&offset=0', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Newest charger logs
using RestSharp;

var client = new RestClient("https://host.com/ocpp/chargers/dep-123/logs?start_date=2026-04-09T00%3A00%3A00Z&end_date=2026-04-09T23%3A59%3A59Z&event=BootNotification&limit=1000&offset=0");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Newest charger logs
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/ocpp/chargers/dep-123/logs?start_date=2026-04-09T00%3A00%3A00Z&end_date=2026-04-09T23%3A59%3A59Z&event=BootNotification&limit=1000&offset=0")! 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()
```