> ## 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 um ajuste

> Use este endpoint para criar um lançamento contábil de balanceamento (por exemplo, tarifa bancária, diferença de câmbio) para resolver variações entre transações conciliadas ou em uma única transação.



## OpenAPI

````yaml pt/openapi/v3-current/matcher.yaml post /v1/matching/adjustments
openapi: 3.1.0
info:
  title: Matcher APIs
  description: >-
    Referência completa de API para o motor de conciliação Matcher, que fornece
    conciliação automática de transações entre o Midaz Ledger e sistemas
    externos.
  version: 4.1.0
  license:
    name: Lerian Studio General License
servers:
  - url: https://matcher.sandbox.lerian.net
security: []
paths:
  /v1/matching/adjustments:
    post:
      tags:
        - Matching
      summary: Criar um ajuste
      description: >-
        Use este endpoint para criar um lançamento contábil de balanceamento
        (por exemplo, tarifa bancária, diferença de câmbio) para resolver
        variações entre transações conciliadas ou em uma única transação.
      operationId: createAdjustment
      parameters:
        - description: A unique identifier for tracing the request across services.
          in: header
          name: X-Request-Id
          schema:
            type: string
        - description: Context ID
          in: query
          name: contextId
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/XIdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAdjustmentRequest'
        description: Payload de ajuste
        required: true
      responses:
        '201':
          description: >-
            Indica que o recurso foi criado com sucesso.


            A resposta inclui o cabeçalho `X-Idempotency-Replayed`.


            Se o valor for false, a requisição acabou de ser processada. Se o
            valor for true, a resposta é uma repetição de uma requisição
            processada anteriormente.


            Consulte [Retries and
            idempotency](/pt/reference/retries-idempotency) para mais detalhes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdjustmentResponse'
          headers:
            X-Idempotency-Replayed:
              $ref: '#/components/headers/XIdempotencyReplayed'
        '400':
          description: A requisição contém parâmetros ou payload inválidos.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: A requisição não contém credenciais de autenticação válidas.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Você não tem permissão para acessar este recurso.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: O recurso solicitado não foi encontrado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Ocorreu um erro inesperado no servidor.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  parameters:
    XIdempotencyKey:
      name: X-Idempotency-Key
      in: header
      required: false
      description: >-
        Chave de idempotência opcional para novas tentativas seguras. Também
        aceita `Idempotency-Key` como nome alternativo do cabeçalho. Se a mesma
        chave for enviada novamente e a requisição original já tiver sido
        processada, a resposta em cache é retornada com `X-Idempotency-Replayed:
        true`.


        Consulte [Novas tentativas e
        idempotência](/pt/reference/retries-idempotency) para mais detalhes.
      schema:
        type: string
  schemas:
    CreateAdjustmentRequest:
      properties:
        amount:
          example: '10.50'
          type: string
        currency:
          example: BRL
          type: string
        direction:
          description: Direção do ajuste
          enum:
            - DEBIT
            - CREDIT
          example: DEBIT
          type: string
        description:
          example: Bank wire fee adjustment
          type: string
        matchGroupId:
          example: 019c96a0-0b74-768c-8d25-2bf065dca2f8
          format: uuid
          type: string
        reason:
          example: Variance due to bank processing fee
          type: string
        transactionId:
          example: 019c96a0-10ce-75fc-a273-dc799079a99c
          format: uuid
          type: string
        type:
          enum:
            - BANK_FEE
            - FX_DIFFERENCE
            - ROUNDING
            - WRITE_OFF
            - MISCELLANEOUS
          example: BANK_FEE
          type: string
      required:
        - amount
        - currency
        - description
        - direction
        - reason
        - type
      type: object
    AdjustmentResponse:
      properties:
        adjustment:
          $ref: '#/components/schemas/Adjustment'
      type: object
    ErrorResponse:
      description: Resposta de erro padrão retornada por todos os endpoints da API
      type: object
      required:
        - code
        - title
        - message
      properties:
        code:
          type: string
          description: Código de erro de aplicação estável.
          example: MTCH-0001
        title:
          type: string
          description: Título de erro legível por humanos.
          example: Bad Request
        message:
          type: string
          description: Mensagem de erro legível com detalhes.
          example: context not found
        error:
          type: string
          description: Descontinuado. Mensagem de erro para compatibilidade retroativa.
          deprecated: true
        details:
          description: Contexto adicional do erro como pares chave-valor
          additionalProperties: {}
          type: object
    Adjustment:
      properties:
        amount:
          type: number
        contextId:
          type: string
        createdAt:
          type: string
        createdBy:
          type: string
        currency:
          type: string
        description:
          type: string
        id:
          type: string
        matchGroupId:
          type: string
        reason:
          type: string
        transactionId:
          type: string
        type:
          $ref: '#/components/schemas/AdjustmentType'
        updatedAt:
          type: string
      type: object
    AdjustmentType:
      enum:
        - BANK_FEE
        - FX_DIFFERENCE
        - ROUNDING
        - WRITE_OFF
        - MISCELLANEOUS
      type: string
      x-enum-varnames:
        - AdjustmentTypeBankFee
        - AdjustmentTypeFXDifference
        - AdjustmentTypeRounding
        - AdjustmentTypeWriteOff
        - AdjustmentTypeMiscellaneous
  headers:
    XIdempotencyReplayed:
      description: >-
        Indica se esta resposta foi servida a partir do cache de idempotência.
        Quando `true`, a resposta é uma repetição da requisição original com a
        mesma chave de idempotência.


        Consulte [Novas tentativas e
        idempotência](/pt/reference/retries-idempotency) para mais detalhes.
      schema:
        type: boolean
      example: false
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Autenticação por Bearer token (formato: "Bearer {token}")'

````