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

# Criar uma transação usando o modelo de desbloqueio da v2



## OpenAPI

````yaml pt/openapi/v3-current/ledger.yaml post /v2/transactions/unblock
openapi: 3.1.0
info:
  title: API Midaz Ledger
  version: 4.0.0
servers:
  - url: /
security: []
tags:
  - name: Tipos de conta (v1)
  - name: Tipos de conta (v2)
  - name: Contas (v1)
  - name: Contas (v2)
  - name: Taxas de ativos (v1)
  - name: Ativos (v1)
  - name: Ativos (v2)
  - name: Saldos (v1)
  - name: Saldos (v2)
  - name: Cálculo de cobrança (v2)
  - name: Pacotes de cobrança (v2)
  - name: Composição (v2)
  - name: Criptografia (v2)
  - name: Taxas (v2)
  - name: Titulares (v2)
  - name: Instrumentos (v2)
  - name: Ledgers (v1)
  - name: Ledgers (v2)
  - name: Índices de metadados (v1)
  - name: Índices de metadados (v2)
  - name: Rotas de operação (v1)
  - name: Rotas de operação (v2)
  - name: Operações (v1)
  - name: Operações (v2)
  - name: Organizações (v1)
  - name: Organizações (v2)
  - name: Pacotes (v2)
  - name: Portfólios (v1)
  - name: Portfólios (v2)
  - name: Proteção (v2)
  - name: Segmentos (v1)
  - name: Segmentos (v2)
  - name: Rotas de transação (v1)
  - name: Rotas de transação (v2)
  - name: Transações (v1)
  - name: Transações (v2)
paths:
  /v2/transactions/unblock:
    post:
      tags:
        - Transações (v2)
      summary: Criar uma transação usando o modelo de desbloqueio da v2
      operationId: createTransactionUnblockV2
      parameters:
        - description: >-
            Idempotency key to safely retry the create; an identical retry
            returns the original transaction
          in: header
          name: X-Idempotency
          schema:
            description: >-
              Idempotency key to safely retry the create; an identical retry
              returns the original transaction
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTransactionV2Input'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionV2'
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error
      security:
        - BearerAuth: []
components:
  schemas:
    CreateTransactionV2Input:
      additionalProperties: false
      description: >-
        Transaction request body. `debits` and `credits` are the two required,
        non-empty leg arrays of the transaction; one debit paired with many
        credits, or the reverse, is a valid request. Every leg names the
        `organizationId` and `ledgerId` its account belongs to; all of them must
        name the SAME pair, and that pair is the organization and ledger the
        transaction is created in. A request whose accounts name different pairs
        is rejected. `asset`, `amount`, `description`, `code`, `routeId`,
        `operationRouteId` and `metadata` sit alongside the two leg arrays, and
        `amount` is the transaction total that the legs' `share` expressions
        divide. Each leg array holds at most 500 legs.
      properties:
        amount:
          type: string
        asset:
          type: string
        code:
          type: string
        credits:
          items:
            $ref: '#/components/schemas/V2LegInput'
          maxItems: 500
          minItems: 1
          type: array
        debits:
          items:
            $ref: '#/components/schemas/V2LegInput'
          maxItems: 500
          minItems: 1
          type: array
        description:
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operationRouteId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
      required:
        - asset
        - amount
        - debits
        - credits
      type: object
    TransactionV2:
      additionalProperties: false
      properties:
        amount:
          examples:
            - '1500'
          minimum: 0
          type:
            - string
            - 'null'
        assetCode:
          examples:
            - BRL
          maxLength: 10
          minLength: 2
          type: string
        createdAt:
          examples:
            - '2021-01-01T00:00:00Z'
          format: date-time
          type: string
        credit:
          examples:
            - - '@person2'
          items:
            type: string
          type:
            - array
            - 'null'
        debit:
          examples:
            - - '@person1'
          items:
            type: string
          type:
            - array
            - 'null'
        deletedAt:
          examples:
            - '2021-01-01T00:00:00Z'
          format: date-time
          type:
            - string
            - 'null'
        description:
          examples:
            - Transaction description
          maxLength: 256
          type: string
        feesSkipped:
          examples:
            - false
          type: boolean
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operations:
          items:
            $ref: '#/components/schemas/OperationV2'
          type:
            - array
            - 'null'
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        parentTransactionId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        status:
          $ref: '#/components/schemas/TransactionStatus'
        tracerSkipped:
          examples:
            - false
          type: boolean
        updatedAt:
          examples:
            - '2021-01-01T00:00:00Z'
          format: date-time
          type: string
      required:
        - id
        - description
        - status
        - amount
        - assetCode
        - debit
        - credit
        - ledgerId
        - organizationId
        - feesSkipped
        - tracerSkipped
        - createdAt
        - updatedAt
        - deletedAt
        - operations
      type: object
    Error:
      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
    V2LegInput:
      additionalProperties: false
      description: >-
        One leg of a transaction side. Fill EXACTLY ONE value expression per
        leg: `amount` for an explicit value, or `share` for a percentage of the
        transaction total. A leg carrying both, or neither, is rejected.
      properties:
        alias:
          type: string
        amount:
          type: string
        description:
          maxLength: 256
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        operationRouteId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        share:
          $ref: '#/components/schemas/V2ShareInput'
      required:
        - alias
        - organizationId
        - ledgerId
      type: object
    OperationV2:
      additionalProperties: false
      properties:
        accountAlias:
          examples:
            - '@person1'
          maxLength: 256
          type: string
        accountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        amount:
          $ref: '#/components/schemas/OperationAmount'
        assetCode:
          examples:
            - BRL
          maxLength: 10
          minLength: 2
          type: string
        balance:
          $ref: '#/components/schemas/OperationBalance'
        balanceAffected:
          examples:
            - true
          format: boolean
          type: boolean
        balanceAfter:
          $ref: '#/components/schemas/OperationBalance'
        balanceId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        balanceKey:
          examples:
            - asset-freeze
          maxLength: 100
          type: string
        createdAt:
          examples:
            - '2021-01-01T00:00:00Z'
          format: date-time
          type: string
        deletedAt:
          examples:
            - '2021-01-01T00:00:00Z'
          format: date-time
          type:
            - string
            - 'null'
        description:
          examples:
            - Credit card operation
          maxLength: 256
          type: string
        direction:
          examples:
            - debit
          maxLength: 50
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        routeCode:
          examples:
            - ROUTE-001
          maxLength: 100
          type: string
        routeDescription:
          examples:
            - Settlement route for service charges
          maxLength: 250
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        status:
          $ref: '#/components/schemas/OperationStatus'
        transactionId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        type:
          examples:
            - DEBIT
          maxLength: 50
          type: string
        updatedAt:
          examples:
            - '2021-01-01T00:00:00Z'
          format: date-time
          type: string
      required:
        - id
        - transactionId
        - description
        - type
        - assetCode
        - amount
        - balance
        - balanceAfter
        - status
        - accountId
        - accountAlias
        - balanceKey
        - balanceId
        - organizationId
        - ledgerId
        - balanceAffected
        - createdAt
        - updatedAt
        - deletedAt
        - metadata
      type: object
    TransactionStatus:
      additionalProperties: false
      properties:
        code:
          examples:
            - ACTIVE
          maxLength: 100
          type: string
        description:
          examples:
            - Active status
          maxLength: 256
          type:
            - string
            - 'null'
      required:
        - code
        - description
      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
    V2ShareInput:
      additionalProperties: false
      properties:
        percentage:
          examples:
            - 60
          format: int64
          maximum: 100
          minimum: 1
          type: integer
        percentageOfPercentage:
          examples:
            - 50
          format: int64
          maximum: 100
          minimum: 0
          type: integer
      required:
        - percentage
      type: object
    OperationAmount:
      additionalProperties: false
      properties:
        value:
          examples:
            - '1500'
          minimum: 0
          type:
            - string
            - 'null'
      required:
        - value
      type: object
    OperationBalance:
      additionalProperties: false
      properties:
        available:
          examples:
            - '1500'
          minimum: 0
          type:
            - string
            - 'null'
        onHold:
          examples:
            - '500'
          minimum: 0
          type:
            - string
            - 'null'
        overdraftUsed:
          examples:
            - '130'
          minimum: 0
          type: string
        version:
          examples:
            - 2
          format: int64
          minimum: 0
          type:
            - integer
            - 'null'
      required:
        - available
        - onHold
        - version
        - overdraftUsed
      type: object
    OperationStatus:
      additionalProperties: false
      properties:
        code:
          examples:
            - ACTIVE
          maxLength: 100
          type: string
        description:
          examples:
            - Active status
          maxLength: 256
          type:
            - string
            - 'null'
      required:
        - code
        - description
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````