API surface
The credential operations exist only when a writable vault backs the deployment. Otherwise the credential comes from the environment.
Authentication and tenancy
A consumer authenticates with an OAuth2 client-credentials token in
Authorization: Bearer. For every gated request the service asks the authorization server for an explicit allow. It never trusts an unverified claim. A scope has the shape scr:<resource>:<action>. See Access Manager.
The institution comes from the token claims, never from a body field, header, path, or query. A dedicated deployment fixes it per instance.
A missing token answers SCR-0201, and a missing scope SCR-0202. An unreachable authorization server answers SCR-1002, because the gate fails closed.
Idempotency
The two effectful operations accept an
X-Idempotency header. A retry inside a five-minute window replays the first outcome and pays no second tariff. A key reused with a different body answers SCR-0003. Without Redis the gate fails open, and a retry pays the tariff again.
Errors
Every failure answers
application/problem+json under RFC 9457, with the code, the status, and a trace id.
Events
Lerian SCR emits one event per terminal consultation through a transactional outbox. The audit row and the event commit together.
studio.lerian.br-scr.consulta.completed: the consultation returned an answer, a position or none.studio.lerian.br-scr.consulta.failed: the consultation returned no answer.
lerian.streaming.br-scr, and poison messages on lerian.streaming.br-scr.dlq. No variable sets the topic, so provision both. See Streaming Hub.
When an operator turns emission off, the dispatcher does not start. The rows stay pending and ship once a broker returns.
Integration conventions
- Correlation.
X-Request-IDcarries a UUID through logs, traces, and the audit trail. - Reference dates. Consultation ranges and audit filters use
AAAAMM, a six-digit year and month. The operational summary takes a date-time range instead. - Filters. The document filter takes 8 to 14 digits, matched through the blind index. Client type
1is an individual,2a company. - Pagination. The audit list takes an opaque
cursorand alimitfrom 1 to 200, default 50. - Coded fields. A coded field answers
{ code, description }, with a null description for an unknown code.

