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

# Answer a payroll loan request

> How your institution bids on a worker's Crédito do Trabalhador loan request through Lerian, from the auction to the worker's contact.

Bid on a worker's loan request, so that the worker can choose your institution.

> [!NOTE]
>
> This flow is a suggested interpretation of the Dataprev manuals for Crédito do Trabalhador. The manuals prevail over this page. Your institution validates the flow and implements it on the Lerian APIs. See [how to read the diagrams](https://docs.lerian.studio/en/diagrams/introduction.md).

## Participants

***

* **Your institution.** The financial institution that offers the loan.
* **Lerian.** Lerian Consignado. It exchanges the requests with Dataprev, and exposes the API and the events your institution uses.
* **Dataprev.** Runs the Crédito do Trabalhador system: the loan auctions and the registry of payroll loans.
* **Worker.** The employee who asks for the loan in the Carteira de Trabalho Digital app.

## Diagram

***

![Answer a payroll loan request](https://mintcdn.com/lerian-49cb71fc/KypD0TIKUCqZ014J/images/en/d2/id-answer-a-payroll-loan-request.svg?fit=max\&auto=format\&n=KypD0TIKUCqZ014J\&q=85\&s=71dc020fcac61c0c3cf846ba2b04d0b1)

## Steps

***

| # | From | To | Message | Lerian API | What happens |
| - | - | - | - | - | - |
| 1 | Lerian | Dataprev | Dataprev API | | Lerian lists the open loan requests on a schedule (Manual 001). |
| 2 | Dataprev | Lerian | Dataprev API | | Dataprev returns the open requests. Each request shows the worker's free margin. |
| 3 | Lerian | Your institution | Lerian API | Event `consignado.solicitacao.received` | Lerian publishes each new request. |
| 4 | Your institution | Lerian | Lerian API | [`POST /v1/consignado/leilao/solicitacoes/{id_solicitacao}/propostas`](https://docs.lerian.studio/en/reference/rails/consignado/submit-consignado-bid) | Send your bid with its proposals, under an `X-Idempotency` key. |
| 5 | Lerian | Dataprev | Dataprev API | | Lerian includes the proposals at Dataprev in one request (Manual 001). |
| 6 | Dataprev | Lerian | Dataprev API | | Dataprev answers each proposal. |
| 7 | Lerian | Your institution | Lerian API | [`POST /v1/consignado/leilao/solicitacoes/{id_solicitacao}/propostas`](https://docs.lerian.studio/en/reference/rails/consignado/submit-consignado-bid) | Lerian records the result and returns it for each proposal. |
| 8 | Worker | Dataprev | Between other parties | | The worker compares the proposals in Carteira de Trabalho Digital and chooses one. |
| 9 | Worker | Your institution | Proposal contact | | The worker contacts your institution through the contact on the chosen proposal. |

Lerian publishes no event for a request whose auction window already closed.

A bid holds one proposal. When the request comes with FGTS collateral, it can hold two. The `matricula` in your bid must match the one on the request.

Each proposal needs a way for the worker to reach your institution. Lerian adds a formalization portal as a contact when the bid or your registration names one. Without a portal, each proposal carries a contact of its own, or Lerian refuses the bid before it calls Dataprev.

A `422` answer with a `refusal` member is final for its key: the same key returns the same refusal. When the `refusal` has `source` `local`, send the corrected bid under a new key. If the request already has a bid from your institution, the new key answers `409` `BID_SOLICITACAO_TAKEN`. If the answer does not arrive, send the same bid again under the same `X-Idempotency` key.

## How you know it finished

***

Row 7 returns the result of each proposal, and the worker contacts your institution. Then [register the payroll loan](https://docs.lerian.studio/en/diagrams/native-rails/register-a-payroll-loan.md).

## Related

***

* [Register a payroll loan](https://docs.lerian.studio/en/diagrams/native-rails/register-a-payroll-loan.md)
* [Bring in a payroll loan by portability](https://docs.lerian.studio/en/diagrams/native-rails/bring-in-a-payroll-loan-by-portability.md)
* [How Lerian Consignado works](https://docs.lerian.studio/en/rails/consignado/how-consignado-works.md)
* [Consignado events](https://docs.lerian.studio/en/reference/events/consignado.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.