> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tesouro.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel a transaction



## OpenAPI

````yaml /.tooling/schemas/rest/tags/product-finops.json post /finops/v1/transactions/{transaction_id}/cancel
openapi: 3.1.0
info:
  title: Tesouro Partner API
  version: '2025-06-23'
  description: The Tesouro REST API, for Tesouro partners to integrate with our solution.
  termsOfService: https://tesouro.com/terms
  contact:
    name: Tesouro team
    url: https://tesouro.com/about/
    email: developers@tesouro.com
servers:
  - url: https://api.sandbox.tesouro.com
    description: Sandbox
security: []
tags:
  - name: Accounting connections
  - name: Accounting data pull
  - name: Accounting synchronized records
  - name: Accounting tax rates
  - name: Analytics
  - name: Approval policies
  - name: Approval requests
  - name: Bank details
  - name: Comments
  - name: Cost centers
  - name: Counterpart VAT IDs
  - name: Counterpart addresses
  - name: Counterpart bank accounts
  - name: Counterpart contacts
  - name: Counterparts
  - name: Credit notes
  - name: Custom tax rates
  - name: Delivery notes
  - name: Documents
  - name: Entities
  - name: Entity users
  - name: Events
  - name: Files
  - name: Identity
  - name: Ledger accounts
  - name: Mail templates
  - name: Mailbox domains
  - name: Mailboxes
  - name: Measure units
  - name: OCR
  - name: Overdue reminders
  - name: PDF templates
  - name: Payable line items
  - name: Payables
  - name: Payment intents
  - name: Payment links
  - name: Payment methods
  - name: Payment records
  - name: Payment reminders
  - name: Payment terms
  - name: Products
  - name: Projects
  - name: Purchase orders
  - name: Receipts
  - name: Receivables
  - name: Recurrences
  - name: Tags
  - name: Text templates
  - name: Transactions
  - name: VAT rates
  - name: Webhook deliveries
  - name: Webhook subscriptions
paths:
  /finops/v1/transactions/{transaction_id}/cancel:
    post:
      tags:
        - Transactions
      summary: Cancel a transaction
      operationId: post_transactions_id_cancel
      parameters:
        - required: true
          schema:
            type: string
            format: date
          example: '2025-06-23'
          name: x-finops-version
          in: header
        - required: true
          schema:
            type: string
            format: uuid
          name: transaction_id
          in: path
        - description: The ID of the entity that owns the requested resource.
          required: true
          schema:
            type: string
            format: uuid
            examples:
              - 9d2b4c8f-2087-4738-ba91-7359683c49a4
          name: x-organization-id
          in: header
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchemaResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchemaResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchemaResponse'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchemaResponse'
        '409':
          description: Business logic error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchemaResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchemaResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    TransactionResponse:
      properties:
        id:
          type: string
          format: uuid
          description: A unique Monite-generated ID assigned to this transaction.
        amount:
          type: integer
          description: >-
            The transaction amount in [minor
            units](https://docs.monite.com/references/currencies#minor-units).
            Positive values for in-flow, negative values for out-flow.
        applied_policy_id:
          type: string
          format: uuid
          description: ID of the approval policy applied to this transaction, if any.
        currency:
          allOf:
            - $ref: '#/components/schemas/CurrencyEnum'
          description: ISO currency code.
          examples:
            - USD
        department_id:
          type: string
          format: uuid
          description: ID of the department associated with this transaction.
        description:
          type: string
          maxLength: 255
          description: A human-readable description of the transaction.
        entity_id:
          type: string
          format: uuid
          description: ID of the entity that owns this resource.
        entity_user_id:
          type: string
          format: uuid
          description: ID of the entity user who made the transaction, if applicable.
        expense_status:
          allOf:
            - $ref: '#/components/schemas/ExpenseStatusEnum'
          description: The current expense approval status of the transaction.
        external_id:
          type: string
          maxLength: 128
          description: >-
            External identifier for idempotency, if provided by the source
            system.
        has_validation_errors:
          type: boolean
          description: >-
            Whether the transaction has missing required fields per the entity's
            TransactionValidation config. Always false when no config is set.
        ledger_account_id:
          type: string
          format: uuid
          description: ID of the ledger account from the Accounting service.
        location_id:
          type: string
          format: uuid
          description: ID of the location associated with this transaction.
        merchant_amount:
          type: integer
          description: Original merchant transaction amount in minor units.
        merchant_currency:
          allOf:
            - $ref: '#/components/schemas/CurrencyEnum'
          description: ISO currency code for the `merchant_amount`.
        merchant_location:
          type: string
          maxLength: 128
          description: The merchant location.
          examples:
            - New York, US
        merchant_name:
          type: string
          maxLength: 128
          description: The merchant name.
          examples:
            - Acme Inc.
        no_receipt_reason:
          type: string
          description: >-
            Reason provided by the employee when submitting without a receipt
            (e.g. receipt was lost or unavailable). Set via the submit endpoint;
            bypasses the receipt_id required-field check.
        partner_metadata:
          additionalProperties:
            type: string
          type: object
          description: >-
            Extensible key-value pairs for storing additional custom information
            for partner needs.
        payment_method:
          $ref: '#/components/schemas/TransactionPaymentMethod'
        payment_processing_status:
          allOf:
            - $ref: '#/components/schemas/TransactionStatusEnum'
          description: The current processing status of the transaction.
          default: created
        receipt_file_url:
          type: string
          description: >-
            URL of the attached receipt's file. Present when receipt_id is set
            and the receipt is reachable; null otherwise.
        receipt_id:
          type: string
          description: ID of the related receipt from payables service, if any.
        reject_reason:
          type: string
          description: Optional reason explaining why the transaction was rejected.
        source_of_data:
          allOf:
            - $ref: '#/components/schemas/SourceOfData'
          description: >-
            Per-field source tracking. Each field indicates how its value was
            set: user, generated, or automatched.
        started_at:
          type: string
          format: date-time
          description: Date and time when the transaction was initiated.
        type:
          allOf:
            - $ref: '#/components/schemas/TransactionTypeEnum'
          description: The nature of the transaction.
      type: object
      required:
        - id
        - amount
        - currency
        - entity_id
        - expense_status
        - has_validation_errors
        - merchant_amount
        - merchant_currency
        - merchant_location
        - merchant_name
        - payment_method
        - started_at
        - type
    ErrorSchemaResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorSchema'
      type: object
      required:
        - error
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
      type: object
    CurrencyEnum:
      type: string
      enum:
        - AED
        - AFN
        - ALL
        - AMD
        - ANG
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BHD
        - BIF
        - BMD
        - BND
        - BOB
        - BRL
        - BSD
        - BTN
        - BWP
        - BYN
        - BZD
        - CAD
        - CDF
        - CHF
        - CLP
        - CNY
        - COP
        - CRC
        - CVE
        - CZK
        - DJF
        - DKK
        - DOP
        - DZD
        - EGP
        - ETB
        - EUR
        - FJD
        - FKP
        - GBP
        - GEL
        - GHS
        - GIP
        - GMD
        - GNF
        - GTQ
        - GYD
        - HKD
        - HNL
        - HTG
        - HUF
        - IDR
        - ILS
        - INR
        - IQD
        - ISK
        - JMD
        - JOD
        - JPY
        - KES
        - KGS
        - KHR
        - KMF
        - KRW
        - KWD
        - KYD
        - KZT
        - LAK
        - LBP
        - LKR
        - LRD
        - LSL
        - LYD
        - MAD
        - MDL
        - MGA
        - MKD
        - MMK
        - MNT
        - MOP
        - MUR
        - MVR
        - MWK
        - MXN
        - MYR
        - MZN
        - NAD
        - NGN
        - NIO
        - NOK
        - NPR
        - NZD
        - OMR
        - PAB
        - PEN
        - PGK
        - PHP
        - PKR
        - PLN
        - PYG
        - QAR
        - RON
        - RSD
        - RUB
        - RWF
        - SAR
        - SBD
        - SCR
        - SEK
        - SGD
        - SHP
        - SLE
        - SOS
        - SRD
        - SSP
        - SVC
        - SZL
        - THB
        - TJS
        - TMT
        - TND
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - USD
        - UYU
        - UZS
        - VND
        - VUV
        - WST
        - XAF
        - XCD
        - XOF
        - XPF
        - YER
        - ZAR
        - ZMW
    ExpenseStatusEnum:
      type: string
      enum:
        - new
        - approve_in_progress
        - approved
        - rejected
        - canceled
    TransactionPaymentMethod:
      oneOf:
        - $ref: '#/components/schemas/CardPaymentMethod'
        - $ref: '#/components/schemas/BankAccountPaymentMethod'
      discriminator:
        propertyName: type
        mapping:
          card:
            $ref: '#/components/schemas/CardPaymentMethod'
          bank_account:
            $ref: '#/components/schemas/BankAccountPaymentMethod'
    TransactionStatusEnum:
      type: string
      enum:
        - created
        - processing
        - succeeded
        - declined
        - refunded
        - failed
    SourceOfData:
      properties:
        department_id:
          allOf:
            - $ref: '#/components/schemas/FieldSourceEnum'
          description: Source of department_id.
        description:
          allOf:
            - $ref: '#/components/schemas/FieldSourceEnum'
          description: Source of description.
        ledger_account_id:
          allOf:
            - $ref: '#/components/schemas/FieldSourceEnum'
          description: Source of ledger_account_id.
        location_id:
          allOf:
            - $ref: '#/components/schemas/FieldSourceEnum'
          description: Source of location_id.
        receipt_id:
          allOf:
            - $ref: '#/components/schemas/FieldSourceEnum'
          description: Source of receipt_id.
      type: object
    TransactionTypeEnum:
      type: string
      enum:
        - capture
        - refund
        - cash_withdrawal
        - fee
        - adjustment
        - reversal
    ErrorSchema:
      properties:
        message:
          type: string
      type: object
      required:
        - message
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
        msg:
          type: string
        type:
          type: string
      type: object
      required:
        - loc
        - msg
        - type
    CardPaymentMethod:
      properties:
        details:
          $ref: '#/components/schemas/CardPaymentMethodDetails'
        type:
          type: string
          enum:
            - card
      type: object
      required:
        - details
        - type
    BankAccountPaymentMethod:
      properties:
        details:
          $ref: '#/components/schemas/BankAccountPaymentMethodDetails'
        type:
          type: string
          enum:
            - bank_account
      type: object
      required:
        - details
        - type
    FieldSourceEnum:
      type: string
      enum:
        - user
        - generated
        - automatched
    CardPaymentMethodDetails:
      properties:
        brand:
          type: string
          maxLength: 32
          description: The card brand name.
        card_type:
          allOf:
            - $ref: '#/components/schemas/CardTypeEnum'
          description: The card type
        expiry_month:
          type: integer
          maximum: 12
          minimum: 1
          description: The card's expiration month (1 - January, 12 - December).
        expiry_year:
          type: integer
          maximum: 2099
          exclusiveMinimum: 2001
          description: The card's expiration year.
        last4:
          type: string
          maxLength: 4
          minLength: 4
          description: The last four digits of the card number.
          examples:
            - 1234
      type: object
      required:
        - brand
        - card_type
        - expiry_month
        - expiry_year
        - last4
    BankAccountPaymentMethodDetails:
      properties:
        account_holder_name:
          type: string
          description: The name of the person or business that owns this bank account.
          examples:
            - Bob Jones
        account_number:
          type: string
          description: >-
            The bank account number. US account numbers contain 9 to 12 digits.
            UK account numbers typically contain 8 digits.
          examples:
            - '12345678'
        bic:
          type: string
          maxLength: 11
          description: >-
            The SWIFT/BIC code of the bank. Can be either 8 or 11 characters
            long.
          examples:
            - CHASUS33XXX
        currency:
          allOf:
            - $ref: '#/components/schemas/CurrencyEnum'
          description: ISO currency code of the bank account.
        iban:
          type: string
          maxLength: 34
          description: The IBAN of the bank account, up to 34 characters.
          examples:
            - GB29NWBK60161331926819
        name:
          type: string
          maxLength: 200
          description: >-
            The name of the bank account, if available. For example, "Primary
            account" or "Savings account".
        routing_number:
          type: string
          description: >-
            The bank's routing transit number (RTN). US routing numbers consist
            of 9 digits.
        sort_code:
          type: string
          description: The bank's sort code.
          examples:
            - '123456'
      type: object
    CardTypeEnum:
      type: string
      enum:
        - credit
        - debit
        - prepaid
        - unknown
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````