ampr docs

Sessions

Charging session data and meter values

GET /sessions List charging sessions

Parameters

Name In Type Required Description
page query integer
per_page query integer
charger_id query string
start_date query string format: date-time
end_date query string format: date-time
status query enum
  • active
  • completed
  • invalid

Responses

200 Session list

PropertyTypeRequiredDescription
dataarray<Session>
PropertyTypeRequiredDescription
idstringrequired
charger_idstringrequired
socket_idstringrequired
token_idstringReference to the driver token (`tokens` resource) that authorized the session. Replaces the former raw `id_tag` — the raw card/app identifier is never exposed on a session and lives only in `tokens.uid` (GDPR data minimisation). BREAKING change from `id_tag`.
statusenum
  • active
  • completed
  • invalid
required
start_timestringformat: date-timerequired
end_timestringnullableformat: date-time
meter_startintegerMeter reading at session start (Wh)
meter_stopintegernullableMeter reading at session end (Wh)
stop_reasonenumnullable
  • EVDisconnected
  • Remote
  • Local
  • PowerLoss
  • Reboot
  • Other
total_energy_whintegernullableTotal energy consumed (meter_stop - meter_start)
duration_secondsintegernullable
meter_valuesarray<MeterValue>
PropertyTypeRequiredDescription
timestampstringformat: date-timerequired
energy_whintegernullableCumulative energy delivered (Wh)
power_wnumbernullableInstantaneous power (W)
current_anumbernullableCurrent (Amps)
voltage_vnumbernullableVoltage (V)
soc_percentintegernullableState of charge (0-100)
cdr_idstringnullable
paginationPagination
PropertyTypeRequiredDescription
totalintegerrequired
pageintegerrequired
per_pageintegerrequired
has_morebooleanrequired

401 Missing or invalid API key application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X GET "https://api.ampr.dev/v1/sessions" \
  -H "Authorization: Bearer $AMPR_API_KEY"
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.

GET /sessions/{session_id} Get session detail with meter values

Parameters

Name In Type Required Description
session_id path string required

Responses

200 Session detail

PropertyTypeRequiredDescription
dataSession
PropertyTypeRequiredDescription
idstringrequired
charger_idstringrequired
socket_idstringrequired
token_idstringReference to the driver token (`tokens` resource) that authorized the session. Replaces the former raw `id_tag` — the raw card/app identifier is never exposed on a session and lives only in `tokens.uid` (GDPR data minimisation). BREAKING change from `id_tag`.
statusenum
  • active
  • completed
  • invalid
required
start_timestringformat: date-timerequired
end_timestringnullableformat: date-time
meter_startintegerMeter reading at session start (Wh)
meter_stopintegernullableMeter reading at session end (Wh)
stop_reasonenumnullable
  • EVDisconnected
  • Remote
  • Local
  • PowerLoss
  • Reboot
  • Other
total_energy_whintegernullableTotal energy consumed (meter_stop - meter_start)
duration_secondsintegernullable
meter_valuesarray<MeterValue>
PropertyTypeRequiredDescription
timestampstringformat: date-timerequired
energy_whintegernullableCumulative energy delivered (Wh)
power_wnumbernullableInstantaneous power (W)
current_anumbernullableCurrent (Amps)
voltage_vnumbernullableVoltage (V)
soc_percentintegernullableState of charge (0-100)
cdr_idstringnullable

401 Missing or invalid API key application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

404 Resource not found application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X GET "https://api.ampr.dev/v1/sessions/ses_example" \
  -H "Authorization: Bearer $AMPR_API_KEY"
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.

POST /sessions/{session_id}/payment-reference Attach a payment reference to a session

Record a CPO-supplied PSP transaction reference against a session (before or during it). Requires the `operator` role or higher. Works whether or not the CDR exists yet — if the session's CDR is already generated the reference is linked to it immediately, otherwise it is linked when the CDR is generated. Idempotent per `(session, reference)`. The reference MUST be the CPO's own PSP id, never a driver identifier / OCPP idTag.

Parameters

Name In Type Required Description
session_id path string required

Request body

PropertyTypeRequiredDescription
payment_referencestringrequiredOpaque PSP transaction id from the CPO's own payment rails. Stored verbatim. MUST NOT be a driver identifier / OCPP idTag.
payment_providerstringrequiredThe PSP the reference belongs to (open set: payter | viva | stripe | other | any future provider).

Responses

200 Reference already attached (idempotent no-op)

PropertyTypeRequiredDescription
dataPaymentReference
PropertyTypeRequiredDescription
idstringrequired
session_idstringrequired
cdr_idstringnullableThe CDR the reference is linked to, once one exists.
payment_referencestringrequired
payment_providerstringrequired
created_atstringformat: date-timerequired

201 Reference attached

PropertyTypeRequiredDescription
dataPaymentReference
PropertyTypeRequiredDescription
idstringrequired
session_idstringrequired
cdr_idstringnullableThe CDR the reference is linked to, once one exists.
payment_referencestringrequired
payment_providerstringrequired
created_atstringformat: date-timerequired

400 Invalid request parameters application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

401 Missing or invalid API key application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

403 Authenticated but not authorized for this action (insufficient role) application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

404 Resource not found application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X POST "https://api.ampr.dev/v1/sessions/ses_example/payment-reference" \
  -H "Authorization: Bearer $AMPR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "payment_reference": "pi_3QabcXYZ",
    "payment_provider": "stripe"
  }'
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.