> For the complete documentation index, see [llms.txt](https://api-docs.getflipturn.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.getflipturn.com/reservations.md).

# Reservations

Reserve a charging port for a specific user (identified by an RFID tag or other token) so that the connector is blocked for all other users until the reservation expires or is cancelled.

Reservations use the OCPP `ReserveNow` and `CancelReservation` messages under the hood. Both OCPP 1.6 and OCPP 2.0.1 chargers are supported. The charger must support the Reservation profile; if it doesn't, the request will be rejected.

## POST /api/ocpp/reservations

Reserves a charging port. The reservation is active immediately and expires at `expiryDate`. Only the user with the matching `idTag` (or `parentIdTag` group) can start a session on the reserved connector.

### Request body

```ts
{
  portId: number;        // Flipturn charging port ID
  expiryDate: string;    // ISO 8601 datetime when the reservation expires
  idTag: string;         // Identifier of the user (RFID UID, token, etc). Max 20 characters.
  reservationId: number; // Unique integer identifier for this reservation (caller-assigned)
  parentIdTag?: string;  // Optional parent identifier for group reservations (OCPP 1.6 only)
  idTokenType?: string;  // Optional. OCPP 2.0.1 only. See below for valid values. Defaults to 'Central'.
}
```

**`idTokenType` values (OCPP 2.0.1 only):**

| Value        | Description                      |
| ------------ | -------------------------------- |
| `Central`    | Server-side identifier (default) |
| `eMAID`      | E-Mobility Account Identifier    |
| `ISO14443`   | RFID tag (ISO 14443)             |
| `ISO15693`   | RFID tag (ISO 15693)             |
| `KeyCode`    | Key code / PIN                   |
| `Local`      | Locally known identifier         |
| `MacAddress` | MAC address                      |

This field is ignored for OCPP 1.6 chargers.

### Response

```ts
{
  data: {
    status: 'Accepted' | 'Faulted' | 'Occupied' | 'Rejected' | 'Unavailable';
  }
}
```

| Status        | Meaning                                                                |
| ------------- | ---------------------------------------------------------------------- |
| `Accepted`    | Reservation has been made successfully                                 |
| `Faulted`     | The connector is faulted and cannot be reserved                        |
| `Occupied`    | The connector is currently in use                                      |
| `Rejected`    | The charger rejected the reservation (e.g. reservations not supported) |
| `Unavailable` | The connector is unavailable                                           |

### Example

**Request:**

```sh
curl -X POST "https://api.getflipturn.com/api/ocpp/reservations" \
  -H "Authorization: Bearer {api_key}" \
  -H "Content-Type: application/json" \
  -d '{
    "portId": 34,
    "expiryDate": "2026-04-01T14:00:00.000Z",
    "idTag": "RFID001",
    "reservationId": 1001
  }'
```

**Response:**

```json
{
  "data": {
    "status": "Accepted"
  }
}
```

## POST /api/ocpp/reservations/cancel

Cancels an active reservation on a charger.

### Request body

```ts
{
  chargerId: number;     // Flipturn charger ID
  reservationId: number; // The reservation ID that was used when creating the reservation
}
```

### Response

```ts
{
  data: {
    status: 'Accepted' | 'Rejected';
  }
}
```

| Status     | Meaning                                                            |
| ---------- | ------------------------------------------------------------------ |
| `Accepted` | Reservation was successfully cancelled                             |
| `Rejected` | The charger rejected the cancellation (e.g. reservation not found) |

### Example

**Request:**

```sh
curl -X POST "https://api.getflipturn.com/api/ocpp/reservations/cancel" \
  -H "Authorization: Bearer {api_key}" \
  -H "Content-Type: application/json" \
  -d '{
    "chargerId": 12,
    "reservationId": 1001
  }'
```

**Response:**

```json
{
  "data": {
    "status": "Accepted"
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://api-docs.getflipturn.com/reservations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
