> ## 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

> Domain events emitted and consumed by Lerian Consignado — Dataprev.

The Lerian Consignado — Dataprev business surface is entirely event-driven. Fetching a payroll margin, averbação, detecting an auction (leilão) win, 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 schema version `1.0.0` in the `ce-schemaversion` header — a single package-wide version stamped identically on all of them — and travels in the shared [CloudEvents envelope](/en/reference/events/overview). `consignado.reconciliation.received` carries **no CPF**: the reconciliation match keys on `numero_contrato`, so the PII is stripped by construction.

## Events emitted

Facts Consignado emits back to Lender after acting on a command or picking up a reconciliation input.

| Event (`ce-type`)                                  | Topic                                                 | Fires when                                                                                                          | Key payload                                                                                                                                                                                                                                            |
| -------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `studio.lerian.consignado_margin.fetched`          | `lerian.streaming.consignado_margin.fetched`          | A `consignado.margin.requested` command was handled and the rail returned the worker's margin.                      | `request_ref`, `cpf`, `matricula`, `available_margin`, `remuneracao_disponivel`, `as_of`                                                                                                                                                               |
| `studio.lerian.consignado_averbacao.confirmed`     | `lerian.streaming.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`      | `lerian.streaming.consignado_averbacao.rejected`      | The rail rejected the averbação.                                                                                    | `contract_id`, `numero_contrato`, `error_code`, `error_message`                                                                                                                                                                                        |
| `studio.lerian.consignado_proposal.accepted`       | `lerian.streaming.consignado_proposal.accepted`       | An auction (leilão) win was detected — this lender's bid was accepted.                                              | `proposal_ref`, `id_solicitacao`, `numero_proposta`, `cpf`, `vinculo_ref`, `principal_amount`, `installment_amount`, `installment_count`, `annual_rate`, `cet_monthly`, `cet_annual`, `iof_amount`, `fgts_guarantee_percent` (optional), `accepted_at` |
| `studio.lerian.consignado_reconciliation.received` | `lerian.streaming.consignado_reconciliation.received` | The reconciliation poller picked up an input (escrituração, CEF D+2 repasse, or portal CSV) — one event per record. | `competencia`, `source_kind`, `object_ref`, `records`. No CPF on this wire.                                                                                                                                                                            |

## Commands consumed

Commands Consignado consumes from Lender. It subscribes by topic; the producing service sets the `ce-type` header, so it is not listed here.

| Command                          | Topic                                             | Decoded fields                                                                                                                                                                                                                                                                                     |
| -------------------------------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `consignado.margin.requested`    | `lerian.streaming.consignado_margin.requested`    | `contract_ref` (optional), `cpf`, `cnpj`, `matricula`, `esocial_category`                                                                                                                                                                                                                          |
| `consignado.averbacao.requested` | `lerian.streaming.consignado_averbacao.requested` | `contract_id`, `numero_contrato`, `cpf`, `vinculo_ref`, `principal_amount`, `installment_amount`, `installment_count`, `annual_rate`, `cet_monthly`, `cet_annual`, `iof_amount`, `first_deduction_competencia`, `fgts_guarantee_percent` (optional), `signed_ccb_base64`, `biometric_evidence_ref` |
