Register an offline device
const url = 'http://localhost:8080/v1/offline/devices';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"owner_account":"2010:cust-hana","public_key":"03ca16e9076330c0c89ff8738477b10113a8d324b21e95863ef1f442035b1203c1","label":"Hana\'s phone","attestation":{"type":"none"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/v1/offline/devices \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "owner_account": "2010:cust-hana", "public_key": "03ca16e9076330c0c89ff8738477b10113a8d324b21e95863ef1f442035b1203c1", "label": "Hana'\''s phone", "attestation": { "type": "none" } }'Registers a payer device’s P-256 public key for a customer wallet and returns its device certificate, signed by the issuer key (protocol §5). The attestation decides the tier: until a card chip is chosen and Android Key Attestation is verified, only none is accepted, which earns tier C if the client has enabled it. The public key identifies the request: registering it again with the same details returns the device (200, Idempotent-Replayed: true).
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The owner’s customer wallet (2010), by ID or chart reference.
A compressed P-256 public key (SEC1, 33 bytes), in lower-case hex.
object
none earns tier C. card and android are refused as attestation_unsupported until they are verified.
Example
{ "owner_account": "2010:cust-hana", "public_key": "03ca16e9076330c0c89ff8738477b10113a8d324b21e95863ef1f442035b1203c1", "label": "Hana's phone", "attestation": { "type": "none" }}Responses
Section titled “Responses”The device, registered earlier with the same details.
object
An offline device ID.
An account ID.
A compressed P-256 public key (SEC1, 33 bytes), in lower-case hex.
The first counter the device’s next voucher authorises, at the least: it rises with every receipt recorded and every voucher issued.
object
The exact bytes signed, in lower-case hex (protocol §3).
An ECDSA P-256 signature, r || s with low s, in lower-case hex.
Example
{ "tier": "A", "attestation": "none", "status": "active"}The device and its certificate.
object
An offline device ID.
An account ID.
A compressed P-256 public key (SEC1, 33 bytes), in lower-case hex.
The first counter the device’s next voucher authorises, at the least: it rises with every receipt recorded and every voucher issued.
object
The exact bytes signed, in lower-case hex (protocol §3).
An ECDSA P-256 signature, r || s with low s, in lower-case hex.
Example
{ "id": "0192f3c4-0000-7000-8000-000000000d01", "owner_account": "0192f3c4-0000-7000-8000-000000000002", "public_key": "03ca16e9076330c0c89ff8738477b10113a8d324b21e95863ef1f442035b1203c1", "key_id": "a2bfef699d293e97", "tier": "C", "attestation": "none", "label": "Hana's phone", "status": "active", "status_reason": null, "next_counter": 1, "certificate": { "body": "6d657a6765622e6f66666c696e652e6465766963652e763100", "signature": "abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab", "issuer_key_id": "8356ab979cb1fbd8", "issued_at": "2026-11-16T00:00:00Z", "valid_until": "2027-11-16T00:00:00Z" }}Headers
Section titled “Headers”The URL of the created resource.
Bad request
RFC 9457 Problem Details, with Mezgeb’s stable code.
object
urn:mezgeb:problem:<code>.
This occurrence: urn:uuid:<request id>.
A stable error code. Never renumbered or reused; see docs/api/errors.md.
The posting rule (1001–1012) or template rule (2001–2022) that refused the request.
The zero-based line of the entry at fault.
The template role at fault.
The amount or metadata key at fault.
For invalid_request: each field at fault.
object
A JSON Pointer into the request body.
Examples
invalid_request
{ "type": "urn:mezgeb:problem:invalid_request", "title": "The request is malformed", "status": 400, "code": "invalid_request", "detail": "The request is malformed.", "errors": [ { "pointer": "/amounts/amount", "detail": "\"10.255\" has more decimal places than ETB allows" } ], "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}idempotency_key_required
{ "type": "urn:mezgeb:problem:idempotency_key_required", "title": "An Idempotency-Key header is required", "status": 400, "code": "idempotency_key_required", "detail": "An Idempotency-Key header is required.", "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}Unauthenticated
RFC 9457 Problem Details, with Mezgeb’s stable code.
object
urn:mezgeb:problem:<code>.
This occurrence: urn:uuid:<request id>.
A stable error code. Never renumbered or reused; see docs/api/errors.md.
The posting rule (1001–1012) or template rule (2001–2022) that refused the request.
The zero-based line of the entry at fault.
The template role at fault.
The amount or metadata key at fault.
For invalid_request: each field at fault.
object
A JSON Pointer into the request body.
Examples
unauthenticated
{ "type": "urn:mezgeb:problem:unauthenticated", "title": "Authentication is required", "status": 401, "code": "unauthenticated", "detail": "Authentication is required.", "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}Forbidden
RFC 9457 Problem Details, with Mezgeb’s stable code.
object
urn:mezgeb:problem:<code>.
This occurrence: urn:uuid:<request id>.
A stable error code. Never renumbered or reused; see docs/api/errors.md.
The posting rule (1001–1012) or template rule (2001–2022) that refused the request.
The zero-based line of the entry at fault.
The template role at fault.
The amount or metadata key at fault.
For invalid_request: each field at fault.
object
A JSON Pointer into the request body.
Examples
forbidden
{ "type": "urn:mezgeb:problem:forbidden", "title": "The caller may not do this", "status": 403, "code": "forbidden", "detail": "The caller may not do this.", "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}The key is registered with other details
RFC 9457 Problem Details, with Mezgeb’s stable code.
object
urn:mezgeb:problem:<code>.
This occurrence: urn:uuid:<request id>.
A stable error code. Never renumbered or reused; see docs/api/errors.md.
The posting rule (1001–1012) or template rule (2001–2022) that refused the request.
The zero-based line of the entry at fault.
The template role at fault.
The amount or metadata key at fault.
For invalid_request: each field at fault.
object
A JSON Pointer into the request body.
Examples
public_key_registered
{ "type": "urn:mezgeb:problem:public_key_registered", "title": "The public key is registered with other details", "status": 409, "code": "public_key_registered", "detail": "this public key is already registered with other details", "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}The device was refused
RFC 9457 Problem Details, with Mezgeb’s stable code.
object
urn:mezgeb:problem:<code>.
This occurrence: urn:uuid:<request id>.
A stable error code. Never renumbered or reused; see docs/api/errors.md.
The posting rule (1001–1012) or template rule (2001–2022) that refused the request.
The zero-based line of the entry at fault.
The template role at fault.
The amount or metadata key at fault.
For invalid_request: each field at fault.
object
A JSON Pointer into the request body.
Examples
owner_not_a_wallet
{ "type": "urn:mezgeb:problem:owner_not_a_wallet", "title": "The owner account is not an open customer wallet", "status": 422, "code": "owner_not_a_wallet", "detail": "account 0192f3c4-0000-7000-8000-000000000001 is not an open customer wallet", "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}tier_disabled
{ "type": "urn:mezgeb:problem:tier_disabled", "title": "The client has not enabled this tier", "status": 422, "code": "tier_disabled", "detail": "tier C is not enabled", "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}attestation_unsupported
{ "type": "urn:mezgeb:problem:attestation_unsupported", "title": "This kind of attestation is not verified yet", "status": 422, "code": "attestation_unsupported", "detail": "card attestation is not verified yet; register with none for tier C.", "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}Rate limited
RFC 9457 Problem Details, with Mezgeb’s stable code.
object
urn:mezgeb:problem:<code>.
This occurrence: urn:uuid:<request id>.
A stable error code. Never renumbered or reused; see docs/api/errors.md.
The posting rule (1001–1012) or template rule (2001–2022) that refused the request.
The zero-based line of the entry at fault.
The template role at fault.
The amount or metadata key at fault.
For invalid_request: each field at fault.
object
A JSON Pointer into the request body.
Examples
rate_limited
{ "type": "urn:mezgeb:problem:rate_limited", "title": "Too many requests", "status": 429, "code": "rate_limited", "detail": "Too many requests.", "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}Headers
Section titled “Headers”Seconds to wait before retrying.
Internal error
RFC 9457 Problem Details, with Mezgeb’s stable code.
object
urn:mezgeb:problem:<code>.
This occurrence: urn:uuid:<request id>.
A stable error code. Never renumbered or reused; see docs/api/errors.md.
The posting rule (1001–1012) or template rule (2001–2022) that refused the request.
The zero-based line of the entry at fault.
The template role at fault.
The amount or metadata key at fault.
For invalid_request: each field at fault.
object
A JSON Pointer into the request body.
Examples
internal_error
{ "type": "urn:mezgeb:problem:internal_error", "title": "Internal error", "status": 500, "code": "internal_error", "detail": "Internal error.", "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}template_defect (2013)
{ "type": "urn:mezgeb:problem:template_defect", "title": "The template books a role it does not declare", "status": 500, "code": "template_defect", "rule": 2013, "detail": "The template books a role it does not declare.", "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}Unavailable, or offline payments are not configured
RFC 9457 Problem Details, with Mezgeb’s stable code.
object
urn:mezgeb:problem:<code>.
This occurrence: urn:uuid:<request id>.
A stable error code. Never renumbered or reused; see docs/api/errors.md.
The posting rule (1001–1012) or template rule (2001–2022) that refused the request.
The zero-based line of the entry at fault.
The template role at fault.
The amount or metadata key at fault.
For invalid_request: each field at fault.
object
A JSON Pointer into the request body.
Examples
offline_unavailable
{ "type": "urn:mezgeb:problem:offline_unavailable", "title": "Offline payments are not configured", "status": 503, "code": "offline_unavailable", "detail": "This ledger has no offline issuer key, so offline payments are off.", "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}busy
{ "type": "urn:mezgeb:problem:busy", "title": "The accounts are busy; retry later", "status": 503, "code": "busy", "detail": "An account stayed locked longer than the lock timeout. Retry after the Retry-After interval.", "instance": "urn:uuid:0192f3c4-0000-7000-8000-00000000abcd"}