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

# Cancel an order

> Only works while the order is `DRAFT` or `AWAITING_DEPOSIT` — before funds are in transit. `400` for any later status (cancelling after funds move forfeits the conversion cost already incurred). No request body.



## OpenAPI

````yaml openapi-payouts-v2-0-0.json post /api/v2/payouts/{batchId}/orders/{orderId}/cancel
openapi: 3.0.3
info:
  title: Mansa Payout API — v2
  description: >
    API for registering Senders and Beneficiaries and for creating, funding, and
    tracking cross-border payout batches.


    ## Rate Limiting

    - 100 requests per minute per API key

    - Specific endpoints may have additional limits


    ## Security

    - All endpoints require authentication

    - Sender and Beneficiary profiles must clear KYC/KYB review (`status:
    "ready"`) before they can be used on an order


    ## Error Handling

    This API returns Nest's default error shape rather than a custom envelope.


    - **2xx** — The request succeeded.

    - **4xx** — The request failed due to a problem with the information
    provided.

    - **5xx** — A problem occurred on our servers or with an upstream
    dependency.


    Most errors have the shape:


    ```json

    {
      "statusCode": 400,
      "message": "..."
    }

    ```


    A `422` from a validation failure returns an array of per-field messages
    instead of one string:


    ```json

    {
      "statusCode": 422,
      "message": ["legal_name should not be empty", "country_code must be a valid ISO 3166-1 alpha-2 code"]
    }

    ```
  version: v2
  contact:
    name: Mansa API Support
    email: api-support@mansa.io
    url: https://docs.mansa.io
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.mansa.xyz
    description: Production server
  - url: https://sandbox-api.mansa.xyz
    description: Sandbox server
security:
  - ApiKeyAuth: []
    BearerAuth: []
tags:
  - name: Organizations
    description: Product entitlement checks
  - name: Senders
    description: Registering and verifying the org's own paying entities
  - name: Beneficiaries
    description: Registering and verifying who gets paid
  - name: Funding
    description: The org's USDT funding address and balance
  - name: Payouts
    description: Creating, funding, and tracking payout batches and orders
paths:
  /api/v2/payouts/{batchId}/orders/{orderId}/cancel:
    post:
      tags:
        - Payouts
      summary: Cancel an order
      description: >-
        Only works while the order is `DRAFT` or `AWAITING_DEPOSIT` — before
        funds are in transit. `400` for any later status (cancelling after funds
        move forfeits the conversion cost already incurred). No request body.
      operationId: cancelOrder
      parameters:
        - name: batchId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: ID of the batch
        - name: orderId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: ID of the order
      responses:
        '200':
          description: The cancelled order, now `CANCELLED_EXPIRED`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    Order:
      type: object
      properties:
        id:
          type: string
          format: uuid
        batch_id:
          type: string
          format: uuid
        sender_profile_id:
          type: string
          format: uuid
        beneficiary_profile_id:
          type: string
          format: uuid
        fee_type:
          type: string
          enum:
            - OUR
            - SHA
        purpose_code:
          $ref: '#/components/schemas/PurposeCode'
        beneficiary_amount:
          type: string
        beneficiary_currency:
          type: string
        fee_amount:
          type: string
          nullable: true
          description: Wire fee only, in `beneficiary_currency`.
        source_currency:
          type: string
          example: USDT
          description: Always "USDT" today
        source_amount:
          type: string
          nullable: true
          description: >-
            The number that matters for funding — already reflects everything
            the client is responsible for. Deliberately excludes the effective
            USDT↔fiat rate or anything that would let Mansa's own margin be
            back-computed.
        status:
          $ref: '#/components/schemas/OrderStatus'
        failure_message:
          type: string
          nullable: true
          description: Present only when `status` is `FAILED`. Safe to display.
        expires_at:
          type: string
          format: date-time
          nullable: true
          description: Set once the order reaches `AWAITING_DEPOSIT`.
        client_reference:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - batch_id
        - sender_profile_id
        - beneficiary_profile_id
        - fee_type
        - purpose_code
        - beneficiary_amount
        - beneficiary_currency
        - source_currency
        - status
        - created_at
        - updated_at
    PurposeCode:
      type: string
      enum:
        - SNTR
        - GDSP
        - LGST
        - ADVT
        - TECH
        - CLUD
        - RENT
        - UTIL
        - LAWF
        - ACCT
        - CONS
        - SPON
        - INVT
      description: >-
        SNTR Transfer of the same name · GDSP Payment · LGST Logistics costs ·
        ADVT Advertising costs · TECH Technical service fee · CLUD Cloud as a
        Service · RENT Rental costs · UTIL Utility expenses · LAWF Law firm fees
        · ACCT Accounting expenses · CONS Consultancy fees · SPON Sponsorship
        costs · INVT Investment & financial management
    OrderStatus:
      type: string
      enum:
        - DRAFT
        - AWAITING_DEPOSIT
        - DEPOSIT_RECEIVED
        - PAYING_BENEFICIARY
        - COMPLETED
        - FAILED
        - CANCELLED_EXPIRED
      description: >-
        DRAFT: created and quoted, still editable · AWAITING_DEPOSIT: confirmed,
        funding in progress (`expires_at` is the deadline) · DEPOSIT_RECEIVED:
        funding landed · PAYING_BENEFICIARY: beneficiary payment in flight ·
        COMPLETED, FAILED, CANCELLED_EXPIRED: terminal.
    NestErrorResponse:
      type: object
      description: Nest's default error envelope
      properties:
        statusCode:
          type: integer
          example: 400
        message:
          type: string
          example: sender not found
      required:
        - statusCode
        - message
      example:
        statusCode: 400
        message: sender not found
  responses:
    BadRequest:
      description: >-
        Invalid request — e.g. a referenced Sender/Beneficiary isn't `ready`, or
        the funding wallet balance is short.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NestErrorResponse'
          examples:
            default:
              value:
                statusCode: 400
                message: sender is not ready
    Unauthorized:
      description: Authentication required or invalid credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NestErrorResponse'
          examples:
            default:
              value:
                statusCode: 401
                message: Unauthorized
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NestErrorResponse'
          examples:
            default:
              value:
                statusCode: 404
                message: Sender not found
    RateLimited:
      description: Rate limit exceeded
      headers:
        X-RateLimit-Limit:
          description: Request limit per window
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: Remaining requests in window
          schema:
            type: integer
        X-RateLimit-Reset:
          description: UNIX epoch seconds when the rate limit resets
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NestErrorResponse'
          examples:
            default:
              value:
                statusCode: 429
                message: Too many requests
    ServerError:
      description: Internal server or upstream error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NestErrorResponse'
          examples:
            default:
              value:
                statusCode: 500
                message: Internal server error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        ES256 JWT signed by the private key registered to the API key above.
        Claims: sub (=API key), uri, nbf, iat, exp, and bodyHash (HMAC-SHA512 of
        uri + rawBody + nbf using a shared secret, base64).

````