> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Consignado events

> Reference the domain events emitted and consumed by Lerian Consignado — Dataprev, including payload structure, CloudEvents topics, and delivery semantics.

The Lerian Consignado — Dataprev business surface is entirely event-driven. Averbação, detecting an auction (leilão) win, margin reads, and reconciliation all happen by exchanging events over Kafka — none of them has an HTTP endpoint. The only HTTP surface Consignado exposes is credential custody (certificate and OAuth material), documented in the [Consignado API reference](/en/reference/rails/consignado/get-credential-status).

Money amounts and rates cross the wire as decimal **strings**, never floats. Every event carries its schema version in the `ce-schemaversion` header and travels in the shared [CloudEvents envelope](/en/reference/events/overview). Every fact carries version `1.0.0` except `consignado_proposal.accepted`, which carries `2.0.0`. Consignado's `ce-source` is `consignado-gw`, which also names its topic namespace (see [Topic naming](/en/reference/events/overview#topic-naming)): emitted events land on `consignado-gw.<resource>.<event>`, with a `.v2` suffix on the one fact whose schema major is 2. Every fact is **outbox-backed**: it is written in the same database transaction as the state change it reports and relayed to the broker afterwards.

## Events emitted

Facts Consignado emits after acting on a command or picking up an input from the rail. Optional fields are marked `?` — an absent key means the rail sent nothing, where an empty string would read as a blank the rail sent.

| Event (`ce-type`)                                     | Topic                                                 | Fires when                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Key payload                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ----------------------------------------------------- | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `studio.lerian.consignado_solicitacao.received`       | `consignado-gw.consignado_solicitacao.received`       | The auction (leilão) discovery poller picked a worker loan request off the rail — relayed so the lender can decide whether to bid.                                                                                                                                                                                                                                                                                                                                               | `id_solicitacao`, `codigo_solicitante`, `cpf`, `matricula`, `nome_trabalhador`, `data_nascimento`, `inscricao_empregador`, `numero_inscricao_empregador`, `data_admissao`, `valor_liberado`, `nro_parcelas`, `margem_disponivel`, `elegivel_emprestimo`?, `data_hora_validade_solicitacao`, `pessoa_exposta_politicamente`?, `garantias` (`tem_garantias` plus three FGTS collateral values), `discovered_at`                                                                                                                                                                                                                     |
| `studio.lerian.consignado_margin.fetched`             | `consignado-gw.consignado_margin.fetched`             | The rail answered a margin read — Consignado relays the margin Dataprev returned.                                                                                                                                                                                                                                                                                                                                                                                                | `request_ref`, `cpf`, `matricula`, `available_margin`, `remuneracao_disponivel`, `valor_total_vencimentos`?, `elegivel`?, `motivo_inelegibilidade`?, `tipo_bloqueio`?, `qtd_emprestimos_ativos_suspensos`?, `data_desligamento`?, `codigo_motivo_desligamento`?, `percentual_verba_rescisoria_disponivel`?, `as_of`                                                                                                                                                                                                                                                                                                               |
| `studio.lerian.consignado_afastamento.reported`       | `consignado-gw.consignado_afastamento.reported`       | A margin read carried a worker-absence alert — one event per alert element, covering both afastamento and desligamento shapes.                                                                                                                                                                                                                                                                                                                                                   | `cpf`, `matricula`, `tipo_alerta_codigo`, `codigo_motivo_afastamento`?, `data_referencia`, `data_afastamento`?, `data_termino_afastamento`?, `codigo_motivo_desligamento`?, `data_desligamento`?, `data_aviso_previo`?, `data_fim_aviso_previo`?                                                                                                                                                                                                                                                                                                                                                                                  |
| `studio.lerian.consignado_proposal.accepted`          | `consignado-gw.consignado_proposal.accepted.v2`       | A confirmed averbação named one of this tenant's proposals — the post-averbação witness reads the contract back from the rail and relays what the rail registered, verbatim, so the lender can verify booked terms against an independent source. This fact carries schema `2.0.0` and the `.v2` topic suffix. `matricula` identifies the worker's employment link (with `cpf`); it replaces the former `vinculo_ref`, which named no Dataprev field and always travelled empty. | `proposal_ref`, `id_solicitacao`, `numero_proposta`, `numero_contrato`, `cpf`, `matricula`, `numero_inscricao_empregador`, `principal_amount`, `liberated_amount`, `installment_amount`, `installment_count`, `monthly_rate`, `annual_rate`, `cet_monthly`, `cet_annual`, `iof_amount`, `situacao_emprestimo`?, `situacao_descricao`?, `garantia`? (nested block: `tem_garantias` plus three optional FGTS collateral values; an absent block means the rail was silent), `accepted_at`, plus optional rail-read detail such as worker and employer names, exclusion and portability history, and the FGTS collateral block state |
| `studio.lerian.consignado_averbacao.confirmed`        | `consignado-gw.consignado_averbacao.confirmed`        | The rail accepted the averbação (Dataprev success code).                                                                                                                                                                                                                                                                                                                                                                                                                         | `contract_id`, `numero_contrato`, `dataprev_success_code`, `averbado_at`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `studio.lerian.consignado_averbacao.rejected`         | `consignado-gw.consignado_averbacao.rejected`         | The rail rejected the averbação.                                                                                                                                                                                                                                                                                                                                                                                                                                                 | `contract_id`, `numero_contrato`, `error_code`, `error_message`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `studio.lerian.consignado_contract.registered`        | `consignado-gw.consignado_contract.registered`        | A terminal averbação completed its booking composition — the complete post-rail booking handoff for lenders and funds. This is the only fact that books a contract downstream; the averbação acknowledgement and the proposal witness must not create or advance a booked contract.                                                                                                                                                                                              | `contract_id`, `numero_contrato`, `numero_proposta`?, `identity` (`cpf`, `matricula`, employer inscription), `declared_terms` (client-declared amounts, rates, dates, and the guarantee gate), `rail_terms` (post-rail registered terms with an optional three-state `garantia` block), `margin_snapshot`, `signature`, `artifacts` digests and blob refs, `registration` (`averbado_at`, `response_code`, attachment hash), `fund_ref`?                                                                                                                                                                                          |
| `studio.lerian.consignado_exclusao.confirmed`         | `consignado-gw.consignado_exclusao.confirmed`         | The rail confirmed an averbação exclusion (cancellation). Both exclusion facts share one payload shape; `fact_id` is deterministic per (tenant, request, outcome), so a subscriber can dedupe replays.                                                                                                                                                                                                                                                                           | `fact_id`, `tenant_id`, `request_ref`, `settlement_id`, `loan_account_id`, `contract_id`, `status`, `provider_reference`?, `outcome_at`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `studio.lerian.consignado_exclusao.rejected`          | `consignado-gw.consignado_exclusao.rejected`          | The rail rejected an averbação exclusion.                                                                                                                                                                                                                                                                                                                                                                                                                                        | `fact_id`, `tenant_id`, `request_ref`, `settlement_id`, `loan_account_id`, `contract_id`, `status`, `reason_code`?, `message`?, `outcome_at`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `studio.lerian.consignado_reconciliation.received`    | `consignado-gw.consignado_reconciliation.received`    | The reconciliation poller picked up an input (escrituração, CEF D+2 repasse, or portal CSV) — one event per record: per contract row for escrituração, per registro for repasse. `records` carries that single entry and is omitted for the portal CSV source.                                                                                                                                                                                                                   | `competencia`, `source_kind`, `object_ref`, `records`. Each record keys on `numero_contrato` and may additionally carry `cpf`? and `matricula`? so a repasse that matches nothing in the consumer's book still names the worker it moved money for.                                                                                                                                                                                                                                                                                                                                                                               |
| `studio.lerian.consignado_employment_status.reported` | `consignado-gw.consignado_employment_status.reported` | The rail reported a change in the worker's employment status.                                                                                                                                                                                                                                                                                                                                                                                                                    | `report_ref`, `record_id`, `numero_contrato`, `status`, `effective_at`, `reason_code`?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `studio.lerian.consignado_redirecionamento.confirmed` | `consignado-gw.consignado_redirecionamento.confirmed` | The rail confirmed a payroll-collection redirection to an eligible active vínculo. `numero_contrato_novo` is optional: it travels only when the rail names a new contract.                                                                                                                                                                                                                                                                                                       | `request_ref`, `numero_contrato`, `source_vinculo_ref`, `target_vinculo_ref`, `target_matricula`, `target_cnpj`, `target_esocial_category`, `disruption_status`, `effective_at`, `provider_reference`, `numero_contrato_novo`?, `outcome_at`                                                                                                                                                                                                                                                                                                                                                                                      |
| `studio.lerian.consignado_redirecionamento.rejected`  | `consignado-gw.consignado_redirecionamento.rejected`  | The rail rejected a payroll-collection redirection.                                                                                                                                                                                                                                                                                                                                                                                                                              | `request_ref`, `numero_contrato`, `source_vinculo_ref`, `target_vinculo_ref`, `target_matricula`, `target_cnpj`, `target_esocial_category`, `disruption_status`, `effective_at`, `reason_code`, `outcome_at`                                                                                                                                                                                                                                                                                                                                                                                                                      |

## Commands consumed

Commands Consignado consumes from Lender. It subscribes by topic, under the producer's (`lender`) namespace; the producing service sets the `ce-type` header, so it is not listed here. The averbação command subscription is active only in deployments where averbação is enabled; the margin command is always subscribed. No producer emits the margin command yet: Lender declares `lender.consignado_margin.requested` as a contract reservation (see [Lender events](/en/reference/events/lender)), so the margin round trip, including the `consignado_margin.fetched` and `consignado_afastamento.reported` facts it produces, carries no live traffic until that command ships.

| Command                                 | Topic                                          | Key decoded fields                                                                                                                                                                                                                                                                                                               |
| --------------------------------------- | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `consignado.margin.requested`           | `lender.consignado_margin.requested`           | `contract_ref`, `cpf`, `cnpj`, `matricula`, `esocial_category`, `codigo_inscricao_empregador`, `numero_inscricao_empregador`, plus the digital-consent triple `canal_autorizacao_digital`, `data_hora_autorizacao_digital`, `nsu_autorizacao_digital` — all required on the wire                                                 |
| `consignado.averbacao.requested`        | `lender.consignado_averbacao.requested`        | `contract_id`, `numero_contrato`, `cpf`, `matricula`, the full accepted financial terms (`principal_amount`, `liberated_amount`, `installment_amount`, `installment_count`, rates, `iof_amount`, `first_deduction_competencia`), the FGTS collateral block (`tem_garantias` plus values), the signed CCB, and signature evidence |
| `consignado.exclusao.requested`         | `lender.consignado_exclusao.requested`         | `request_ref`, `settlement_id`, `loan_account_id`, `contract_id`, `numero_contrato`, `settled_at`                                                                                                                                                                                                                                |
| `consignado.redirecionamento.requested` | `lender.consignado_redirecionamento.requested` | `request_ref`, `numero_contrato`, `source_vinculo_ref`, `target_vinculo_ref`, `target_matricula`, `target_cnpj`, `target_esocial_category`, `disruption_status`, `effective_at`                                                                                                                                                  |
