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

# Cancel a transaction

> Requires a user API key, an explicit AI that owns the transaction, and an Idempotency-Key. A funded provider payment must use the refund flow.



## OpenAPI

````yaml /openapi-v2.json post /act/transactions/{transactionId}/cancel
openapi: 3.1.0
info:
  title: Darwin API v2
  version: 2.0.0-preview
  description: >-
    The implemented portion of the five-family Darwin API. Operations are added
    only after runtime and contract verification.
servers:
  - url: https://api.darwin.so/api/v2
    description: Production — use live `darwin_…` keys.
  - url: https://api.dev.darwin.so/api/v2
    description: Sandbox — use isolated `darwin_test_…` keys.
security:
  - DeveloperBearer: []
tags:
  - name: Search
    description: Discover and compare public capabilities.
  - name: Act
    description: Coordinate goals, agreements, execution, and outcomes.
  - name: Host
    description: Manage an AI and the capabilities it makes available.
  - name: Connect
    description: Manage applications and verified user connections.
  - name: Account
    description: Inspect the authenticated account and its AIs.
paths:
  /act/transactions/{transactionId}/cancel:
    post:
      tags:
        - Act
      summary: Cancel a transaction
      description: >-
        Requires a user API key, an explicit AI that owns the transaction, and
        an Idempotency-Key. A funded provider payment must use the refund flow.
      operationId: cancelActTransaction
      parameters:
        - name: transactionId
          in: path
          required: true
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          required: true
          description: A caller-generated key, unique to this operation and payload.
          schema:
            type: string
            minLength: 1
            maxLength: 200
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - aiId
              properties:
                aiId:
                  type: string
                  maxLength: 200
      responses:
        '200':
          description: The updated transaction.
          content:
            application/json:
              schema:
                type: object
                required:
                  - transaction
                properties:
                  transaction:
                    $ref: '#/components/schemas/Transaction'
        '400':
          description: The request was invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: The bearer key is missing, invalid, expired, or revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The principal does not have the required scope or resource access.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: The resource was not found for this principal.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Transaction:
      type: object
      additionalProperties: false
      required:
        - id
        - transactionId
        - goalId
        - dealId
        - mode
        - reservedCapMinor
        - subtotalMinor
        - darwinFeeMinor
        - taxAmountMinor
        - settledAmountMinor
        - releasedAmountMinor
        - currency
        - status
        - settlementMode
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
        transactionId:
          type: string
        goalId:
          type: string
        dealId:
          type: string
        mode:
          $ref: '#/components/schemas/WorkMode'
        reservedCapMinor:
          type: integer
          minimum: 0
        subtotalMinor:
          type: integer
          minimum: 0
        darwinFeeMinor:
          type: integer
          minimum: 0
        feeBps:
          type: integer
          minimum: 0
        feeAttributionReason:
          type: string
        feePolicyVersion:
          type: integer
          minimum: 1
        taxAmountMinor:
          type: integer
          minimum: 0
        settledAmountMinor:
          type:
            - integer
            - 'null'
          minimum: 0
        releasedAmountMinor:
          type: integer
          minimum: 0
        refundedAmountMinor:
          type: integer
          minimum: 0
        currency:
          type: string
        status:
          type: string
        settlementMode:
          type: string
          enum:
            - fixed
            - performance
        sellerAcceptanceStatus:
          type: string
        customerAccountStatus:
          type: string
        fulfillmentStatus:
          type: string
        fundedAt:
          type:
            - string
            - 'null'
          format: date-time
        transferredAt:
          type:
            - string
            - 'null'
          format: date-time
        refundedAt:
          type:
            - string
            - 'null'
          format: date-time
        disputedAt:
          type:
            - string
            - 'null'
          format: date-time
        canceledAt:
          type:
            - string
            - 'null'
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        error:
          type: string
    WorkMode:
      type: string
      enum:
        - BUY
        - SELL
        - CHAT
      description: The workflow view for shared Darwin work resources.
  securitySchemes:
    DeveloperBearer:
      type: http
      scheme: bearer
      bearerFormat: Darwin API key
      description: >-
        Production keys begin with `darwin_`. Isolated sandbox keys begin with
        `darwin_test_`. Create keys in Developer settings.

````