curl --request PATCH \
--url https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "My RFID key updated",
"enabled": true,
"whitelist": "ALLOWED_OFFLINE"
}
'import requests
url = "https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier}"
payload = {
"name": "My RFID key updated",
"enabled": True,
"whitelist": "ALLOWED_OFFLINE"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'My RFID key updated', enabled: true, whitelist: 'ALLOWED_OFFLINE'})
};
fetch('https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier}', 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://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'My RFID key updated',
'enabled' => true,
'whitelist' => 'ALLOWED_OFFLINE'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier}"
payload := strings.NewReader("{\n \"name\": \"My RFID key updated\",\n \"enabled\": true,\n \"whitelist\": \"ALLOWED_OFFLINE\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.patch("https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My RFID key updated\",\n \"enabled\": true,\n \"whitelist\": \"ALLOWED_OFFLINE\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My RFID key updated\",\n \"enabled\": true,\n \"whitelist\": \"ALLOWED_OFFLINE\"\n}"
response = http.request(request)
puts response.read_body{
"keyId": "0eb7732d-eb7a-418c",
"referenceId": "DE*8PS*AD21B1*3",
"contractId": "DE-8PS-C0AD21B13-Q",
"name": "My RFID key",
"validFrom": "2022-01-24T11:25:54.210Z",
"validTo": "2032-01-24T11:25:54.210Z",
"type": "card",
"enabled": true,
"whitelist": "ALLOWED_OFFLINE",
"created": "2025-01-15T10:30:00Z",
"updated": "2025-01-15T10:30:00Z"
}{
"message": "Invalid request payload",
"details": [
"field X is required"
]
}{
"message": "Resource not found"
}{
"message": "Resource not found"
}{
"message": "Resource not found"
}Edit a charging key
Modify a charging key’s properties. You can change the key’s name and enable/disable it. Disabling a key immediately prevents it from being used for charging. Important notes: - Only non-null fields in the request are applied - Disabling a key takes effect immediately across all charging stations - Some CPOs cache key status, so in rare cases it may take a few minutes for the disable action to propagate - Name changes are purely cosmetic and don’t affect the key’s functionality
curl --request PATCH \
--url https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "My RFID key updated",
"enabled": true,
"whitelist": "ALLOWED_OFFLINE"
}
'import requests
url = "https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier}"
payload = {
"name": "My RFID key updated",
"enabled": True,
"whitelist": "ALLOWED_OFFLINE"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'My RFID key updated', enabled: true, whitelist: 'ALLOWED_OFFLINE'})
};
fetch('https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier}', 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://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'My RFID key updated',
'enabled' => true,
'whitelist' => 'ALLOWED_OFFLINE'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier}"
payload := strings.NewReader("{\n \"name\": \"My RFID key updated\",\n \"enabled\": true,\n \"whitelist\": \"ALLOWED_OFFLINE\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.patch("https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My RFID key updated\",\n \"enabled\": true,\n \"whitelist\": \"ALLOWED_OFFLINE\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys/{identifier}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My RFID key updated\",\n \"enabled\": true,\n \"whitelist\": \"ALLOWED_OFFLINE\"\n}"
response = http.request(request)
puts response.read_body{
"keyId": "0eb7732d-eb7a-418c",
"referenceId": "DE*8PS*AD21B1*3",
"contractId": "DE-8PS-C0AD21B13-Q",
"name": "My RFID key",
"validFrom": "2022-01-24T11:25:54.210Z",
"validTo": "2032-01-24T11:25:54.210Z",
"type": "card",
"enabled": true,
"whitelist": "ALLOWED_OFFLINE",
"created": "2025-01-15T10:30:00Z",
"updated": "2025-01-15T10:30:00Z"
}{
"message": "Invalid request payload",
"details": [
"field X is required"
]
}{
"message": "Resource not found"
}{
"message": "Resource not found"
}{
"message": "Resource not found"
}Authorizations
API key for authentication
Path Parameters
The unique identifier for the charging key - can be either the keyId (internal identifier) or contractId (roaming identifier)
The unique identifier of the user who owns the charging key
Body
request
Request payload to update mutable charging key attributes.
Display name assigned to the charging key.
Changing to the value that the key already has will result in OK response.
Defines whether the CPO may allow a session for this charging key when it cannot get a response from the EMP, or must always rely on realtime authorization from the EMP. Possible values: ALLOWED_OFFLINE, NEVER.
ALLOWED_OFFLINE, NEVER "ALLOWED_OFFLINE"
Response
OK
Represents a charging key assigned to a user account.
Identifier used for this charging key (uid in the case of a physical charging key)
"0eb7732d-eb7a-418c"
UTC timestamp when the charging key becomes valid.
"2022-01-24T11:25:54.210Z"
UTC timestamp when the charging key expires.
"2032-01-24T11:25:54.210Z"
Possible values include, but aren't limited to: 'tag', 'card', 'virtual', 'plug_and_charge'.
"card"
Indicates if the key can start a session or not
UTC timestamp when the charging key was created.
UTC timestamp when the charging key was last updated.
Visual number for RFID and virtual keys, Plug and Charge identifier (PCID )for plug_and_charge keys
"DE*8PS*AD21B1*3"
Identifier used in the context of roaming
"DE-8PS-C0AD21B13-Q"
Key name (usually set by end-users to name their keys when they have multiple ones).
"My RFID key"
Defines whether the CPO may allow a session for this charging key when it cannot get a response from the EMP, or must always rely on realtime authorization from the EMP. Possible values: ALLOWED_OFFLINE, NEVER.
ALLOWED_OFFLINE, NEVER "NEVER"