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

# Record the assignment set's endorsement term

> Records the endorsement/assignment term of one APPROVED set. Which of two paths runs is resolved from the fund's own configured term mode, never from this request: for a fund the Lender emits for, the term is rendered from that fund's own published endorsement-term template (a fund with no published template is refused — there is no generic layout) and payment waits for it; for a fund whose administrator generates the term, nothing is emitted and the administrator's signed PDF is registered, digested exactly as received. Recording it is optional and never gates payment, which opens at the fund's return file; recorded while the set is still at remessa_received, it moves the set to term_signed. The row is append-only: the same idempotency key replays, a new key supersedes by order without erasing, and the set state term_signed is reachable only once a term exists. A term the Lender emits waits while an open exception case names a line of the set that can no longer be sold (LENDER-0509): the operator takes that line out through its case first.



## OpenAPI

````yaml /pt/openapi/v3-current/lender.yaml post /api/v1/assignment/sets/{setId}/term
openapi: 3.1.0
info:
  contact:
    email: contact@lerian.studio
    name: Lerian Studio
    url: https://lerian.studio
  description: >-
    Code-first OpenAPI 3.1 surface for the Lender service. Routes that move
    money are at-most-once per X-Idempotency: when one answers 5xx, the
    X-Idempotency-Fenced response header says whether that key is now refusing
    resends (true) or free to retry (false or absent).
  license:
    name: Lerian Studio General License
  title: Lender API
  version: 1.0.0
servers:
  - url: https://lender.sandbox.lerian.net
security:
  - BearerAuth: []
tags:
  - description: >-
      Caller session projection: validated subject and effective permissions for
      the presented token.
    name: Session
  - description: >-
      Ledger accounting operations: journal entries and accrual postings for
      loan accounts. Operations under /api/v1/internal are back-office
      operations for the client's operators: they require a person's login, and
      a service credential gets 403.
    name: Accounting
  - description: >-
      Loan application intake and lifecycle: submission, decisioning, and
      status.
    name: LoanApplications
  - description: >-
      Loan product catalog: definition, versioning, and activation of lending
      products.
    name: LoanProducts
  - description: >-
      Loan account servicing operations: balances, schedules, and account-level
      actions.
    name: Loan Accounts
  - description: >-
      Portfolio dashboard read operations: aggregated portfolio and performance
      views.
    name: Dashboard
  - description: >-
      Jurisdiction registry: supported jurisdiction profiles and their
      capabilities.
    name: Jurisdictions
  - description: >-
      Jurisdiction-specific loan application operations (Brazil origination
      surface).
    name: Loan Applications
  - description: >-
      Tax computation operations for jurisdiction-specific lending (e.g. Brazil
      IOF).
    name: Tax
  - description: >-
      Brazil consignado privado operations: contract lifecycle, exclusion
      repair, and compensating adjustments. Operations under /api/v1/internal
      are back-office operations for the client's operators: they require a
      person's login, and a service credential gets 403.
    name: Consignado
  - description: >-
      Inbound record quarantine. Operations under /api/v1/internal are
      back-office operations for the client's operators: they require a person's
      login, and a service credential gets 403.
    name: Streaming
  - description: >-
      Credit-instrument document template registry: versioned drafting and
      publication of CCB clausulado.
    name: DocumentTemplates
paths:
  /api/v1/assignment/sets/{setId}/term:
    post:
      tags:
        - AssignmentDocuments
      summary: Record the assignment set's endorsement term
      description: >-
        Records the endorsement/assignment term of one APPROVED set. Which of
        two paths runs is resolved from the fund's own configured term mode,
        never from this request: for a fund the Lender emits for, the term is
        rendered from that fund's own published endorsement-term template (a
        fund with no published template is refused — there is no generic layout)
        and payment waits for it; for a fund whose administrator generates the
        term, nothing is emitted and the administrator's signed PDF is
        registered, digested exactly as received. Recording it is optional and
        never gates payment, which opens at the fund's return file; recorded
        while the set is still at remessa_received, it moves the set to
        term_signed. The row is append-only: the same idempotency key replays, a
        new key supersedes by order without erasing, and the set state
        term_signed is reachable only once a term exists. A term the Lender
        emits waits while an open exception case names a line of the set that
        can no longer be sold (LENDER-0509): the operator takes that line out
        through its case first.
      operationId: recordAssignmentTerm
      parameters:
        - description: Approved assignment set identifier (uuid).
          in: path
          name: setId
          required: true
          schema:
            description: Approved assignment set identifier (uuid).
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecordAssignmentTermHumaInputBody'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssignmentTermHumaBody'
          description: OK
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unauthorized
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Forbidden
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Not Found
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Conflict
        '413':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Request Entity Too Large
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unprocessable Entity
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Internal Server Error
        '503':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Service Unavailable
        '504':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Gateway Timeout
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            Any other status this operation may carry, rendered as a problem
            document — including a refusal produced ahead of the service, such
            as a gateway or ingress answering on its behalf.
components:
  schemas:
    RecordAssignmentTermHumaInputBody:
      additionalProperties: false
      properties:
        artifact:
          description: >-
            The administrator's own signed endorsement term, base64-encoded.
            Required if and only if the set froze administrator_generated as its
            term mode at assembly; refused for a set the Lender emits for.
          format: byte
          type: string
        artifactReference:
          description: >-
            The administrator's own identifier for that document (its
            term/protocol number). Required alongside artifact.
          maxLength: 256
          type: string
        coObligation:
          description: >-
            Whether this term binds the assignor to answer for the receivable it
            sold (coobrigação). REQUIRED, and the only accepted value is false.
            An omitted field is refused rather than read as false: silence about
            a signed instrument is not a statement about its clauses, and this
            table is append-only, so a term recorded under an assumption cannot
            be corrected afterwards. Same reason proposedRetainedFraction is
            required on the fund route. A term WITH co-obligation is a
            retained-risk assignment under Res. CMN 4.966: the receivable stays
            on the balance sheet, the price is recorded as a liability and the
            result is appropriated over the remaining term. That treatment does
            not exist yet, so the clause is refused rather than recorded and
            then booked as an outright sale. Declared here as a structured fact
            and never read out of the document's wording.
          type: boolean
        idempotencyKey:
          description: >-
            Caller idempotency key. The same key replays the same term; the same
            key over a different approved composition, a different template
            version or different artifact bytes is refused.
          maxLength: 256
          minLength: 1
          type: string
      required:
        - idempotencyKey
        - coObligation
      type: object
    AssignmentTermHumaBody:
      additionalProperties: false
      properties:
        assignmentFundId:
          description: The fund this term names (uuid).
          type: string
        assignmentSetId:
          description: The approved set this term covers (uuid).
          type: string
        coObligation:
          description: >-
            Whether this term binds the assignor to answer for the receivable it
            sold (coobrigação). Always false on a term this service recorded:
            the retained-risk treatment TRUE implies does not exist yet. NULL on
            a term recorded before the declaration existed — that is a gap in
            the record, not a statement that the instrument carries no recourse,
            and it must not be read as false.
          type:
            - boolean
            - 'null'
        contentDigest:
          description: sha-256 of the term document.
          type: string
        digestMethod:
          description: >-
            What contentDigest was computed over: the normalized form of our own
            render, or the raw bytes exactly as received.
          enum:
            - sha256_pdf_normalized
            - sha256_raw
          type: string
        documentTemplateVersionId:
          description: >-
            Template version rendered from; present only for a lender-emitted
            term.
          type: string
        externalReference:
          description: >-
            The administrator's own document identifier; administrator-generated
            only.
          type: string
        externalSource:
          description: >-
            The administrator on record for the fund; resolved server-side,
            administrator-generated only.
          type: string
        id:
          description: Term record identifier (uuid).
          type: string
        idempotencyKey:
          description: Caller's idempotency key.
          type: string
        inputFingerprint:
          description: sha-256 of the caller-controlled comparison payload.
          type: string
        origin:
          description: >-
            Which path produced this term: the term mode the set froze from the
            fund at assembly.
          enum:
            - lender_emitted
            - administrator_generated
          type: string
        pageGeometryRef:
          description: Versioned page geometry; lender-emitted only.
          type: string
        recordedAt:
          description: UTC registration instant (RFC3339).
          type: string
        recordedBy:
          description: Validated actor identity that recorded the term.
          type: string
        rendererVersion:
          description: Render engine identity; lender-emitted only.
          type: string
        replayed:
          description: >-
            True when this call replayed an existing term under the same
            idempotency key rather than recording a new one.
          type: boolean
        setSnapshotDigest:
          description: sha-256 of the frozen approved composition this term covers.
          type: string
        sizeBytes:
          description: Byte count custody actually stored.
          format: int64
          type: integer
        specVersion:
          description: Field-assembly rules version; lender-emitted only.
          type: string
      required:
        - id
        - assignmentSetId
        - assignmentFundId
        - idempotencyKey
        - origin
        - setSnapshotDigest
        - inputFingerprint
        - contentDigest
        - digestMethod
        - sizeBytes
        - coObligation
        - recordedAt
        - recordedBy
        - replayed
      type: object
    Detail:
      additionalProperties: true
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          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.