curl --request POST \
--url https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "My RFID key",
"keyIdentifier": "04A224B7C89280",
"contractId": "DE-8PS-C0AD21B13-Q",
"visualNumber": "DE*8PS*FR1RFK*4",
"enabled": true,
"whitelist": "NEVER"
}
'import requests
url = "https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys"
payload = {
"name": "My RFID key",
"keyIdentifier": "04A224B7C89280",
"contractId": "DE-8PS-C0AD21B13-Q",
"visualNumber": "DE*8PS*FR1RFK*4",
"enabled": True,
"whitelist": "NEVER"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'My RFID key',
keyIdentifier: '04A224B7C89280',
contractId: 'DE-8PS-C0AD21B13-Q',
visualNumber: 'DE*8PS*FR1RFK*4',
enabled: true,
whitelist: 'NEVER'
})
};
fetch('https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys', 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",
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([
'name' => 'My RFID key',
'keyIdentifier' => '04A224B7C89280',
'contractId' => 'DE-8PS-C0AD21B13-Q',
'visualNumber' => 'DE*8PS*FR1RFK*4',
'enabled' => true,
'whitelist' => 'NEVER'
]),
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"
payload := strings.NewReader("{\n \"name\": \"My RFID key\",\n \"keyIdentifier\": \"04A224B7C89280\",\n \"contractId\": \"DE-8PS-C0AD21B13-Q\",\n \"visualNumber\": \"DE*8PS*FR1RFK*4\",\n \"enabled\": true,\n \"whitelist\": \"NEVER\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My RFID key\",\n \"keyIdentifier\": \"04A224B7C89280\",\n \"contractId\": \"DE-8PS-C0AD21B13-Q\",\n \"visualNumber\": \"DE*8PS*FR1RFK*4\",\n \"enabled\": true,\n \"whitelist\": \"NEVER\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My RFID key\",\n \"keyIdentifier\": \"04A224B7C89280\",\n \"contractId\": \"DE-8PS-C0AD21B13-Q\",\n \"visualNumber\": \"DE*8PS*FR1RFK*4\",\n \"enabled\": true,\n \"whitelist\": \"NEVER\"\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": "NEVER",
"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"
}Create a charging key
Creates a new charging key for a specified user. Important notes: - The key will be created in an enabled state by default - Contract id, keyIdentifier and visualNumber must be provided.
curl --request POST \
--url https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "My RFID key",
"keyIdentifier": "04A224B7C89280",
"contractId": "DE-8PS-C0AD21B13-Q",
"visualNumber": "DE*8PS*FR1RFK*4",
"enabled": true,
"whitelist": "NEVER"
}
'import requests
url = "https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys"
payload = {
"name": "My RFID key",
"keyIdentifier": "04A224B7C89280",
"contractId": "DE-8PS-C0AD21B13-Q",
"visualNumber": "DE*8PS*FR1RFK*4",
"enabled": True,
"whitelist": "NEVER"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'My RFID key',
keyIdentifier: '04A224B7C89280',
contractId: 'DE-8PS-C0AD21B13-Q',
visualNumber: 'DE*8PS*FR1RFK*4',
enabled: true,
whitelist: 'NEVER'
})
};
fetch('https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys', 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",
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([
'name' => 'My RFID key',
'keyIdentifier' => '04A224B7C89280',
'contractId' => 'DE-8PS-C0AD21B13-Q',
'visualNumber' => 'DE*8PS*FR1RFK*4',
'enabled' => true,
'whitelist' => 'NEVER'
]),
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"
payload := strings.NewReader("{\n \"name\": \"My RFID key\",\n \"keyIdentifier\": \"04A224B7C89280\",\n \"contractId\": \"DE-8PS-C0AD21B13-Q\",\n \"visualNumber\": \"DE*8PS*FR1RFK*4\",\n \"enabled\": true,\n \"whitelist\": \"NEVER\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My RFID key\",\n \"keyIdentifier\": \"04A224B7C89280\",\n \"contractId\": \"DE-8PS-C0AD21B13-Q\",\n \"visualNumber\": \"DE*8PS*FR1RFK*4\",\n \"enabled\": true,\n \"whitelist\": \"NEVER\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{environment}.plugsurfing.com/drive/v1/users/{userId}/charging-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My RFID key\",\n \"keyIdentifier\": \"04A224B7C89280\",\n \"contractId\": \"DE-8PS-C0AD21B13-Q\",\n \"visualNumber\": \"DE*8PS*FR1RFK*4\",\n \"enabled\": true,\n \"whitelist\": \"NEVER\"\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": "NEVER",
"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"
}Authorizations
API key for authentication
Path Parameters
The unique identifier of the user who will own the new charging key
Body
request
Request payload to create a new charging key for a user.
Charging key identifier in hexadecimal, little-endian format with usually 8 or 14 characters.
"e0e03336"
Charging key contract id
"DE-9FS-C045DS363-E"
Identifier printed on the physical key
"DE-9FS-C045DS363-E"
Name of the Charging key
"SE6F1K2C3"
Indicates if the new charging key should be enabled or disabled.
true
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"
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"