CDRs
Charge Detail Records (immutable billing receipts)
GET /cdrs List charge detail records
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 | ||
payment_reference | query | string | Return only CDRs reconciled to this CPO-supplied PSP transaction reference. Org-scoped; a reference may map to several CDRs (a booking spanning sessions), so more than one result is legitimate. | |
payment_provider | query | string | Return only CDRs with a reconciliation from this PSP (open set). |
Responses
200 CDR list
| Property | Type | Required | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | array<CDR> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pagination | Pagination | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
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(); GET /cdrs/{cdr_id} Get charge detail record
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
cdr_id | path | string | required |
Responses
200 CDR detail
| Property | Type | Required | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | CDR | A charge detail record. All `*_cents` amounts are integers in the currency's minor units per its ISO 4217 exponent (GBP 2, JPY 0, KWD 3), despite the `_cents` suffix. CDRs are immutable once created. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
404 Resource not found application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
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(); 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
cdr_id | path | string | required |
Request body
| Property | Type | Required | Description |
|---|---|---|---|
payment_reference | string | required | Opaque PSP transaction id from the CPO's own payment rails. Stored verbatim. MUST NOT be a driver identifier / OCPP idTag. |
payment_provider | string | required | The PSP the reference belongs to (open set: payter | viva | stripe | other | any future provider). |
Responses
200 Reference already attached (idempotent no-op)
| Property | Type | Required | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | PaymentReference | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
201 Reference attached
| Property | Type | Required | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | PaymentReference | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
400 Invalid request parameters application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
404 Resource not found application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
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(); 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
cdr_id | path | string | required |
Responses
200 Billing-decision audit record
| Property | Type | Required | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | object | required | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
404 Resource not found application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
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();