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

# Compose and send a curated STR message

> Catalog-gated, maker-checker-routed, per-type curated message-compose surface. The chosen capabilityId must be in the compose allowlist (STR0004/STR0005/STR0006/STR0007/STR0008/STR0053), resolve in the catalog, and be PUBLICLY_SUBMITTABLE; otherwise the request is rejected SPB-0003 (HTTP 400). The message is built through the shared compose pipeline and inherits the alçada emission gate: an amount above its band parks in PENDING_APPROVAL (visible in GET /v1/str/emission-approvals, emissionApprovalId set) and dispatches on quorum; below band it is SUBMITTED. Idempotent — replaying the same X-Idempotency key returns the same emission. The declared amount is forwarded verbatim; no position is summed.



## OpenAPI

````yaml en/openapi/v3-current/spb.yaml post /v1/str/messages/compose
openapi: 3.1.0
info:
  contact:
    email: contact@lerian.studio
    name: Lerian Studio
    url: https://lerian.studio
  description: >-
    OpenAPI 3.1 surface for Lerian SPB, the direct integration between the
    institution and the Brazilian Payment System (SPB) over the National
    Financial System Network (RSFN). It covers the Reserve Transfer System
    (STR): message registry and capability catalog, operation lifecycle (bank
    transfers, IBS repasses, liquidity transfers, returns and cancellations),
    reserve-account and schedule queries, alçada governance, reconciliation, and
    event delivery.
  license:
    name: Lerian Studio General License
  title: Lerian SPB API
  version: 1.0.0
servers:
  - url: https://spb.sandbox.lerian.net
security: []
tags:
  - description: Immutable audit-record trails for STR operations and lifecycle events.
    name: Audit
  - description: >-
      STR capability catalog describing supported message types and their
      constraints.
    name: Capabilities
  - description: >-
      ICP-Brasil certificate inventory with hot-reloadable rotation and
      activation.
    name: Certificates
  - description: >-
      Maker-checker approval queue for emissions parked above their alçada band:
      list pending, sign (approve), and deny.
    name: EmissionApprovals
  - description: Webhook event-delivery records with retry control for failed dispatches.
    name: EventDeliveries
  - description: Operation event catalog enumerating the emitted domain event types.
    name: Events
  - description: >-
      Inbound GEN-family notice log (GEN0001 connectivity echo, GEN0004
      transmission error, GEN0005 administrative notice).
    name: GenNotices
  - description: >-
      SPB alçada governance: the value-band table and per-message-type signature
      requirements, hot-reloaded at runtime.
    name: Governance
  - description: >-
      Read raw STR message status: list messages and read a single message by
      NUOp.
    name: Messages
  - description: Aggregated operational summaries and metrics across STR operations.
    name: OperationalIntelligence
  - description: >-
      STR operation lifecycle for bank transfers and IBS repasses, including
      returns and cancellations.
    name: Operations
  - description: >-
      Service readiness state covering startup self-probes and dependency
      health.
    name: Readiness
  - description: Reconciliation cases and the actions that resolve operation discrepancies.
    name: Reconciliation
  - description: >-
      STR reports suite: synchronous, date-ranged aggregate reports (financial
      movement, rejected transactions, volumetria) over Lerian SPB's own
      transmission record.
    name: Reports
  - description: >-
      STR0013 reserve-account balance and STR0014 statement (extrato,
      message-mode) queries and their async results.
    name: ReserveQueries
  - description: >-
      GEN0019 participant responsável roster: full-replacement updates announced
      to BACEN.
    name: Responsibles
  - description: STR operating-window schedule governing when operations may be sent.
    name: Schedule
  - description: >-
      STR0001 single-party schedule queries (consulta de horários do STR) and
      their async STR0001R1 grid results.
    name: ScheduleQueries
  - description: Runtime SPB configuration settings for the STR integration.
    name: Settings
  - description: Webhook endpoint registration and management for event delivery.
    name: Webhooks
  - description: >-
      Flow (mandatory order): certificate → readiness → connectivity-test →
      submit. Activate a certificate, confirm the rail reports ready, pass a
      connectivity test, then submit an operation. Each step is its own
      resource; a submit must not be attempted before readiness passes.
    name: onboarding
  - description: >-
      Flow (mandatory order): parent operation SETTLED → return/cancel. A return
      or cancellation is a sub-resource of a settled parent operation; the
      {operationId}/{endToEndID} path segment enforces the parent structurally.
    name: lifecycle
paths:
  /v1/str/messages/compose:
    post:
      tags:
        - Messages
      summary: Compose and send a curated STR message
      description: >-
        Catalog-gated, maker-checker-routed, per-type curated message-compose
        surface. The chosen capabilityId must be in the compose allowlist
        (STR0004/STR0005/STR0006/STR0007/STR0008/STR0053), resolve in the
        catalog, and be PUBLICLY_SUBMITTABLE; otherwise the request is rejected
        SPB-0003 (HTTP 400). The message is built through the shared compose
        pipeline and inherits the alçada emission gate: an amount above its band
        parks in PENDING_APPROVAL (visible in GET /v1/str/emission-approvals,
        emissionApprovalId set) and dispatches on quorum; below band it is
        SUBMITTED. Idempotent — replaying the same X-Idempotency key returns the
        same emission. The declared amount is forwarded verbatim; no position is
        summed.
      operationId: composeStrMessage
      parameters:
        - description: >-
            Bearer JWT token (the maker subject is derived from it for the
            alçada gate).
          in: header
          name: Authorization
          schema:
            description: >-
              Bearer JWT token (the maker subject is derived from it for the
              alçada gate).
            type: string
        - description: Idempotency key (canonical; legacy alias X-Idempotency-Key).
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key (canonical; legacy alias X-Idempotency-Key).
            type: string
        - description: Idempotency key (legacy alias).
          in: header
          name: X-Idempotency-Key
          schema:
            description: Idempotency key (legacy alias).
            type: string
        - description: Idempotency key TTL in seconds.
          in: header
          name: X-TTL
          schema:
            description: Idempotency key TTL in seconds.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ComposeMessageRequest'
      responses:
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComposeMessageResponse'
          description: Accepted
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      security:
        - BearerAuth: []
components:
  schemas:
    ComposeMessageRequest:
      additionalProperties: false
      properties:
        amount:
          description: >-
            Transfer amount as a decimal string in BRL, minor-unit precision
            (two decimal places). Forwarded VERBATIM into the submit DTO and the
            alçada gate — Lerian SPB performs NO arithmetic on it.
          examples:
            - '150000.00'
          pattern: ^[0-9]+(\.[0-9]+)?$
          type: string
        capabilityId:
          description: >-
            STR capability code to compose. Must resolve in the catalog, be
            PUBLICLY_SUBMITTABLE, and be in the compose allowlist
            (STR0004/STR0005/STR0006/STR0007/STR0008/STR0053).
          examples:
            - STR0008
          type: string
        description:
          description: >-
            Optional free-text description; mandatory when purposeCode or
            finlddCli is 99999 (RSTR0034). Serialized into the STR Hist element.
          examples:
            - Wire transfer for invoice 2026-Q2-A47
          type: string
        finlddCli:
          description: >-
            Optional client-level purpose code (5 digits) carried on
            STR0004/STR0008. When 99999 the description is required (RSTR0034).
          examples:
            - '00001'
          pattern: ^[0-9]{5}$
          type: string
        metadata:
          additionalProperties: {}
          description: >-
            Opaque client-side metadata forwarded verbatim to the submit DTO
            (NOT sent to BACEN). Do not include sensitive fields.
          type: object
        purposeCode:
          description: >-
            BACEN STR purpose code (finalidade), exactly 5 digits. When 99999
            (Outros) a description is mandatory (RSTR0034).
          examples:
            - '00001'
          pattern: ^[0-9]{5}$
          type: string
        recipient:
          $ref: '#/components/schemas/ComposeParticipantAccount'
          description: Crediting (creditor) participant account receiving the transfer.
        sender:
          $ref: '#/components/schemas/ComposeParticipantAccount'
          description: Debiting (debtor) participant account originating the transfer.
      required:
        - capabilityId
        - sender
        - recipient
        - amount
        - purposeCode
      type: object
    ComposeMessageResponse:
      additionalProperties: false
      properties:
        controlNumber:
          description: >-
            14-digit STR control number identifying the message on the SPB
            network.
          examples:
            - '20260621000001'
          type: string
        correlationId:
          description: >-
            Request-scoped correlation identifier echoing X-Request-ID, for
            pivoting from response to trace.
          examples:
            - req-7a3f9c2e
          type: string
        emissionApprovalId:
          description: >-
            Set ONLY when the emission parked: the maker-checker queue id (equal
            to messageId). Poll GET /v1/str/emission-approvals to track it.
            Empty when SUBMITTED immediately.
          examples:
            - 6f2c8a1e-...
          type: string
        messageId:
          description: >-
            Internal outbound-message id assigned at persistence time; the key
            for the approval queue when parked.
          examples:
            - 6f2c8a1e-...
          type: string
        nuOp:
          description: >-
            23-digit STR operation number stamped on the composed message
            (protocol correlation).
          examples:
            - '12345678202606210000001'
          type: string
        requiredSignatures:
          description: >-
            N-of-M distinct-actor quorum the parked emission must collect (the
            alçada band requirement). Omitted/0 when SUBMITTED immediately.
          examples:
            - 2
          format: int64
          type: integer
        status:
          description: >-
            Emission status: SUBMITTED (dispatched / liquidatable) or
            PENDING_APPROVAL (parked awaiting maker-checker quorum).
          examples:
            - PENDING_APPROVAL
          type: string
      required:
        - messageId
        - status
        - nuOp
        - controlNumber
        - correlationId
      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
      type: object
    ComposeParticipantAccount:
      additionalProperties: false
      properties:
        account:
          description: Optional traditional bank account number.
          examples:
            - '123456'
          type: string
        accountType:
          description: >-
            Optional account type: CC (checking/conta corrente) or PP (payment
            account/conta de pagamento).
          examples:
            - CC
          type: string
        branch:
          description: Optional bank branch (agência) number.
          examples:
            - '0001'
          type: string
        document:
          description: >-
            Holder document (CPF/CNPJ, digits only). Carried on the client codes
            STR0007/STR0008.
          examples:
            - '12345678901'
          type: string
        ispb:
          description: Participant ISPB, the 8-digit BACEN institution identifier.
          examples:
            - '12345678'
          maxLength: 8
          minLength: 8
          pattern: ^[0-9]{8}$
          type: string
        name:
          description: Holder name. Carried on the client codes STR0007/STR0008.
          examples:
            - João da Silva
          type: string
        paymentAccount:
          description: >-
            Optional payment account identifier (conta de pagamento). Required
            when accountType is PP.
          examples:
            - '00000000123456'
          type: string
      required:
        - ispb
      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
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````