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

# Remove an averbado contract from the payroll registry

> Removes one averbado contract from the Dataprev registry through excluir-consignado-trabalhador (Manual 003 v1.19 §3.3). THERE IS NO UNDO, which is why the operation is marked x-money-path: true.

The contract is excludable once its averbação is confirmed, or while Dataprev accepted it and it still waits for its documentation (attachment_pending with no documentation on file: none sent through POST .../ccb-attachment, or the last one failed at Dataprev; an attachment_invoking call past its attachment_invocation_deadline_at lost its process and counts as failed). From that claim on, documentation for the contract is refused with 409 AVERBACAO_EXCLUDED until the exclusion ends rejected under any evidenceSource but m005_observation. A rejection under m005_observation means the contract already left the registry, so its documentation stays refused. A contract with no averbação in this gateway is excludable while the gateway reports it in M015 and it is still in the registry: imported without booking, a renegotiated legado, a portability received, or the new contract of a refinanciamento or renegociação.

The body carries exactly ONE key. codigoSolicitante, cpfTrabalhador, matricula, codigoInscricaoEmpregador and numeroInscricaoEmpregador are never accepted from the caller: they identify the worker and the employer and come from the immutable local booking snapshot or, for a contract without one, from its M015 obligation, so a client cannot address an exclusion at a worker the gateway's own records never covered.

The answer distinguishes the three outcomes a caller must be able to tell apart:

| Status | Meaning |
|---|---|
| 201 | This call created the attempt and it reached a terminal state — confirmed (the contract came off the payroll) or rejected (this exclusion did not run: the registry refused it, and its own code and message are in the body; or, under evidenceSource m005_observation, the contract read showed the contract already off the registry, reasonCode contract_left_registry.*) |
| 200 | A replay of an attempt that is ALREADY terminal: the outcome in the body is the earlier attempt's, and this call invoked nothing |
| 202 | The gateway holds the request and the effect at the registry is not known yet; M005 reconciliation converges it. A replay of an attempt that is not terminal yet is also a 202 — X-Idempotency-Replayed, not the status code, is what says whether this call invoked anything |

A rejected attempt is a BUSINESS answer, not a transport error: the body carries the registry's refusal, or the contract read that closed it, for the client to read.



## OpenAPI

````yaml /pt/openapi/v3-current/consignado.yaml post /v1/consignado/contracts/{numero_contrato}/exclusion
openapi: 3.1.0
info:
  contact:
    email: contact@lerian.studio
    name: Lerian Studio
    url: https://lerian.studio
  description: >-
    OpenAPI 3.1 surface for Lerian Consignado — Dataprev. The API covers tenant
    credentials and rail configuration, worker margin, loan auctions and bids,
    contract registration and lifecycle, B3 instrument codes, disbursement
    confirmation, portability, refinancing, renegotiation, FGTS guarantees,
    reconciliation, funds, assignments, throughput, and event subscriptions.
  license:
    name: Lerian Studio General License
  title: Lerian Consignado API
  version: v1.0.0
servers:
  - url: https://br-consignado-gw.sandbox.lerian.net
security:
  - BearerAuth: []
tags:
  - description: >-
      Per-tenant Dataprev credential custody and public rail configuration
      (upload, status, rotation, revoke, requester code, and worker portal base
      URL)
    name: Credentials
  - description: >-
      Per-tenant streaming-hub subscription control-plane (list, create, get,
      rotate, revoke, and test delivery)
    name: Subscriptions
  - description: >-
      Dataprev payroll-rail surface: FGTS balance and authorization reads, the
      FGTS guarantee execution, contract suspension, reactivation and term
      changes, the rail's own contract documents, and the on-demand reads of
      leilão solicitações, escriturações, repasses and employment terminations
    name: Consignado Rail
  - description: >-
      Synchronous rail command surface: the operations a bancarizador without
      the lender drives over HTTP.
    name: Consignado Rail Commands
  - description: >-
      Gateway-owned disbursement confirmation: a client bank recording money it
      has ALREADY paid to a worker. It crosses no government boundary and
      proxies no Dataprev operation.
    name: Consignado Disbursement
  - description: >-
      Per-tenant self-service outbound Dataprev rail throughput: read and set
      this tenant's own requests-per-second, including a deliberate pause at
      zero
    name: Consignado Throughput
  - description: >-
      The B3 instrument code (Código IF) of an averbado contract: informed once
      by the bancarizador after B3 registers the CCB, and read back
    name: Consignado Registro B3
paths:
  /v1/consignado/contracts/{numero_contrato}/exclusion:
    post:
      tags:
        - Consignado Rail Commands
      summary: Remove an averbado contract from the payroll registry
      description: >-
        Removes one averbado contract from the Dataprev registry through
        excluir-consignado-trabalhador (Manual 003 v1.19 §3.3). THERE IS NO
        UNDO, which is why the operation is marked x-money-path: true.


        The contract is excludable once its averbação is confirmed, or while
        Dataprev accepted it and it still waits for its documentation
        (attachment_pending with no documentation on file: none sent through
        POST .../ccb-attachment, or the last one failed at Dataprev; an
        attachment_invoking call past its attachment_invocation_deadline_at lost
        its process and counts as failed). From that claim on, documentation for
        the contract is refused with 409 AVERBACAO_EXCLUDED until the exclusion
        ends rejected under any evidenceSource but m005_observation. A rejection
        under m005_observation means the contract already left the registry, so
        its documentation stays refused. A contract with no averbação in this
        gateway is excludable while the gateway reports it in M015 and it is
        still in the registry: imported without booking, a renegotiated legado,
        a portability received, or the new contract of a refinanciamento or
        renegociação.


        The body carries exactly ONE key. codigoSolicitante, cpfTrabalhador,
        matricula, codigoInscricaoEmpregador and numeroInscricaoEmpregador are
        never accepted from the caller: they identify the worker and the
        employer and come from the immutable local booking snapshot or, for a
        contract without one, from its M015 obligation, so a client cannot
        address an exclusion at a worker the gateway's own records never
        covered.


        The answer distinguishes the three outcomes a caller must be able to
        tell apart:


        | Status | Meaning |

        |---|---|

        | 201 | This call created the attempt and it reached a terminal state —
        confirmed (the contract came off the payroll) or rejected (this
        exclusion did not run: the registry refused it, and its own code and
        message are in the body; or, under evidenceSource m005_observation, the
        contract read showed the contract already off the registry, reasonCode
        contract_left_registry.*) |

        | 200 | A replay of an attempt that is ALREADY terminal: the outcome in
        the body is the earlier attempt's, and this call invoked nothing |

        | 202 | The gateway holds the request and the effect at the registry is
        not known yet; M005 reconciliation converges it. A replay of an attempt
        that is not terminal yet is also a 202 — X-Idempotency-Replayed, not the
        status code, is what says whether this call invoked anything |


        A rejected attempt is a BUSINESS answer, not a transport error: the body
        carries the registry's refusal, or the contract read that closed it, for
        the client to read.
      operationId: excluirConsignadoContract
      parameters:
        - description: >-
            The rail contract number (Manual 003 §3.3.1 p.15: Texto, 2 to 15
            characters of free choice). Exact, control-free UTF-8: no trimming
            and no case folding.
          in: path
          name: numero_contrato
          required: true
          schema:
            description: >-
              The rail contract number (Manual 003 §3.3.1 p.15: Texto, 2 to 15
              characters of free choice). Exact, control-free UTF-8: no trimming
              and no case folding.
            examples:
              - 99999999999AN1
            maxLength: 15
            minLength: 2
            type: string
        - description: >-
            Mandatory opaque replay key, 1..128 bytes of valid UTF-8, preserved
            byte for byte. There is no X-Idempotency-Key alias, no case folding
            and no normalization: two keys differing in one byte are two keys.
          in: header
          name: X-Idempotency
          required: true
          schema:
            description: >-
              Mandatory opaque replay key, 1..128 bytes of valid UTF-8,
              preserved byte for byte. There is no X-Idempotency-Key alias, no
              case folding and no normalization: two keys differing in one byte
              are two keys.
            examples:
              - idem-exclusao-0001
            maxLength: 128
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExclusionCommandRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExclusionOperationResponse'
          description: >-
            A replay of an attempt that is already terminal: the outcome in the
            body is the earlier attempt's, and this call invoked nothing.
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExclusionOperationResponse'
          description: >-
            This call created the attempt and it reached a terminal state —
            confirmed, or rejected carrying the registry's own code and message.
          headers:
            X-Idempotency-Replayed:
              schema:
                description: >-
                  True when the durable record supplied the answer without
                  another rail invocation.
                type: string
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExclusionOperationResponse'
          description: >-
            The gateway holds the request and the effect at the registry is not
            known yet, whether or not this call invoked anything.
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            A conflict with the exclusion authority or booking this contract
            already holds. EXCLUSION_AUTHORITY_CONFLICT means the exclusion is
            already recorded under another authority, and an exclusion has no
            undo, so this request was not applied.
            EXCLUSION_BOOKING_IDENTITY_INCOMPLETE means the booking lacks the
            worker or employer identity M003 requires: correct the booking, not
            this request. Both are definitive. EXCLUSION_DOCUMENTATION_UNDERWAY
            means Dataprev accepted the averbação and its documentation is
            already recorded or on its way (attachment_invoking before its
            attachment_invocation_deadline_at), so it is not confirmed yet.
            While GET .../averbacao reads attachment_pending, the recorded
            documentation completes only when the same documentation is sent
            again to POST .../ccb-attachment; exclude the contract once it reads
            confirmed. Nothing was sent to Dataprev.
        '413':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: The raw body exceeds the 1 KiB wire guard.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            The body, the reason code or the contract number is refused locally,
            before anything reaches Dataprev.
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      security:
        - BearerAuth: []
components:
  schemas:
    ExclusionCommandRequest:
      additionalProperties: false
      properties:
        motivo_exclusao:
          description: >-
            The client's declared reason for removing the contract from the
            rail, as one of the closed codes Manual 003 §3.3.1 publishes: 1
            desistência do empréstimo, 2 falecimento, 3 liquidação antecipada, 7
            ação judicial, 8 exclusão por fraude, 9 outros. A string, never a
            JSON number. Mandatory on every request: the gateway never declares
            a reason on the client's behalf, and an absent or unpublished code
            is refused locally before the rail is called.
          enum:
            - '1'
            - '2'
            - '3'
            - '7'
            - '8'
            - '9'
          examples:
            - '1'
          type: string
      required:
        - motivo_exclusao
      type: object
    ExclusionOperationResponse:
      additionalProperties: false
      properties:
        evidenceSource:
          description: >-
            Which proof produced the terminal state: exclude_response,
            operator_evidence or m005_observation. Empty until one did.
          examples:
            - exclude_response
          type: string
        message:
          description: >-
            The refusal message the REGISTRY published, or the gateway's account
            of the contract read that closed it. Present only on a rejected
            operation.
          examples:
            - motivo nao publicado
          type: string
        motivoExclusao:
          description: >-
            The client's declared Manual 003 §3.3.1 reason, echoed from the
            durable authority.
          enum:
            - '1'
            - '2'
            - '3'
            - '7'
            - '8'
            - '9'
          examples:
            - '1'
          type: string
        numeroContrato:
          description: The contract number the exclusion was addressed to.
          examples:
            - 99999999999AN1
          type: string
        outcomeAt:
          description: Instant the registry answered, RFC 3339 UTC. ABSENT until it did.
          examples:
            - '2026-08-05T12:00:00Z'
          format: date-time
          type: string
        providerReference:
          description: >-
            The registry's own receipt for the mutation. ABSENT when it minted
            none, which is the normal case under an m005_observation
            confirmation — absence is never a verdict.
          examples:
            - HASH-1
          type: string
        reasonCode:
          description: >-
            The refusal code the REGISTRY published, or
            contract_left_registry.situacao_N[.origem_N] when its contract read
            showed the contract already off the registry. Present only on a
            rejected operation.
          examples:
            - ME
          type: string
        status:
          description: >-
            Durable operation status. confirmed means the contract came off the
            payroll; rejected means the exclusion did not run: the registry
            published a refusal, or its contract read showed the contract
            already off the registry by another way; claimed, invoking and
            outcome_unknown all mean the effect at the registry is NOT known yet
            and M005 reconciliation has to close it — none of the three is a
            failure to retry blindly.
          enum:
            - claimed
            - invoking
            - confirmed
            - rejected
            - outcome_unknown
          examples:
            - confirmed
          type: string
      required:
        - numeroContrato
        - motivoExclusao
        - status
      type: object
    Detail:
      additionalProperties: true
      properties:
        code:
          description: >-
            Stable, machine-readable product error code. One of the enumerated
            values: the CLT-NNNN catalog codes for the general refusal classes;
            the named command conflicts, which a client branches on to tell one
            conflict from another; the four terminal refusals
            IDEMPOTENCY_STATE_UNRECOGNISED, IDEMPOTENCY_RECORD_UNREADABLE,
            IDEMPOTENCY_OUTCOME_UNRECORDED and IDEMPOTENCY_REPLAY_UNAVAILABLE
            (422), which tell the client to reconcile the original request and
            never retry under a new key; IDEMPOTENCY_KEY_REUSE (422): the key is
            spent on a different request, so send a new key; the codes a single
            surface answers, named after it (FUNDO_*, CESSAO_*, REGISTRO_B3_*,
            ...); and the 5xx codes naming an upstream (DATAPREV_*,
            STREAMING_HUB_*, TENANT_MANAGER_*, the Access Manager's AUT-0033 and
            AUT-1021) or an unknown outcome, whose detail is client-readable.
          enum:
            - AUT-0033
            - AUT-1021
            - AVERBACAO_ARTIFACT_CONFLICT
            - AVERBACAO_CLAIM_CONFLICT
            - AVERBACAO_DOCUMENTATION_CONFLICT
            - AVERBACAO_EXCLUDED
            - AVERBACAO_HELD_BY_ANOTHER_SENDER
            - AVERBACAO_NOT_ACCEPTED
            - AVERBACAO_OPERATIONS_INTERNAL
            - AVERBACAO_OPERATIONS_INVALID_CURSOR
            - AVERBACAO_OPERATIONS_INVALID_QUERY
            - AVERBACAO_OPERATIONS_UNKNOWN_STATUS
            - AVERBACAO_OPERATION_NOT_FOUND
            - BID_NO_PROPOSTA_LEFT
            - BID_ORIGINADOR_INACTIVE
            - BID_ORIGINADOR_UNKNOWN
            - BID_PROPOSAL_SLOT_TAKEN
            - BID_SOLICITACAO_TAKEN
            - BID_SOLICITACAO_UNKNOWN
            - BID_SUBMISSIONS_INTERNAL
            - BID_SUBMISSIONS_INVALID_CURSOR
            - BID_SUBMISSIONS_UNKNOWN_SITUATION
            - BOOKING_FIELD_INVALID
            - CEDED_CREDIT_INTERNAL
            - CEDED_CREDIT_NO_FUND_ENTITLEMENT
            - CEDED_CREDIT_UNAVAILABLE
            - CESSAO_CEDED_TO_OTHER_FUND
            - CESSAO_CREDIT_NOT_ACCEPTED
            - CESSAO_CREDIT_NOT_FOUND
            - CESSAO_CREDIT_NOT_WITNESSED
            - CESSAO_CREDIT_PENDING
            - CESSAO_FUNDO_NOT_ATTRIBUTED
            - CESSAO_INTERNAL
            - CESSAO_INVALID_INPUT
            - CESSAO_UNAVAILABLE
            - CESSAO_UNWIRED
            - CLT-0001
            - CLT-0002
            - CLT-0003
            - CLT-0004
            - CLT-0005
            - CLT-0006
            - CLT-0007
            - CLT-0008
            - CLT-0009
            - CLT-0010
            - CLT-0011
            - CONTRACT_ALREADY_REGISTERED
            - CONTRACT_NOT_BOOKABLE
            - CURSOR_EXPIRED
            - CURSOR_FENCE_MISMATCH
            - DATAPREV_CREDENTIAL_REJECTED
            - DATAPREV_CREDENTIAL_REQUIRED
            - DATAPREV_CREDENTIAL_REVOKED
            - DATAPREV_INVALID_RESPONSE
            - DATAPREV_TIMEOUT
            - DATAPREV_UNAVAILABLE
            - DECLARED_DATES_OUT_OF_ORDER
            - DECLARED_TERMS_INCONSISTENT
            - DISBURSEMENT_CONFIRMATIONS_INTERNAL
            - DISBURSEMENT_CONFIRMATIONS_INVALID_CURSOR
            - DISBURSEMENT_PAYMENT_CONFLICT
            - EVENT_DELIVERY_INTERNAL
            - EXCLUSION_AUTHORITY_CONFLICT
            - EXCLUSION_BOOKING_IDENTITY_INCOMPLETE
            - EXCLUSION_DOCUMENTATION_UNDERWAY
            - EXCLUSION_OPERATIONS_INTERNAL
            - EXCLUSION_OPERATIONS_INVALID_CURSOR
            - EXCLUSION_OPERATIONS_INVALID_QUERY
            - EXCLUSION_OPERATIONS_UNKNOWN_STATUS
            - EXCLUSION_OPERATION_NOT_FOUND
            - FGTS_EXECUTION_ALREADY_REFUSED
            - FGTS_EXECUTION_CONTRACT_TAKEN
            - FGTS_EXECUTION_OUTCOME_UNRESOLVED
            - FGTS_EXECUTION_PAYLOAD_MISMATCH
            - FIRST_DEDUCTION_BEFORE_COMPETENCIA
            - FORMALIZATION_DEADLINE_EXCEEDED
            - FUNDO_CNPJ_CONFLICT
            - FUNDO_DEACTIVATED
            - FUNDO_INTERNAL
            - FUNDO_INVALID_ID
            - FUNDO_INVALID_INPUT
            - FUNDO_NOT_FOUND
            - FUNDO_NOT_REGISTERED
            - FUNDO_REF_CONFLICT
            - FUNDO_UNAVAILABLE
            - IDEMPOTENCY_KEY_REUSE
            - IDEMPOTENCY_OUTCOME_UNRECORDED
            - IDEMPOTENCY_RECORD_UNREADABLE
            - IDEMPOTENCY_REPLAY_UNAVAILABLE
            - IDEMPOTENCY_STATE_UNRECOGNISED
            - INVALID_CONTRACT_NUMBER
            - INVALID_CURSOR
            - INVALID_EVENTS_INVALID_CURSOR
            - INVALID_EVENT_NOT_FOUND
            - INVALID_EVENT_NOT_REQUEUEABLE
            - INVALID_PAGE_LIMIT
            - INVENTORY_UNAVAILABLE
            - MARGIN_SNAPSHOT_INCONSISTENT
            - ORIGINADOR_INTERNAL
            - ORIGINADOR_INVALID_ID
            - ORIGINADOR_INVALID_INPUT
            - ORIGINADOR_NOT_FOUND
            - ORIGINADOR_REF_CONFLICT
            - ORIGINADOR_UNAVAILABLE
            - OUTCOME_UNKNOWN
            - PORTABILIDADE_WINDOW_EXPIRED
            - RAIL_COMMANDS_INTERNAL
            - RAIL_COMMANDS_INVALID_CURSOR
            - RAIL_COMMANDS_TENANT_REQUIRED
            - RAIL_COMMANDS_UNKNOWN_FILTER
            - RAIL_COMMAND_ALREADY_REFUSED
            - RAIL_COMMAND_ANSWER_NOT_RETAINED
            - RAIL_COMMAND_CLAIM_CONFLICT
            - RAIL_COMMAND_OUTCOME_UNRESOLVED
            - RAIL_COMMAND_PAYLOAD_MISMATCH
            - RATE_OUTSIDE_PRODUCT_RANGE
            - REGISTRATION_NOT_FOUND
            - REGISTRO_B3_AVERBACAO_NAO_CONFIRMADA
            - REGISTRO_B3_CONTRATO_NAO_ENCONTRADO
            - REGISTRO_B3_DATA_REGISTRO_INVALIDA
            - REGISTRO_B3_INTERNAL
            - REGISTRO_B3_JA_INFORMADO
            - REGISTRO_B3_NAO_INFORMADO
            - REGISTRO_B3_UNAVAILABLE
            - REGISTRO_B3_UNWIRED
            - REPASSE_EXPECTATIONS_INTERNAL
            - REPASSE_EXPECTATIONS_INVALID_CURSOR
            - REPASSE_EXPECTATIONS_UNKNOWN_SITUATION
            - REVERSAO_WINDOW_EXPIRED
            - SALDO_DEVEDOR_INTERNAL
            - SALDO_DEVEDOR_INVALID_CURSOR
            - SALDO_DEVEDOR_NOT_FOUND
            - SALDO_DEVEDOR_TENANT_REQUIRED
            - SALDO_DEVEDOR_UNAVAILABLE
            - STREAMING_HUB_TIMEOUT
            - STREAMING_HUB_UNAVAILABLE
            - TENANT_MANAGER_TIMEOUT
            - TENANT_MANAGER_UNAVAILABLE
            - THROUGHPUT_HISTORY_INTERNAL
            - THROUGHPUT_HISTORY_INVALID_CURSOR
            - THROUGHPUT_HISTORY_TENANT_REQUIRED
            - THROUGHPUT_HISTORY_UNAVAILABLE
            - THROUGH_REQUIRED
            - UNKNOWN_QUERY_PARAMETER
          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
    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

````

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