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

# Bring in a payroll loan by portability

> How your institution answers a worker's portability request and registers the ported payroll loan at Dataprev through Lerian.

Answer a worker's portability request, then register the ported loan at 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 takes the loan from the origin institution.
* **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 portability requests and the registry of payroll loans.
* **Worker.** The employee who asks for portability proposals in the Carteira de Trabalho Digital app.

## Diagram

***

### Answer the portability request

![Bring in a payroll loan by portability: Answer the portability request](https://mintcdn.com/lerian-49cb71fc/KypD0TIKUCqZ014J/images/en/d2/id-bring-in-a-payroll-loan-by-portability-1.svg?fit=max\&auto=format\&n=KypD0TIKUCqZ014J\&q=85\&s=386eee8ccf35b077fe40bb6146175a4c)

| # | From | To | Message | Lerian API | What happens |
| - | - | - | - | - | - |
| 1 | Lerian | Dataprev | Dataprev API | | Lerian lists the open portability requests on a schedule (Manual 011). |
| 2 | Dataprev | Lerian | Dataprev API | | Dataprev returns the open requests. |
| 3 | Lerian | Your institution | Lerian API | Event `consignado.portability_proposal.received` | Lerian publishes each new request and its validity. |
| 4 | Your institution | Lerian | Lerian API | [`POST /v1/consignado/leilao/portabilidade/solicitacoes/{id_solicitacao_proposta}/propostas`](https://docs.lerian.studio/en/reference/rails/consignado/respond-consignado-portability-auction) | Send one proposal. Echo the validity of the request in `dataHoraValidadeSolicitacao`. |
| 5 | Lerian | Dataprev | Dataprev API | | Lerian includes the proposal at Dataprev (Manual 011). |
| 6 | Dataprev | Lerian | Dataprev API | | Dataprev answers the proposal. |
| 7 | Lerian | Your institution | Lerian API | [`POST /v1/consignado/leilao/portabilidade/solicitacoes/{id_solicitacao_proposta}/propostas`](https://docs.lerian.studio/en/reference/rails/consignado/respond-consignado-portability-auction) | Lerian returns the Dataprev answer. |
| 8 | Worker | Your institution | Proposal contact | | The worker reviews the proposals and can contact your institution directly. |

Lerian refuses a proposal after the validity of the request, before it calls Dataprev. A request that admits a second proposal, with and without FGTS collateral, takes two calls.

### Register the ported loan

![Bring in a payroll loan by portability: Register the ported loan](https://mintcdn.com/lerian-49cb71fc/KypD0TIKUCqZ014J/images/en/d2/id-bring-in-a-payroll-loan-by-portability-2.svg?fit=max\&auto=format\&n=KypD0TIKUCqZ014J\&q=85\&s=a4a9de5ba18d90938ff353196bb52812)

| # | From | To | Message | Lerian API | What happens |
| - | - | - | - | - | - |
| 1 | Your institution | Your institution | Internal step | | Obtain the número único of the portability, the NSU that comes from CIP. |
| 2 | Your institution | Lerian | Lerian API | [`POST /v1/consignado/portabilidade/{numero_unico}/averbacao`](https://docs.lerian.studio/en/reference/rails/consignado/averbar-consignado-portabilidade) | Send the averbação of the new contract. You choose `numeroContrato`: 2 to 15 letters or digits. |
| 3 | Lerian | Dataprev | Dataprev API | | Lerian sends the averbação by portability to Dataprev (Manual 008). |
| 4 | Dataprev | Lerian | Dataprev API | | Dataprev answers the averbação. |
| 5 | Lerian | Your institution | Lerian API | [`POST /v1/consignado/portabilidade/{numero_unico}/averbacao`](https://docs.lerian.studio/en/reference/rails/consignado/averbar-consignado-portabilidade) | Lerian returns the Dataprev answer. |
| 6 | Your institution | Lerian | Lerian API | [`GET /v1/consignado/portabilidade/efetivacoes`](https://docs.lerian.studio/en/reference/rails/consignado/list-consignado-portabilidade-efetivacoes) | Read the status of the portability. |
| 7 | Lerian | Dataprev | Dataprev API | | Lerian reads the portability at Dataprev (Manual 008). |
| 8 | Dataprev | Lerian | Dataprev API | | Dataprev returns `classificadorSituacao`. |
| 9 | Lerian | Your institution | Lerian API | [`GET /v1/consignado/portabilidade/efetivacoes`](https://docs.lerian.studio/en/reference/rails/consignado/list-consignado-portabilidade-efetivacoes) | Lerian returns the status as Dataprev sent it. |

The exclusion at the origin institution and your averbação can happen in either order. When you send `dataExclusaoOrigem`, Lerian refuses an averbação after the 20 calendar days that follow that date, before it calls Dataprev.

`classificadorSituacao` reads `0` open, `1` closed by deadline, `2` closed by averbação or `3` closed by a change of the número único. An accepted averbação starts the Lerian outstanding-balance reports for the new contract.

A `503` or `500` answer with `X-Idempotency-Fenced: true` may have reached Dataprev. For a proposal, send the same body with the same `numeroProposta` under a new key, before the validity of the request. A `422` that names `SE` means that the first proposal reached Dataprev.

For an averbação with such an answer, do not send it again under a new key, because that submits it again. Read the status of the portability instead. If the status reads `2`, import the contract with [`POST /v1/consignado/contracts/{numero_contrato}/import`](https://docs.lerian.studio/en/reference/rails/consignado/import-consignado-contract), without the `booking` object. The import starts the outstanding-balance reports, or answers `409` `CONTRACT_ALREADY_REGISTERED` when they already run.

## How you know it finished

***

Dataprev accepts the averbação, and the status of the portability reads `2`.

## Related

***

* [Release a payroll loan by portability](https://docs.lerian.studio/en/diagrams/native-rails/release-a-payroll-loan-by-portability.md)
* [Answer a payroll loan request](https://docs.lerian.studio/en/diagrams/native-rails/answer-a-payroll-loan-request.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.