Sessions
Charging session data and meter values
GET /sessions List charging sessions
Parameters
Responses
401 Missing or invalid API key application/problem+json
Request example
curl -X GET "https://api.ampr.dev/v1/sessions" \
-H "Authorization: Bearer $AMPR_API_KEY"
const res = await fetch('https://api.ampr.dev/v1/sessions', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
},
});
const data = await res.json();
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
Responses
401 Missing or invalid API key application/problem+json
404 Resource not found application/problem+json
Request example
curl -X GET "https://api.ampr.dev/v1/sessions/ses_example" \
-H "Authorization: Bearer $AMPR_API_KEY"
const res = await fetch('https://api.ampr.dev/v1/sessions/ses_example', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
},
});
const data = await res.json();
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
Request body
Responses
200 Reference already attached (idempotent no-op)
400 Invalid request parameters application/problem+json
401 Missing or invalid API key application/problem+json
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
404 Resource not found application/problem+json
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"
}'
const res = await fetch('https://api.ampr.dev/v1/sessions/ses_example/payment-reference', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"payment_reference": "pi_3QabcXYZ",
"payment_provider": "stripe"
}),
});
const data = await res.json();
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.