CDRs
Charge Detail Records (immutable billing receipts)
GET /cdrs List charge detail records
Parameters
Responses
401 Missing or invalid API key application/problem+json
Request example
curl -X GET "https://api.ampr.dev/v1/cdrs" \
-H "Authorization: Bearer $AMPR_API_KEY"
const res = await fetch('https://api.ampr.dev/v1/cdrs', {
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 /cdrs/{cdr_id} Get charge detail record
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/cdrs/cdr_example" \
-H "Authorization: Bearer $AMPR_API_KEY"
const res = await fetch('https://api.ampr.dev/v1/cdrs/cdr_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 /cdrs/{cdr_id}/payment-reference Attach a payment reference to a CDR
Record a CPO-supplied PSP transaction reference against a CDR that already exists (a terminal often finalizes its settlement id after the session ends). Requires the `operator` role or higher. Idempotent per `(session, reference)`. The immutable CDR row is NEVER mutated — the reference is stored as a separate annotation. 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/cdrs/cdr_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/cdrs/cdr_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.
GET /cdrs/{cdr_id}/billing-decision Get the authoritative billing-decision audit record for a CDR
Regulator/auditor surface: an immutable, frame-traceable record of why this CDR billed the way it did. Returns the CURRENT decision for this CDR plus the full decision chain for its session (newest-first), so a correction (a superseding decision) is visible as history rather than silently replacing the original. Purely a read over immutable `billing_decisions` rows — deterministic, same input always returns the same output.
Parameters
Responses
200 Billing-decision audit record
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/cdrs/cdr_example/billing-decision" \
-H "Authorization: Bearer $AMPR_API_KEY"
const res = await fetch('https://api.ampr.dev/v1/cdrs/cdr_example/billing-decision', {
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.