Start Public Charging Session
curl --request POST \
--url https://app.plugchoice.com/api/v3/public-charging/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"connector_id": 123,
"email": "<string>"
}
'import requests
url = "https://app.plugchoice.com/api/v3/public-charging/sessions"
payload = {
"code": "<string>",
"connector_id": 123,
"email": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: '<string>', connector_id: 123, email: '<string>'})
};
fetch('https://app.plugchoice.com/api/v3/public-charging/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.plugchoice.com/api/v3/public-charging/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'connector_id' => 123,
'email' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.plugchoice.com/api/v3/public-charging/sessions"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"connector_id\": 123,\n \"email\": \"<string>\"\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(string(body))
}HttpResponse<String> response = Unirest.post("https://app.plugchoice.com/api/v3/public-charging/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"connector_id\": 123,\n \"email\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.plugchoice.com/api/v3/public-charging/sessions")
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 \"code\": \"<string>\",\n \"connector_id\": 123,\n \"email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"session_token": "<string>",
"data": {
"status": "<string>",
"failure_reason": "<string>",
"connector_id": 123,
"connector_status": "<string>",
"charger": {
"public_code": "<string>",
"name": "<string>",
"online": true
},
"pricing": {
"currency": "<string>",
"price_per_kwh": 123,
"start_fee": 123
},
"amount_authorized": 123,
"energy_kwh": "<string>",
"cost_amount": 123,
"amount_captured": 123,
"tax_amount": 123,
"driver_email": "<string>",
"created_at": "<string>",
"authorized_at": "<string>",
"charging_started_at": "<string>",
"completed_at": "<string>",
"captured_at": "<string>"
},
"payment": {
"client_secret": "<string>",
"publishable_key": "<string>",
"stripe_account_id": "<string>"
}
}Public Charging
Start Public Charging Session
POST
/
v3
/
public-charging
/
sessions
Start Public Charging Session
curl --request POST \
--url https://app.plugchoice.com/api/v3/public-charging/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"connector_id": 123,
"email": "<string>"
}
'import requests
url = "https://app.plugchoice.com/api/v3/public-charging/sessions"
payload = {
"code": "<string>",
"connector_id": 123,
"email": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: '<string>', connector_id: 123, email: '<string>'})
};
fetch('https://app.plugchoice.com/api/v3/public-charging/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.plugchoice.com/api/v3/public-charging/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'connector_id' => 123,
'email' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.plugchoice.com/api/v3/public-charging/sessions"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"connector_id\": 123,\n \"email\": \"<string>\"\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(string(body))
}HttpResponse<String> response = Unirest.post("https://app.plugchoice.com/api/v3/public-charging/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"connector_id\": 123,\n \"email\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.plugchoice.com/api/v3/public-charging/sessions")
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 \"code\": \"<string>\",\n \"connector_id\": 123,\n \"email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"session_token": "<string>",
"data": {
"status": "<string>",
"failure_reason": "<string>",
"connector_id": 123,
"connector_status": "<string>",
"charger": {
"public_code": "<string>",
"name": "<string>",
"online": true
},
"pricing": {
"currency": "<string>",
"price_per_kwh": 123,
"start_fee": 123
},
"amount_authorized": 123,
"energy_kwh": "<string>",
"cost_amount": 123,
"amount_captured": 123,
"tax_amount": 123,
"driver_email": "<string>",
"created_at": "<string>",
"authorized_at": "<string>",
"charging_started_at": "<string>",
"completed_at": "<string>",
"captured_at": "<string>"
},
"payment": {
"client_secret": "<string>",
"publishable_key": "<string>",
"stripe_account_id": "<string>"
}
}Starts a public charging session on a charger’s connector and creates the Stripe pre-authorization. This endpoint does not require authentication and is rate limited to 3 requests per minute per IP address. Each charger also accepts a limited number of successful sessions per hour; exceeding it returns
429.
Returns 404 if the charger is unknown or does not have public charging available, 400 if the charger is offline, 422 if the connector is unknown, and 409 if the connector is unavailable.
The public code of the charger. Case-insensitive. Maximum 10 characters.
The connector ID to start charging on. Must be between 1 and 100.
The driver’s email address for the receipt. Optional. Must be a valid email, maximum 255 characters.
Response
Returns201 Created.
The session token. Use it as the
{token} path parameter to poll, confirm, stop, or cancel the session. Treat it as a credential.The session details.
Show session
Show session
The session status. One of
created, authorized, starting, charging, stopping, settling, captured, no_charge, expired, failed, abandoned, capture_failed, requires_review, refunded, written_off.The reason the session failed or was abandoned, if any. May be
null.The OCPP connector ID the session runs on.
The current OCPP status of the connector. One of
Available, Charging, Faulted, Finishing, Preparing, Reserved, SuspendedEV, SuspendedEVSE, Unavailable. May be null.The pre-authorized hold amount in the currency’s minor units. May be
null.The energy delivered in kWh, as a decimal string. While charging, this is an estimate from the latest meter value. May be
null.The running cost in the currency’s minor units, capped at the authorized amount. May be
null.The final amount captured in the currency’s minor units. May be
null.The tax portion of the captured amount in the currency’s minor units. May be
null.The driver’s receipt email. May be
null.ISO 8601 timestamp of when the session was created. May be
null.ISO 8601 timestamp of when the payment was authorized. May be
null.ISO 8601 timestamp of when charging started. May be
null.ISO 8601 timestamp of when charging completed. May be
null.ISO 8601 timestamp of when the payment was captured. May be
null.The Stripe payment context used to confirm the pre-authorization in the browser.
⌘I