Developers/Resources/Proxy configuration
Resource

Proxy configuration

Relay a charger's OCPP connection to another charging platform. Describe the target, switch the charger to it on its next reconnect, and roll it back.

API
CSMS v2
Endpoints
8

This page is for operators who move a charger to, or test it against, another charging platform, and for developers who script that. A proxy configuration tells Voltra where to relay a charger's OCPP connection and how to sign in there. The charger keeps the connection URL and credentials it already has; Voltra decides what answers it.

The examples read VOLTRA_KEY, VOLTRA_ORG, VOLTRA_PROJECT, and CONFIG_ID (the id of a configuration). All calls go to https://api.voltra.com/csms/v2.

01

How routing works

Two things are kept apart:

  • The configuration describes the target: its URL, the charger's ID there and how to authenticate. Creating or changing it does not change how the charger is handled.
  • The route is the switch. Activating it makes the charger's next WebSocket connection go to the target. Rolling it back makes the next connection come to Voltra again.

A route change never touches a connection that is open. It applies when the charger next connects, so reboot the charger or wait for it to reconnect. GET /proxy-configuration/{id}/route shows the route you asked for, with effective_on: "next_reconnect"; it does not say whether the charger has reconnected yet.

A route has a mode (local or proxy) and a generation, a counter that goes up on every activation and rollback. generation 0 with local means the route was never activated. activated_at and activated_by say when, and by which user or API key.

Voltra does not apply load management to a charger on a proxy route. Activating one removes the charger's open load management session; see Load management.

02

The configuration

FieldMeaning
idThe configuration's UUID.
charge_box_idThe charger. Set at creation and not changeable.
target_platform_identifierYour name for the target platform. Required.
target_websocket_urlWhere to connect. Required. See the rules below.
target_charge_box_idThe charger's ID on the target platform. It defaults to charge_box_id.
target_authentication_methodNone, Basic or ClientCertificate. Required.
target_auth_basic_passwordWrite only. Required with Basic. Never returned.
target_auth_client_cert_idThe ID of one of your organization's certificates, for ClientCertificate.
proxy_urlGenerated by Voltra. Read only.
routemode, generation, activated_at, activated_by. Returned by create, get and list.
inserted_at, updated_atTimestamps.

The create response also carries password, which is always an empty string. No proxy password is issued.

Target URL rules. A URL that breaks one is refused with 400 and a message under error.target_websocket_url.

  • It must start with wss://, have a host, and have no user name or password and no query string.
  • The host must not be localhost, end in .svc, .cluster.local or .internal, or be a loopback, private, link-local or carrier-grade NAT address.
  • It must not point at Voltra: voltra.com, voltra.sh and their subdomains are refused, and so is Voltra's own OCPP host. Activation answers 400 "refusing to create a proxy loop" for that last case.

Voltra lowercases the host, removes a trailing slash and removes a last path segment equal to the charger ID, then appends the target charger ID to the path when it connects. To place the ID elsewhere, put {charge_box_id} or {target_charge_box_id} in the URL; Voltra then does not append it. {organization_uuid} is also replaced.

Authentication. With Basic, Voltra signs in with the target charger ID as the user name and your password, which it stores encrypted. With ClientCertificate, the certificate ID must belong to your organization, otherwise the request is refused with "certificate not found for this organization". With None Voltra sends no credential; the charger's own credentials are never passed on.

03

Move a charger to a target and back

  1. Create the configuration.
curl -s -X POST "https://api.voltra.com/csms/v2/proxy-configuration" \
  -H "x-api-key: $VOLTRA_KEY" -H "x-organization-id: $VOLTRA_ORG" \
  -H "x-project-id: $VOLTRA_PROJECT" -H "content-type: application/json" \
  -d '{
    "charge_box_id": "CHARGER_001",
    "target_platform_identifier": "Other platform",
    "target_websocket_url": "wss://ocpp.example.com/v16",
    "target_authentication_method": "Basic",
    "target_auth_basic_password": "…"
  }'

The 201 response has proxy_configuration (with id and a route of mode: "local", generation: 0) and password: "". A second configuration with the same charger and target_platform_identifier is refused with 400.

  1. Activate the route: POST /proxy-configuration/$CONFIG_ID/route/activate, no body. The 200 response has route with mode: "proxy", generation: 1 and effective_on: "next_reconnect".
  2. Reconnect the charger. From then on its OCPP traffic goes to the target.
  3. To return, call POST /proxy-configuration/$CONFIG_ID/route/rollback. The route becomes local with the next generation, and the charger is handled by Voltra when it next connects. The configuration is kept.

Activation is refused with 409 while the charger has a transaction that started in the last 24 hours and has not stopped. The message lists the transaction IDs; retry when they finish. It is refused with 404 when the charger is archived or no longer exists in the project.

If a route's target stops passing the URL rules, or no longer matches its charger, Voltra handles the charger itself instead of refusing the connection.

04

Change and delete

  • PUT /proxy-configuration/{id} changes the target fields. Send only what changes; leave target_auth_basic_password out to keep the stored password. The response has the configuration without route; call getProxyRoute for that.
  • DELETE /proxy-configuration/{id} is refused with 409 while the configuration has an active route. Roll the route back first.
  • GET /proxy-configuration lists every configuration in the organization. It is not paged.
05

Headers and access

Send x-api-key, x-organization-id and x-project-id on every call. A key restricted to projects that sends no x-project-id gets 403 platform.project_required; a wrong or missing x-organization-id gets 401 platform.authentication_failed. See Fix 401 and 403 errors.

A key with no projects selected can be refused by the charger API with 401 "Invalid API key". Select the project on the key; see Fix 401 and 403 errors.

06

Errors

These calls use the charger API's error bodies; see Errors.

StatusWhen
400Create or update: a rule above is broken, a required field is missing, the charger is not found in the project (error.charge_box_id "charge box not found"), or the charger and name already have a configuration. Get one configuration: the ID is unknown. Activate: the target URL is not allowed or would loop back to Voltra.
404Update, delete, route read, activate or rollback: no configuration with that ID in your organization. Activate, route read and rollback also answer 404 when the charger does not exist in the project or is archived.
409Delete: the route is active. Activate: the charger has a transaction in progress.
07

Identifiers

id
The proxy configuration's UUID, assigned when you create it. Use it in every path.
charge_box_id
The OCPP identity of the charger the configuration belongs to. Create is refused with 400 and `error.charge_box_id` "charge box not found" when no charger with that OCPP identity exists in the project. An archived charger passes create, but activate, route read and rollback then answer 404.
target_platform_identifier
A name you give the target platform. A charger can have one configuration per name.
08

States

local
Voltra handles the charger's next OCPP connection. This is the state of every configuration until you activate it, and again after a rollback.
proxy
The charger's next OCPP connection is relayed to the target platform.
09

Endpoints

10

Used in flows

Not used in any flow yet.

11

Next steps

  • Charger: how a charger connects and is identified.
  • Errors: the error bodies.
Related