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. With PLUGIN_AUTH_ENABLED=true, the authorization server decides every gated request. 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 require an
X-Idempotency header, and a request without it answers SCR-0004. A retry inside a five-minute window replays a 2xx or 4xx outcome and pays no second tariff. After a 5xx outcome the key is free, and a retry runs the operation again. A key reused with a different body answers SCR-0003. Without Redis both operations answer SCR-9002.
Errors
A failure answers
application/problem+json under RFC 9457, with the code and the status.
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 they ship after emission is back on and the service restarts.
Integration conventions
- Correlation.
X-Request-IDcarries a UUID through logs and traces. - 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.

