# Chargers

## GET /api/chargers/:id

Retrieve detailed information about a specific charger by its internal ID, including its ports, connection status, and any ongoing charging sessions.

### Parameters

* `id` (path parameter): The internal ID of the charger

### Response

The JSON response will contain a `data` field with the charger information.

```ts
{
  data: {
    id: number;
    name: string;
    manufacturer: string | null;
    model: string | null;
    serialNumber: string | null;
    firmwareVersion: string | null;
    latitude: number | null;
    longitude: number | null;
    externalId: string | null;
    ocppId: string | null;
    type: string; // One of: "DCFC", "Level 2"
    powerSharing: boolean; // true if the charger has more than one port (power-sharing enabled)

    // null if the charger has never connected to Flipturn
    connectionStatus: {
      status: string; // e.g. "Connected", "Disconnected"
      timestamp: string; // ISO 8601 format
    } | null;
    numberOfPorts: number;
    ports: {
      id: number;
      name: string;
      portNumber: number;
      maximumPowerKw: number | null;
      // CCS1, J1772, or NACS
      connectorType: string;
      // null if the port has never sent an OCPP status
      ocppStatus: {
        status: string; // e.g. "Available", "Charging", "Faulted"
        timestamp: string; // ISO 8601 format
        errorCode: string; // OCPP error code, e.g. "NoError", "ConnectorLockFailure"
        vendorErrorCode: string | null; // Vendor-specific error code
        info: string | null; // Additional error information
      } | null;

      // Information about any ongoing charging session -- will be null if no charging session is
      // currently happening on this port
      currentChargingSession: {
        id: number;
        startTime: string; // ISO 8601 format
        socStartPercent: number | null;
        energyDeliveredKwh: number;
        ocppIdTag: string | null;
        ocppTransactionId: number | null;
        // Latest meter readings from the charging session
        latestReadings: {
          powerKw: {
            value: number;
            timestamp: string; // ISO 8601 format
          } | null;
          currentA: {
            value: number;
            timestamp: string; // ISO 8601 format
          } | null;
          socPercent: {
            value: number;
            timestamp: string; // ISO 8601 format
          } | null;
          voltage: {
            value: number;
            timestamp: string; // ISO 8601 format
          } | null;
        };
        vehicle: {
          id: number;
          make: string | null;
          model: string | null;
          name: string | null;
          vin: string | null;
        } | null;
        rfid: {
          id: number;
          name: string;
        } | null;
        customer: {
          name: string;
        } | null;
      } | null;
    }[];
    site: {
      id: number;
      name: string;
      address: string | null;
      timezone: string; // IANA format
    };
  };
}
```

### Example request and response

Request by internal ID:

```sh
curl "https://api.getflipturn.com/api/chargers/123" -H "Authorization: Bearer {api_key}"
```

Response:

```js
{
  "data": {
    "id": 123,
    "name": "Test Charger",
    "manufacturer": "ABB",
    "model": "Terra 184",
    "serialNumber": "1234-5678",
    "firmwareVersion": "1.5.4.4",
    "latitude": 33.7701,
    "longitude": -118.1937,
    "externalId": "STATION-001",
    "ocppId": "CHARGER-001",
    "type": "DCFC",
    "powerSharing": true,
    "connectionStatus": {
      "status": "Connected",
      "timestamp": "2025-01-01T12:00:00.000Z"
    },
    "numberOfPorts": 2,
    "ports": [
      {
        "id": 1,
        "name": "Port 1",
        "portNumber": 1,
        "maximumPowerKw": 180,
        "connectorType": "CCS1",
        "ocppStatus": {
          "status": "Available",
          "timestamp": "2025-01-01T12:00:00.000Z",
          "errorCode": "NoError",
          "vendorErrorCode": null,
          "info": null
        },
        "currentChargingSession": null
      },
      {
        "id": 2,
        "name": "Port 2",
        "portNumber": 2,
        "maximumPowerKw": 180,
        "connectorType": "CCS1",
        "ocppStatus": {
          "status": "Charging",
          "timestamp": "2025-01-01T11:45:00.000Z",
          "errorCode": "NoError",
          "vendorErrorCode": null,
          "info": null
        },
        "currentChargingSession": {
          "id": 456,
          "startTime": "2025-01-01T11:30:00.000Z",
          "socStartPercent": 20,
          "energyDeliveredKwh": 10.5,
          "ocppIdTag": "test-tag",
          "ocppTransactionId": 789,
          "latestReadings": {
            "powerKw": {
              "value": 50,
              "timestamp": "2025-01-01T11:45:00.000Z"
            },
            "currentA": {
              "value": 100,
              "timestamp": "2025-01-01T11:45:00.000Z"
            },
            "socPercent": {
              "value": 35,
              "timestamp": "2025-01-01T11:45:00.000Z"
            },
            "voltage": {
              "value": 400,
              "timestamp": "2025-01-01T11:45:00.000Z"
            }
          },
          "vehicle": {
            "id": 22541553,
            "make": "Tesla",
            "model": "Model 3",
            "name": "9876",
            "vin": "demo-vin-0"
          },
          "rfid": {
            "id": 1,
            "name": "Employee Card"
          },
          "customer": {
            "name": "Test Customer"
          }
        }
      }
    ],
    "site": {
      "id": 1,
      "name": "Site 1",
      "address": "1234 Fake St, Long Beach, CA 90802",
      "timezone": "America/Los_Angeles"
    }
  }
}
```

## GET /api/chargers/by-external-id/:id

Retrieve detailed information about a specific charger by its external ID (network station ID), including its ports, connection status, and any ongoing charging sessions.

### Parameters

* `id` (path parameter): The external ID (network station ID) of the charger

### Response

The JSON response will contain a `data` field with the charger information. The response structure is identical to the GET /api/chargers/:id endpoint.

### Example request

```sh
curl "https://api.getflipturn.com/api/chargers/by-external-id/STATION-001" -H "Authorization: Bearer {api_key}"
```

The response will be the same as for the `GET /api/chargers/:id` endpoint.

## GET /api/chargers/by-ocpp-id/:id

Retrieve detailed information about a specific charger by its OCPP identifier, including its ports, connection status, and any ongoing charging sessions.

### Parameters

* `id` (path parameter): The OCPP identifier of the charger

### Response

The JSON response will contain a `data` field with the charger information. The response structure is identical to the GET /api/chargers/:id endpoint.

### Example request

```sh
curl "https://api.getflipturn.com/api/chargers/by-ocpp-id/CHARGER-001" -H "Authorization: Bearer {api_key}"
```

The response will be the same as for the `GET /api/chargers/:id` endpoint.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api-docs.getflipturn.com/chargers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
