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

# Attach a cession document to the lot that took the contract

> Retains a cession-phase document, today the endorsed credit instrument (endorsed_credit_instrument, application/pdf, up to 5 MiB), for the lot a fund took the contract into, and publishes consignado.contract_document.retained. It only keeps the file: nothing is sent to Dataprev and no averbação is needed. The target is the contract's latest take (assignment_receivable.taken), so a contract no fund took answers 409 CONTRACT_NOT_TAKEN. The same file (same digest) for the lot and type answers 200 with the stored record and no new fact, whatever its file_name; a different file is 409 DOCUMENT_ALREADY_RETAINED and a retained document is never replaced. An origination type is refused 422 DOCUMENT_PHASE_MISMATCH: those go through POST. One document per call. X-Idempotency is required. A bancarizador credential (consignado-rail/ccb:write) acts for every lot; a fundo credential only for the fund that took the contract; an originador credential only for its own contract, any other is refused 403.

Partner route: the text above describes the party's own route. Here the register id in the path names the party: it must be in the partner credential's scope and registered under the caller's tenant, and the call runs as that party, exactly as the party's own credential would. An originador the bancarizador deactivated is refused 403 ORIGINADOR_DEACTIVATED until it is reactivated.



## OpenAPI

````yaml /es/openapi/v3-current/consignado.yaml patch /v1/consignado/originadores/{originador_id}/contracts/{numero_contrato}/ccb-attachment
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: Tenant pre-auction configuration, fund policies, auctions and quotes
    name: Consignado Pré-leilão
  - 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/originadores/{originador_id}/contracts/{numero_contrato}/ccb-attachment:
    patch:
      tags:
        - Consignado Rail Commands
      summary: Attach a cession document to the lot that took the contract
      description: >-
        Retains a cession-phase document, today the endorsed credit instrument
        (endorsed_credit_instrument, application/pdf, up to 5 MiB), for the lot
        a fund took the contract into, and publishes
        consignado.contract_document.retained. It only keeps the file: nothing
        is sent to Dataprev and no averbação is needed. The target is the
        contract's latest take (assignment_receivable.taken), so a contract no
        fund took answers 409 CONTRACT_NOT_TAKEN. The same file (same digest)
        for the lot and type answers 200 with the stored record and no new fact,
        whatever its file_name; a different file is 409
        DOCUMENT_ALREADY_RETAINED and a retained document is never replaced. An
        origination type is refused 422 DOCUMENT_PHASE_MISMATCH: those go
        through POST. One document per call. X-Idempotency is required. A
        bancarizador credential (consignado-rail/ccb:write) acts for every lot;
        a fundo credential only for the fund that took the contract; an
        originador credential only for its own contract, any other is refused
        403.


        Partner route: the text above describes the party's own route. Here the
        register id in the path names the party: it must be in the partner
        credential's scope and registered under the caller's tenant, and the
        call runs as that party, exactly as the party's own credential would. An
        originador the bancarizador deactivated is refused 403
        ORIGINADOR_DEACTIVATED until it is reactivated.
      operationId: attachConsignadoCessionDocumentsAsOriginador
      parameters:
        - description: >-
            The originador's register id, as returned in the id field of GET
            /v1/consignado/originadores. It must be in the partner credential's
            scope.
          in: path
          name: originador_id
          required: true
          schema:
            description: >-
              The originador's register id, as returned in the id field of GET
              /v1/consignado/originadores. It must be in the partner
              credential's scope.
            examples:
              - 6f1c2a3b-4d5e-4f60-8a7b-9c0d1e2f3a4b
            format: uuid
            type: string
        - description: The contract a fund took into a lot.
          in: path
          name: numero_contrato
          required: true
          schema:
            description: The contract a fund took into a lot.
            examples:
              - 99999999999AN1
            type: string
        - description: Required idempotency key. Absent is 422, never a generated default.
          in: header
          name: X-Idempotency
          required: true
          schema:
            description: >-
              Required idempotency key. Absent is 422, never a generated
              default.
            examples:
              - idem-endorsement-1
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CessionDocumentsRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CessionDocumentResponse'
          description: OK
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            CONTRACT_NOT_TAKEN means no fund took the contract into a lot, so
            there is nothing to attach the document to; retry after the Lender's
            take reaches the gateway. DOCUMENT_ALREADY_RETAINED means a
            different document of this type is already retained for the latest
            lot and is never replaced. Both are definitive for the request as
            sent; nothing was recorded.
        '413':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            The body is 67108864 bytes or more, counted as sent and again after
            canonicalization, photo images included, or it holds more JSON
            tokens than the command budget; nothing is recorded or sent to
            Dataprev.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            DOCUMENT_PHASE_MISMATCH means the document_type is an origination
            type; DOCUMENT_CONTENT_MISMATCH that the bytes do not match the
            content_type or the type does not accept it; DOCUMENT_TOO_LARGE that
            the document is over its limit. Otherwise the detail names the rule:
            canonical base64, exactly one document, a usable X-Idempotency.
        '429':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            Either the tenant rate limit (CLT-0009), which runs earlier on these
            routes, or this pod's document budget (DOCUMENT_REQUESTS_BUSY)
            refused the request: nothing was recorded or sent to Dataprev. Retry
            the same request with the same X-Idempotency after the Retry-After
            seconds.
        '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:
    CessionDocumentsRequest:
      additionalProperties: false
      properties:
        documents:
          description: >-
            Exactly one cession-phase document: endorsed_credit_instrument,
            application/pdf, up to 5 MiB. An origination type is refused 422
            DOCUMENT_PHASE_MISMATCH.
          items:
            $ref: '#/components/schemas/AverbacaoTypedDocument'
          maxItems: 1
          minItems: 1
          type:
            - array
            - 'null'
      required:
        - documents
      type: object
    CessionDocumentResponse:
      additionalProperties: false
      properties:
        assignmentSetId:
          description: The lot the contract's latest take belongs to.
          examples:
            - 0193a6f2-7c4e-7b1a-9d2e-5f8c3a1b2c3d
          format: uuid
          type: string
        documents:
          description: >-
            The documents retained for the lot and type sent: the stored record,
            new or replayed.
          items:
            $ref: '#/components/schemas/CessionDocumentSummary'
          type:
            - array
            - 'null'
        fundoRef:
          description: The fund that took the contract in that lot.
          examples:
            - 0192f1d0-4a2b-7c3d-8e9f-0a1b2c3d4e5f
          type: string
        numeroContrato:
          description: The contract number the call was addressed to.
          examples:
            - 99999999999AN1
          type: string
      required:
        - numeroContrato
        - assignmentSetId
        - fundoRef
        - documents
      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_*, 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; the Access
            Manager's AUT-1022 (403): the partner credential holds more than one
            originador, so name it in the path; ORIGINADOR_DEACTIVATED and
            FUNDO_PARTNER_DEACTIVATED (403): the originador or fundo the partner
            credential acts for is deactivated, so the bancarizador must
            reactivate it.
          enum:
            - AUT-0033
            - AUT-1021
            - AUT-1022
            - 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_FUND_NOT_ACCEPTED
            - BID_FUND_NOT_IN_PRELEILAO
            - BID_FUND_OUTSIDE_HOURS
            - BID_FUND_OUTSIDE_MANDATE
            - BID_FUND_POLICY_VIOLATION
            - BID_FUND_REQUIRED
            - BID_NO_PROPOSTA_LEFT
            - BID_ORIGINADOR_INACTIVE
            - BID_ORIGINADOR_UNKNOWN
            - BID_PROPOSAL_SLOT_TAKEN
            - BID_QUOTE_NOT_IN_PRELEILAO
            - BID_QUOTE_REVISION_LIMIT
            - BID_QUOTE_UNSECURED_REQUIRED
            - BID_QUOTE_WINDOW_CLOSED
            - 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
            - CLT-0001
            - CLT-0002
            - CLT-0003
            - CLT-0004
            - CLT-0005
            - CLT-0006
            - CLT-0007
            - CLT-0008
            - CLT-0009
            - CLT-0010
            - CLT-0011
            - CLT-0012
            - CONTRACT_ALREADY_REGISTERED
            - CONTRACT_NOT_BOOKABLE
            - CONTRACT_NOT_TAKEN
            - 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
            - DISBURSEMENT_RECEIPT_CONFLICT
            - DISBURSEMENT_RECEIPT_INVALID
            - DOCUMENT_ALREADY_RETAINED
            - DOCUMENT_CONTENT_MISMATCH
            - DOCUMENT_PHASE_MISMATCH
            - DOCUMENT_REQUESTS_BUSY
            - DOCUMENT_TOO_LARGE
            - DOCUMENT_TYPE_REPEATED
            - 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
            - EXCLUSION_RENEGOTIATION_UNDERWAY
            - 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_DIFFERS_FROM_QUOTE
            - FUNDO_INTERNAL
            - FUNDO_INVALID_ID
            - FUNDO_INVALID_INPUT
            - FUNDO_NOT_FOUND
            - FUNDO_NOT_REGISTERED
            - FUNDO_PARTNER_DEACTIVATED
            - FUNDO_POLICY_VIOLATION
            - FUNDO_REF_CONFLICT
            - FUNDO_REGISTRY_OWNED_BY_CORE
            - FUNDO_UNAVAILABLE
            - HELD_REPASSE_MONTH_CLOSED
            - HELD_REPASSE_MONTH_MISMATCH
            - HELD_REPASSE_NOT_FOUND
            - HELD_REPASSE_UNATTRIBUTABLE
            - 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
            - LOAN_PRODUCT_VERSION_UNKNOWN
            - MARGIN_SNAPSHOT_INCONSISTENT
            - MATRICULA_DIFFERS_FROM_PROPOSAL
            - ORIGINADOR_DEACTIVATED
            - ORIGINADOR_INTERNAL
            - ORIGINADOR_INVALID_ID
            - ORIGINADOR_INVALID_INPUT
            - ORIGINADOR_NOT_FOUND
            - ORIGINADOR_REF_CONFLICT
            - ORIGINADOR_UNAVAILABLE
            - OUTCOME_UNKNOWN
            - PORTABILIDADE_WINDOW_EXPIRED
            - PRELEILAO_POLICY_INVALID
            - PRELEILAO_WORKER_UNAVAILABLE
            - 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_CLOSE_CONTRADICTED
            - RAIL_COMMAND_NOT_CLOSEABLE
            - 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
            - RENEGOTIATION_EXCLUSION_UNDERWAY
            - REPASSE_EXPECTATIONS_INTERNAL
            - REPASSE_EXPECTATIONS_INVALID_CURSOR
            - REPASSE_EXPECTATIONS_UNKNOWN_SITUATION
            - REVERSAO_ORIGINAL_NOT_REPLACED
            - 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
            - VERSION_ADMITS_NO_PESSOA_FISICA
          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
    AverbacaoTypedDocument:
      additionalProperties: false
      properties:
        bytes_base64:
          description: >-
            Canonical base64 document bytes. Decoded limits: 5 MiB per document,
            15 MiB for liveness_video, 30 MiB across all documents.
          examples:
            - /9j/4AAQSkZJRg==
          type: string
        content_type:
          description: Document media type; the accepted set depends on document_type.
          enum:
            - application/pdf
            - image/jpeg
            - image/png
            - video/mp4
          examples:
            - image/jpeg
          type: string
        document_type:
          description: Closed document type; each type may appear at most once.
          enum:
            - selfie
            - id_document_front
            - id_document_back
            - drivers_license_front
            - drivers_license_back
            - drivers_license
            - liveness_photo
            - liveness_video
            - proof_of_address
            - proof_of_income
            - payslip
            - other
            - endorsed_credit_instrument
          examples:
            - selfie
          type: string
        file_name:
          description: Original document file name.
          examples:
            - selfie.jpg
          maxLength: 255
          type: string
      required:
        - document_type
        - file_name
        - content_type
        - bytes_base64
      type: object
    CessionDocumentSummary:
      additionalProperties: false
      properties:
        artifact_type:
          description: The cession document type.
          enum:
            - endorsed_credit_instrument
          examples:
            - endorsed_credit_instrument
          type: string
        content_length:
          description: Size in bytes of the retained document.
          examples:
            - 184213
          format: int64
          type: integer
        content_type:
          description: Media type of the retained document.
          examples:
            - application/pdf
          type: string
        digest:
          description: SHA-256 of the retained document, lowercase hex.
          examples:
            - 3b1f0c9a5d7e2a64b8c1d0e9f3a2b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0
          type: string
        retained_at:
          description: Instant the document was retained, RFC 3339 UTC.
          examples:
            - '2026-11-13T15:20:03Z'
          format: date-time
          type: string
      required:
        - artifact_type
        - content_type
        - content_length
        - digest
        - retained_at
      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.