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

# Refinanciar um ou mais contratos ativos em um novo

> Esta operação atua como proxy de realizar-refinanciamento-trabalhador (Manual 008 v1.10 §3.1): encerra todos os contratos mencionados em listaContratosQuitadosTrabalhador e averba o novo contrato que os substitui, reservando margem até o fechamento do refinanciamento. todo contrato quitado deverá ser uma averbação do tenant autenticado que a rede reconheceu; qualquer outra coisa é 404 antes de a rede ser chamada - se esse contrato está atualmente ACTIVE no registro do governo fica a critério da própria rede. com garantia (temGarantias=true), o refinanciamento só poderá relacionar-se 1:1 (regra fr, no máximo um contrato quitado) e deverá informar pelo menos um dos três valores de garantia (regra fi). X-Idempotency é obrigatório.



## OpenAPI

````yaml pt/openapi/v3-current/consignado.yaml post /v1/consignado/contracts/{numero_contrato}/refinanciamento
openapi: 3.1.0
info:
  contact:
    email: contact@lerian.studio
    name: Lerian Studio
    url: https://lerian.studio
  description: >-
    Superfície OpenAPI 3.1 para Lerian Consignado — Dataprev. o API cobre
    credenciais tenant e configuração de rede, margem do trabalhador, leilões e
    licitações de empréstimos, registro e ciclo de vida do contrato, confirmação
    de desembolso, portabilidade, refinanciamento, renegociação, garantias FGTS,
    reconciliação, fundos, atribuições, uso, rendimento e assinaturas de
    eventos. o material secreto é gravado no armazenamento secreto tenant e
    nunca é devolvido por nenhuma operação.
  license:
    name: Lerian Studio General License
  title: Lerian Consignado API
  version: v1.0.0
servers:
  - url: https://consignado.sandbox.lerian.net
security:
  - BearerAuth: []
tags:
  - description: >-
      Custódia de credenciais do Dataprev e configuração pública do rail por
      tenant (upload, status, rotação, revogação, código do solicitante e URL
      base do portal do trabalhador)
    name: Credentials
  - description: >-
      Uso do gateway consignado no escopo do tenant: agregação de unidades
      faturáveis ​​com preço por competência
    name: Consignado Usage
  - description: >-
      Per-tenant plano de controle de assinatura do streaming-hub (listar,
      criar, obter, girar, revogar e testar a entrega)
    name: Subscriptions
  - description: >-
      Superfície folha de pagamento da rail Dataprev: leituras de saldo e
      autorização FGTS, execução de garantias FGTS, suspensão de contrato,
      reativação e alteração de prazo, documentos contratuais próprios da rede e
      leituras sob demanda de transações, escriturações, repasses e rescisões
      trabalhistas
    name: Consignado Rail
  - description: >-
      Superfície de comando da rede síncrona: as operações que um bancarizador
      sem o credor realizam sobre HTTP. cada um compartilha sua implementação de
      comando com o gatilho de evento de credor equivalente.
    name: Consignado Rail Commands
  - description: >-
      Confirmação de desembolso de propriedade do gateway: um banco cliente
      registrando o dinheiro que ALREADY pagou a um trabalhador. ele não cruza
      nenhuma fronteira governamental e não representa nenhuma operação
      Dataprev.
    name: Consignado Disbursement
  - description: >
      Taxa de transferência da rail Dataprev de saída de autoatendimento
      per-tenant: leia e defina o próprio requests-per-second deste tenant,
      incluindo uma pausa deliberada em zero
    name: Consignado Throughput
paths:
  /v1/consignado/contracts/{numero_contrato}/refinanciamento:
    post:
      tags:
        - Consignado Rail
      summary: Refinanciar um ou mais contratos ativos em um novo
      description: >-
        Esta operação atua como proxy de realizar-refinanciamento-trabalhador
        (Manual 008 v1.10 §3.1): encerra todos os contratos mencionados em
        listaContratosQuitadosTrabalhador e averba o novo contrato que os
        substitui, reservando margem até o fechamento do refinanciamento. todo
        contrato quitado deverá ser uma averbação do tenant autenticado que a
        rede reconheceu; qualquer outra coisa é 404 antes de a rede ser chamada
        - se esse contrato está atualmente ACTIVE no registro do governo fica a
        critério da própria rede. com garantia (temGarantias=true), o
        refinanciamento só poderá relacionar-se 1:1 (regra fr, no máximo um
        contrato quitado) e deverá informar pelo menos um dos três valores de
        garantia (regra fi). X-Idempotency é obrigatório.
      operationId: realizarConsignadoRefinanciamento
      parameters:
        - description: >-
            The NEW contract number, minted by the CLIENT — the rail mints
            nothing here.
          in: path
          name: numero_contrato
          required: true
          schema:
            description: >-
              The NEW contract number, minted by the CLIENT — the rail mints
              nothing here.
            examples:
              - 99999999999ARN1
            maxLength: 15
            minLength: 2
            type: string
        - description: >-
            Client-chosen idempotency key. REQUIRED: an absent key is 422, never
            a generated default.
          in: header
          name: X-Idempotency
          required: true
          schema:
            description: >-
              Client-chosen idempotency key. REQUIRED: an absent key is 422,
              never a generated default.
            examples:
              - idem-refinanciamento-0001
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefinanciamentoBody'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefinanciamentoOperationResponse'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      security:
        - BearerAuth: []
components:
  schemas:
    RefinanciamentoBody:
      additionalProperties: false
      properties:
        cnpjOperador:
          description: >-
            CNPJ of the operator (correspondent, cooperado or similar)
            responsible for the operation. Optional, Texto since v1.7.
          examples:
            - '12345678000199'
          maxLength: 14
          type: string
        codigoInscricaoEmpregador:
          description: 'Employer inscription type: 1 CNPJ, 2 CPF.'
          examples:
            - '1'
          pattern: ^[12]$
          type: string
        competenciaInicioDesconto:
          description: Payroll competência of the first deduction, yyyyMM. Optional.
          examples:
            - '202507'
          pattern: ^[0-9]{6}$
          type: string
        cpfTrabalhador:
          description: Worker CPF, 11 digits.
          examples:
            - '99999999999'
          maxLength: 11
          minLength: 11
          pattern: ^[0-9]{11}$
          type: string
        dataFimContrato:
          description: End date of the new consignado contract, RFC 3339 UTC.
          examples:
            - '2027-07-10T00:00:00Z'
          format: date-time
          type: string
        dataInicioContrato:
          description: Start date of the new consignado contract, RFC 3339 UTC.
          examples:
            - '2025-06-11T00:00:00Z'
          format: date-time
          type: string
        dataPrimeiroDesconto:
          description: Date of the first payroll deduction, RFC 3339 UTC.
          examples:
            - '2025-07-10T00:00:00Z'
          format: date-time
          type: string
        listaContratosQuitadosTrabalhador:
          description: >-
            Every contract this refinanciamento quits. Each must be an active
            averbação of the authenticated tenant — 'active' is the government
            registry's own judgment, which this gateway does not locally track.
          examples:
            - - numeroContrato: 99999999999AR1
          items:
            $ref: '#/components/schemas/RefinanciamentoContratoQuitado'
          minItems: 1
          type:
            - array
            - 'null'
        matricula:
          description: Matrícula assigned to the worker by the employer.
          examples:
            - 99999999999-A
          maxLength: 30
          type: string
        nomeTrabalhador:
          description: Worker's full name.
          examples:
            - Trabalhador 99999999999
          maxLength: 90
          type: string
        numeroInscricaoEmpregador:
          description: >-
            Employer inscription number, Texto since Manual 008 v1.7 (the
            mirrored Swagger still types this int64).
          examples:
            - '99999999999881'
          maxLength: 14
          type: string
        numeroParcelas:
          description: >-
            Number of instalments of the new contract, capped at the manual's
            own 3-digit field width (Manual 008 §3.1.1 p.10).
          examples:
            - 24
          format: int64
          maximum: 999
          minimum: 1
          type: integer
        percVerbaRescisoriaGarantia:
          description: Percentage of severance pay pledged as collateral, 0 to 35%.
          examples:
            - '15'
          maxLength: 13
          pattern: ^[0-9]+(\.[0-9]{1,2})?$
          type: string
        temGarantias:
          description: >-
            Whether FGTS collateral secures the new contract. When true, exactly
            one contract may be named in lista_contratos_quitados_trabalhador
            (regra FR) and at least one of the three garantia values below must
            be informed (regra FI).
          examples:
            - true
          type: boolean
        valorCETAnual:
          description: valorCETAnual — Custo Efetivo Total, annual percent decimal string.
          examples:
            - '7.26'
          maxLength: 13
          pattern: ^[0-9]+(\.[0-9]{1,2})?$
          type: string
        valorCETMensal:
          description: >-
            valorCETMensal — Custo Efetivo Total, monthly percent decimal
            string.
          examples:
            - '0.59'
          maxLength: 13
          pattern: ^[0-9]+(\.[0-9]{1,2})?$
          type: string
        valorEmprestimo:
          description: >-
            valorEmprestimo — the new contract's principal (decimal string,
            BRL).
          examples:
            - '9018.54'
          maxLength: 13
          pattern: ^[0-9]+(\.[0-9]{1,2})?$
          type: string
        valorIOF:
          description: valorIOF — the IOF charged, in reais (decimal string, BRL).
          examples:
            - '94.95'
          maxLength: 13
          pattern: ^[0-9]+(\.[0-9]{1,2})?$
          type: string
        valorMultaRescisoriaGarantiaFgts:
          description: >-
            FGTS termination-fine collateral, up to 100% of the 40% fine
            (decimal string, BRL). Optional individually.
          examples:
            - '300.00'
          maxLength: 13
          pattern: ^[0-9]+(\.[0-9]{1,2})?$
          type: string
        valorPago:
          description: >-
            valorPago — settlement amount paid to quit the original contracts
            (decimal string, BRL).
          examples:
            - '6114.50'
          maxLength: 13
          pattern: ^[0-9]+(\.[0-9]{1,2})?$
          type: string
        valorParcela:
          description: >-
            valorParcela — the new contract's instalment amount (decimal string,
            BRL).
          examples:
            - '400.00'
          maxLength: 13
          pattern: ^[0-9]+(\.[0-9]{1,2})?$
          type: string
        valorSaldoDisponivelGarantiaFgts:
          description: >-
            FGTS balance pledged as collateral (decimal string, BRL). Optional
            individually; at least one of the three garantia values is required
            when temGarantias is true.
          examples:
            - '600.00'
          maxLength: 13
          pattern: ^[0-9]+(\.[0-9]{1,2})?$
          type: string
        valorTaxaAnual:
          description: valorTaxaAnual — annual interest rate, percent decimal string.
          examples:
            - '6.17'
          maxLength: 13
          pattern: ^[0-9]+(\.[0-9]{1,2})?$
          type: string
        valorTaxaMensal:
          description: valorTaxaMensal — monthly interest rate, percent decimal string.
          examples:
            - '0.5'
          maxLength: 13
          pattern: ^[0-9]+(\.[0-9]{1,2})?$
          type: string
        valorTroco:
          description: >-
            valorTroco — amount delivered to the client after settling the
            quitados contracts (decimal string, BRL).
          examples:
            - '2809.09'
          maxLength: 13
          pattern: ^[0-9]+(\.[0-9]{1,2})?$
          type: string
      required:
        - cpfTrabalhador
        - matricula
        - nomeTrabalhador
        - codigoInscricaoEmpregador
        - numeroInscricaoEmpregador
        - dataInicioContrato
        - dataFimContrato
        - dataPrimeiroDesconto
        - numeroParcelas
        - valorEmprestimo
        - valorParcela
        - valorIOF
        - valorPago
        - valorTroco
        - valorTaxaAnual
        - valorTaxaMensal
        - valorCETAnual
        - valorCETMensal
        - listaContratosQuitadosTrabalhador
        - temGarantias
      type: object
    RefinanciamentoOperationResponse:
      additionalProperties: false
      properties:
        competenciaInicioDesconto:
          description: Payroll competência of the first deduction, yyyyMM.
          examples:
            - '202507'
          type: string
        hashOperacao:
          description: The rail's own identity for this operation.
          examples:
            - '34006311'
          type: string
        listaContratosQuitadosTrabalhador:
          description: >-
            Every contract the rail confirmed as quitado by this
            refinanciamento.
          examples:
            - - numeroContrato: 99999999999AR1
          items:
            $ref: '#/components/schemas/RefinanciamentoContratoQuitado'
          type:
            - array
            - 'null'
        mensagem:
          description: The rail's own message.
          examples:
            - Refinanciamento realizado com sucesso
          type: string
        numeroContrato:
          description: The new contract's number, as confirmed by the rail.
          examples:
            - 99999999999ARN1
          type: string
      required:
        - mensagem
        - numeroContrato
        - competenciaInicioDesconto
        - hashOperacao
        - listaContratosQuitadosTrabalhador
      type: object
    Detail:
      additionalProperties: false
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          examples:
            - ERR-0001
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
        upstream:
          $ref: '#/components/schemas/Upstream'
          description: >-
            RFC 9457 extension member: the error a proxied third-party provider
            reported. Absent unless the emitting service explicitly surfaced
            one.
      type: object
    RefinanciamentoContratoQuitado:
      additionalProperties: false
      properties:
        numeroContrato:
          description: >-
            Contract number being quit by this refinanciamento. Must be an
            averbação of the authenticated tenant that the rail acknowledged.
          examples:
            - 99999999999AR1
          maxLength: 15
          minLength: 2
          type: string
      required:
        - numeroContrato
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    Upstream:
      additionalProperties: false
      properties:
        code:
          description: The upstream provider's own error code, verbatim.
          examples:
            - E4001
          type: string
        message:
          description: >-
            The upstream provider's own error message, verbatim (bounded, never
            its raw response body).
          examples:
            - account not found at provider
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````