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

# Start session

POST https://host.com/ocpp/commands/start-session
Content-Type: application/json

Trigger a full auto-start sequence: plug in, authorize with `id_tag`, and begin a transaction. `duration_seconds` sets a time limit after which the session stops automatically. `target_energy_kwh` sets an energy limit that triggers an auto-stop when reached. Targets a single charger, selected chargers in a location, or all chargers in a location.

Reference: https://docs.ocpplab.com/api-reference/ocpplab-gateway-api/charger-operations/commands/start-session

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: OCPPLab SDK
  version: 1.0.0
paths:
  /ocpp/commands/start-session:
    post:
      operationId: start-session
      summary: Start session
      description: >-
        Trigger a full auto-start sequence: plug in, authorize with `id_tag`,
        and begin a transaction. `duration_seconds` sets a time limit after
        which the session stops automatically. `target_energy_kwh` sets an
        energy limit that triggers an auto-stop when reached. Targets a single
        charger, selected chargers in a location, or all chargers in a location.
      tags:
        - subpackage_commands
      parameters:
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '202':
          description: Command accepted and queued for the target charger(s)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LocationCommandResponse'
        '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'
        '404':
          description: Charger or location not found
          content:
            application/json:
              schema:
                description: Any type
        '422':
          description: Invalid target — provide either charger_id or location_id, not both
          content:
            application/json:
              schema:
                description: Any type
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UnifiedStartSessionRequest'
servers:
  - url: https://host.com
components:
  schemas:
    CommandTarget:
      type: object
      properties:
        charger_id:
          type:
            - string
            - 'null'
          description: Target a single charger by deployment ID.
        location_id:
          type:
            - string
            - 'null'
          description: Target all or selected chargers in a location.
        charger_ids:
          type:
            - array
            - 'null'
          items:
            type: string
          description: >-
            Subset of chargers within the location. Null = all chargers. Only
            valid with location_id.
      description: >-
        Target for a unified command.


        Provide exactly one of ``charger_id`` or ``location_id``.

        ``charger_ids`` is an optional subset filter — only valid with
        ``location_id``.


        Examples::

            {"charger_id": "dep-123"}
            {"location_id": "loc-456"}
            {"location_id": "loc-456", "charger_ids": ["dep-1", "dep-2"]}
      title: CommandTarget
    StartSessionCommandEvent:
      type: object
      properties:
        id_tag:
          type: string
        connector_id:
          type: integer
          default: 1
        duration_seconds:
          type:
            - integer
            - 'null'
          default: 300
        target_energy_kwh:
          type:
            - number
            - 'null'
          format: double
          default: 20
      required:
        - id_tag
      description: Command payload for start-session.
      title: StartSessionCommandEvent
    UnifiedStartSessionRequest:
      type: object
      properties:
        target:
          $ref: '#/components/schemas/CommandTarget'
        event:
          $ref: '#/components/schemas/StartSessionCommandEvent'
      required:
        - target
        - event
      description: Request for start-session (auto-start transaction) command.
      title: UnifiedStartSessionRequest
    QueuedCommandResponse:
      type: object
      properties:
        id:
          type: string
        event_type:
          type: string
        ocpp_version:
          type: string
        payload:
          type: object
          additionalProperties:
            description: Any type
          description: Command payload sent to the simulator queue.
      required:
        - id
        - event_type
        - ocpp_version
        - payload
      description: Queued command payload returned by simulator action endpoints.
      title: QueuedCommandResponse
    LocationQueuedCommandResult:
      type: object
      properties:
        charger_id:
          type: string
        identity:
          type: string
        command:
          $ref: '#/components/schemas/QueuedCommandResponse'
      required:
        - charger_id
        - identity
        - command
      description: One queued command result item for a location-scoped command request.
      title: LocationQueuedCommandResult
    LocationCommandFailure:
      type: object
      properties:
        identity:
          type:
            - string
            - 'null'
        error:
          type: string
      required:
        - error
      description: Failed charger result returned by location command endpoints.
      title: LocationCommandFailure
    LocationCommandResponse:
      type: object
      properties:
        targeted_count:
          type: integer
        queued_count:
          type: integer
        failed_count:
          type: integer
        results:
          type: array
          items:
            $ref: '#/components/schemas/LocationQueuedCommandResult'
        failed:
          type: array
          items:
            $ref: '#/components/schemas/LocationCommandFailure'
      required:
        - targeted_count
        - queued_count
        - failed_count
        - results
        - failed
      description: Response body returned by location-scoped charger command endpoints.
      title: LocationCommandResponse
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

```

## SDK Code Examples

```python Start-session queued for one targeted charger
import requests

url = "https://host.com/ocpp/commands/start-session"

payload = {
    "target": { "charger_id": "dep-789" },
    "event": {
        "id_tag": "EV-USER-1234",
        "connector_id": 2,
        "duration_seconds": 900,
        "target_energy_kwh": 15.5
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Start-session queued for one targeted charger
const url = 'https://host.com/ocpp/commands/start-session';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"target":{"charger_id":"dep-789"},"event":{"id_tag":"EV-USER-1234","connector_id":2,"duration_seconds":900,"target_energy_kwh":15.5}}'
};

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

```go Start-session queued for one targeted charger
package main

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

func main() {

	url := "https://host.com/ocpp/commands/start-session"

	payload := strings.NewReader("{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Start-session queued for one targeted charger
require 'uri'
require 'net/http'

url = URI("https://host.com/ocpp/commands/start-session")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}"

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

```java Start-session queued for one targeted charger
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://host.com/ocpp/commands/start-session")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}")
  .asString();
```

```php Start-session queued for one targeted charger
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://host.com/ocpp/commands/start-session', [
  'body' => '{
  "target": {
    "charger_id": "dep-789"
  },
  "event": {
    "id_tag": "EV-USER-1234",
    "connector_id": 2,
    "duration_seconds": 900,
    "target_energy_kwh": 15.5
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Start-session queued for one targeted charger
using RestSharp;

var client = new RestClient("https://host.com/ocpp/commands/start-session");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Start-session queued for one targeted charger
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "target": ["charger_id": "dep-789"],
  "event": [
    "id_tag": "EV-USER-1234",
    "connector_id": 2,
    "duration_seconds": 900,
    "target_energy_kwh": 15.5
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/ocpp/commands/start-session")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```

```python Start session — single charger (5 min / 20 kWh)
import requests

url = "https://host.com/ocpp/commands/start-session"

payload = {
    "target": { "charger_id": "dep-789" },
    "event": {
        "id_tag": "EV-USER-1234",
        "connector_id": 2,
        "duration_seconds": 900,
        "target_energy_kwh": 15.5
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Start session — single charger (5 min / 20 kWh)
const url = 'https://host.com/ocpp/commands/start-session';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"target":{"charger_id":"dep-789"},"event":{"id_tag":"EV-USER-1234","connector_id":2,"duration_seconds":900,"target_energy_kwh":15.5}}'
};

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

```go Start session — single charger (5 min / 20 kWh)
package main

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

func main() {

	url := "https://host.com/ocpp/commands/start-session"

	payload := strings.NewReader("{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Start session — single charger (5 min / 20 kWh)
require 'uri'
require 'net/http'

url = URI("https://host.com/ocpp/commands/start-session")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}"

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

```java Start session — single charger (5 min / 20 kWh)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://host.com/ocpp/commands/start-session")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}")
  .asString();
```

```php Start session — single charger (5 min / 20 kWh)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://host.com/ocpp/commands/start-session', [
  'body' => '{
  "target": {
    "charger_id": "dep-789"
  },
  "event": {
    "id_tag": "EV-USER-1234",
    "connector_id": 2,
    "duration_seconds": 900,
    "target_energy_kwh": 15.5
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Start session — single charger (5 min / 20 kWh)
using RestSharp;

var client = new RestClient("https://host.com/ocpp/commands/start-session");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Start session — single charger (5 min / 20 kWh)
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "target": ["charger_id": "dep-789"],
  "event": [
    "id_tag": "EV-USER-1234",
    "connector_id": 2,
    "duration_seconds": 900,
    "target_energy_kwh": 15.5
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/ocpp/commands/start-session")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```

```python Start session — all location chargers (1 hour / 50 kWh)
import requests

url = "https://host.com/ocpp/commands/start-session"

payload = {
    "target": { "charger_id": "dep-789" },
    "event": {
        "id_tag": "EV-USER-1234",
        "connector_id": 2,
        "duration_seconds": 900,
        "target_energy_kwh": 15.5
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Start session — all location chargers (1 hour / 50 kWh)
const url = 'https://host.com/ocpp/commands/start-session';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"target":{"charger_id":"dep-789"},"event":{"id_tag":"EV-USER-1234","connector_id":2,"duration_seconds":900,"target_energy_kwh":15.5}}'
};

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

```go Start session — all location chargers (1 hour / 50 kWh)
package main

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

func main() {

	url := "https://host.com/ocpp/commands/start-session"

	payload := strings.NewReader("{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Start session — all location chargers (1 hour / 50 kWh)
require 'uri'
require 'net/http'

url = URI("https://host.com/ocpp/commands/start-session")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}"

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

```java Start session — all location chargers (1 hour / 50 kWh)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://host.com/ocpp/commands/start-session")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}")
  .asString();
```

```php Start session — all location chargers (1 hour / 50 kWh)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://host.com/ocpp/commands/start-session', [
  'body' => '{
  "target": {
    "charger_id": "dep-789"
  },
  "event": {
    "id_tag": "EV-USER-1234",
    "connector_id": 2,
    "duration_seconds": 900,
    "target_energy_kwh": 15.5
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Start session — all location chargers (1 hour / 50 kWh)
using RestSharp;

var client = new RestClient("https://host.com/ocpp/commands/start-session");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Start session — all location chargers (1 hour / 50 kWh)
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "target": ["charger_id": "dep-789"],
  "event": [
    "id_tag": "EV-USER-1234",
    "connector_id": 2,
    "duration_seconds": 900,
    "target_energy_kwh": 15.5
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/ocpp/commands/start-session")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```

```python Start session — selected location chargers (30 min / 30 kWh)
import requests

url = "https://host.com/ocpp/commands/start-session"

payload = {
    "target": { "charger_id": "dep-789" },
    "event": {
        "id_tag": "EV-USER-1234",
        "connector_id": 2,
        "duration_seconds": 900,
        "target_energy_kwh": 15.5
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Start session — selected location chargers (30 min / 30 kWh)
const url = 'https://host.com/ocpp/commands/start-session';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"target":{"charger_id":"dep-789"},"event":{"id_tag":"EV-USER-1234","connector_id":2,"duration_seconds":900,"target_energy_kwh":15.5}}'
};

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

```go Start session — selected location chargers (30 min / 30 kWh)
package main

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

func main() {

	url := "https://host.com/ocpp/commands/start-session"

	payload := strings.NewReader("{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Start session — selected location chargers (30 min / 30 kWh)
require 'uri'
require 'net/http'

url = URI("https://host.com/ocpp/commands/start-session")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}"

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

```java Start session — selected location chargers (30 min / 30 kWh)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://host.com/ocpp/commands/start-session")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}")
  .asString();
```

```php Start session — selected location chargers (30 min / 30 kWh)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://host.com/ocpp/commands/start-session', [
  'body' => '{
  "target": {
    "charger_id": "dep-789"
  },
  "event": {
    "id_tag": "EV-USER-1234",
    "connector_id": 2,
    "duration_seconds": 900,
    "target_energy_kwh": 15.5
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Start session — selected location chargers (30 min / 30 kWh)
using RestSharp;

var client = new RestClient("https://host.com/ocpp/commands/start-session");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"target\": {\n    \"charger_id\": \"dep-789\"\n  },\n  \"event\": {\n    \"id_tag\": \"EV-USER-1234\",\n    \"connector_id\": 2,\n    \"duration_seconds\": 900,\n    \"target_energy_kwh\": 15.5\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Start session — selected location chargers (30 min / 30 kWh)
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "target": ["charger_id": "dep-789"],
  "event": [
    "id_tag": "EV-USER-1234",
    "connector_id": 2,
    "duration_seconds": 900,
    "target_energy_kwh": 15.5
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/ocpp/commands/start-session")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```