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

# Cancel working orders on an account

> Cancels an account's working orders without closing any position, with the organization API key. Positions stay open, and the account keeps its status and is not locked out.

- **Default:** every working order is cancelled except the take-profit and stop-loss orders protecting an open position. Cancelling an entry order also cancels the take-profit and stop-loss attached to it. This matches a trader's "Cancel all".
- **`includeExits: true`:** the take-profit and stop-loss orders of open positions are cancelled too.
- **`contract`:** only that contract's orders are considered; other contracts are untouched.

Works while the market is closed. Each cancelled order appears on the real-time stream (`OrderCancelled`) and in order history with reason `Admin cancel: <who> — <your reason>` (trigger `admin_flatten`). When anything was cancelled, an `ACCOUNT_UPDATED` event (trigger `admin_orders_cancel`) lands on the account's event log and goes to `account.updated` webhooks.

**Retries:** safe. A repeated call cancels nothing more and answers 200 with `ordersCancelled: 0`; an `Idempotency-Key` header returns the first answer instead.

To close a position as well, use `POST .../positions/{contract}/close` or `POST .../flatten`.

Requires **manage** permission on traders.

```bash
curl -X POST "https://api.hyperprop.com/platform/v1/organization/trading-accounts/7c9e6679-7425-40de-944b-e07fc1f90ae7/orders/cancel" \
  -H "X-API-Key: hp_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"reason": "Risk review", "contract": "MNQZ6"}'
```



## OpenAPI

````yaml https://api.hyperprop.com/platform/openapi.json post /v1/organization/trading-accounts/{accountId}/orders/cancel
openapi: 3.0.0
info:
  title: Hyperprop Platform API
  version: 1.0.0
  description: >-
    REST API for the Hyperprop Trading Platform — provision evaluation and
    funded trading accounts, manage traders and plans, react to account
    lifecycle events via signed webhooks, and reconcile billing. Built for prop
    firms integrating from their own backend.


    Authentication, quick start, error handling, idempotency, pagination, custom
    metadata, webhooks, and the MCP connector are documented at
    https://docs.hyperprop.com.
  x-logo:
    url: https://app.hyperprop.com/logo-icon.svg
    altText: Hyperprop
    href: https://hyperprop.com
servers:
  - url: https://api.hyperprop.com/platform
    description: Production
security: []
tags:
  - name: Trading accounts
    description: Create, update, and inspect trading accounts.
  - name: Traders
    description: Look up and update the traders in your organization.
  - name: Trading plans
    description: Define the plans you sell.
  - name: Trading rules
    description: Define how accounts are evaluated.
  - name: Instruments
    description: >-
      The contracts your organization's accounts can trade, with their
      specifications.
  - name: Lockouts
    description: Pause and resume trading on an account.
  - name: Payouts
    description: Check payout eligibility and record payouts.
  - name: Purchases
    description: Purchases recorded for your organization.
  - name: Time Machine
    description: Restore accounts to an earlier trading day or instant.
  - name: Mass credit
    description: >-
      Credit back losses across many accounts after an incident, as background
      jobs you can follow, pause, export and reverse.
  - name: Webhooks
    description: Register webhook endpoints and inspect deliveries.
  - name: Events
    description: Your organization's event history and real-time event stream.
  - name: Reconciliation
    description: Balances, end-of-day snapshots, and fills for reconciliation.
  - name: Analytics
    description: Organization performance and plan economics.
  - name: Billing
    description: 'Your Hyperprop bill: activity, billing cycles, and forecasts.'
  - name: Team and roles
    description: Manage dashboard access for your staff.
  - name: API keys
    description: >-
      Manage your organization's API keys: rotation, read-only keys and IP
      allowlists.
  - name: Logs and health
    description: >-
      API request logs, the audit log, integration health, and idempotency key
      recovery.
  - name: Organization profile
    description: Your organization's profile and logo.
  - name: Support
    description: Open and follow up on support tickets.
  - name: Partner access
    description: >-
      Read a trader's journal as an approved partner app, with the trader's own
      key.
paths:
  /v1/organization/trading-accounts/{accountId}/orders/cancel:
    post:
      tags:
        - Trading accounts
      summary: Cancel working orders on an account
      description: >-
        Cancels an account's working orders without closing any position, with
        the organization API key. Positions stay open, and the account keeps its
        status and is not locked out.


        - **Default:** every working order is cancelled except the take-profit
        and stop-loss orders protecting an open position. Cancelling an entry
        order also cancels the take-profit and stop-loss attached to it. This
        matches a trader's "Cancel all".

        - **`includeExits: true`:** the take-profit and stop-loss orders of open
        positions are cancelled too.

        - **`contract`:** only that contract's orders are considered; other
        contracts are untouched.


        Works while the market is closed. Each cancelled order appears on the
        real-time stream (`OrderCancelled`) and in order history with reason
        `Admin cancel: <who> — <your reason>` (trigger `admin_flatten`). When
        anything was cancelled, an `ACCOUNT_UPDATED` event (trigger
        `admin_orders_cancel`) lands on the account's event log and goes to
        `account.updated` webhooks.


        **Retries:** safe. A repeated call cancels nothing more and answers 200
        with `ordersCancelled: 0`; an `Idempotency-Key` header returns the first
        answer instead.


        To close a position as well, use `POST .../positions/{contract}/close`
        or `POST .../flatten`.


        Requires **manage** permission on traders.


        ```bash

        curl -X POST
        "https://api.hyperprop.com/platform/v1/organization/trading-accounts/7c9e6679-7425-40de-944b-e07fc1f90ae7/orders/cancel"
        \
          -H "X-API-Key: hp_live_your_key_here" \
          -H "Content-Type: application/json" \
          -d '{"reason": "Risk review", "contract": "MNQZ6"}'
        ```
      operationId: postV1OrganizationTradingaccountsAccountidOrdersCancel
      parameters:
        - description: Trading account ID
          x-format:
            guid: true
          name: accountId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Model1449'
      responses:
        '200':
          description: Orders cancelled; positions untouched
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model1454'
        '400':
          description: Validation failed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model25'
        '401':
          description: Authentication required
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model11'
        '403':
          description: >-
            Forbidden - The caller lacks traders:manage
            (`INSUFFICIENT_PERMISSIONS`)
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model1455'
        '404':
          description: Trading account not found
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model1456'
        '409':
          description: A request with this Idempotency-Key is still in progress
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model1457'
        '500':
          description: An unexpected error occurred
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model6'
        '502':
          description: The trading engine could not be reached; nothing was cancelled
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model1458'
        '504':
          description: >-
            The trading engine did not answer in time; some orders may have been
            cancelled. Retrying is safe.
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model1459'
      security:
        - X-API-Key: []
components:
  schemas:
    Model1449:
      type: object
      properties:
        reason:
          type: string
          description: >-
            Why the orders are being cancelled. Recorded on each cancelled order
            and on the account's event log.
          example: Risk review
          minLength: 3
          maxLength: 200
          x-convert:
            trim: true
        contract:
          type: string
          description: >-
            Only cancel orders on this contract. Omit to cancel on every
            contract.
          example: MNQZ6
          pattern: ^[A-Za-z0-9._-]{1,40}$
        includeExits:
          type: boolean
          description: >-
            Also cancel the take-profit and stop-loss orders of open positions,
            leaving them unprotected. Default false: they stay.
          example: false
          default: false
      required:
        - reason
    Model1454:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          $ref: '#/components/schemas/Model1453'
    Model25:
      type: object
      properties:
        success:
          type: boolean
          description: Always false on errors
          example: false
        statusCode:
          type: number
          example: 400
        error:
          type: string
          example: Bad Request
        message:
          type: string
          example: Validation failed
        code:
          type: string
          description: Machine-readable error code — switch on this, not on message text
          example: VALIDATION_ERROR
    Model11:
      type: object
      properties:
        success:
          type: boolean
          description: Always false on errors
          example: false
        statusCode:
          type: number
          example: 401
        error:
          type: string
          example: Unauthorized
        message:
          type: string
          example: Authentication required
        code:
          type: string
          description: Machine-readable error code — switch on this, not on message text
          example: UNAUTHORIZED
    Model1455:
      type: object
      properties:
        statusCode:
          type: number
          example: 403
        error:
          type: string
          example: Forbidden
        message:
          type: string
          example: Your role does not have write access to "Traders & accounts"
        code:
          $ref: '#/components/schemas/code'
    Model1456:
      type: object
      properties:
        success:
          type: boolean
          description: Always false on errors
          example: false
        statusCode:
          type: number
          example: 404
        error:
          type: string
          example: Not Found
        message:
          type: string
          example: Trading account not found
        code:
          type: string
          description: Machine-readable error code — switch on this, not on message text
          example: ACCOUNT_NOT_FOUND
    Model1457:
      type: object
      properties:
        success:
          type: boolean
          description: Always false on errors
          example: false
        statusCode:
          type: number
          example: 409
        error:
          type: string
          example: Conflict
        message:
          type: string
          example: A request with this Idempotency-Key is still in progress
        code:
          type: string
          description: Machine-readable error code — switch on this, not on message text
          example: IDEMPOTENCY_KEY_IN_PROGRESS
    Model6:
      type: object
      properties:
        success:
          type: boolean
          description: Always false on errors
          example: false
        statusCode:
          type: number
          example: 500
        error:
          type: string
          example: Internal Server Error
        message:
          type: string
          example: An unexpected error occurred
        code:
          type: string
          description: Machine-readable error code — switch on this, not on message text
          example: INTERNAL_ERROR
    Model1458:
      type: object
      properties:
        success:
          type: boolean
          description: Always false on errors
          example: false
        statusCode:
          type: number
          example: 502
        error:
          type: string
          example: Error
        message:
          type: string
          example: The trading engine could not be reached; nothing was cancelled
        code:
          type: string
          description: Machine-readable error code — switch on this, not on message text
          example: ENGINE_UNAVAILABLE
    Model1459:
      type: object
      properties:
        success:
          type: boolean
          description: Always false on errors
          example: false
        statusCode:
          type: number
          example: 504
        error:
          type: string
          example: Error
        message:
          type: string
          example: >-
            The trading engine did not answer in time; some orders may have been
            cancelled. Retrying is safe.
        code:
          type: string
          description: Machine-readable error code — switch on this, not on message text
          example: CANCEL_OUTCOME_UNKNOWN
    Model1453:
      type: object
      properties:
        accountId:
          type: string
          example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
          x-format:
            guid: true
        accountNumber:
          type: string
          example: ACC-50K-000123
        contract:
          type: string
          description: The contract filter, or null for every contract
          example: MNQZ6
        includeExits:
          type: boolean
          example: false
        ordersCancelled:
          type: integer
          description: >-
            Orders cancelled by this call, including attached take-profit and
            stop-loss orders of cancelled entries; 0 when there was nothing to
            cancel
          example: 2
        exitsKept:
          type: integer
          description: >-
            Take-profit and stop-loss orders of open positions left working (0
            with `includeExits`)
          example: 2
        orders:
          $ref: '#/components/schemas/Model1452'
        reason:
          type: string
          example: 'Admin cancel: API key — Risk review'
    code:
      type: string
      example: INSUFFICIENT_PERMISSIONS
      enum:
        - INSUFFICIENT_PERMISSIONS
    Model1452:
      type: array
      description: The cancelled orders
      items:
        $ref: '#/components/schemas/Model1451'
    Model1451:
      type: object
      properties:
        orderId:
          type: string
          x-format:
            guid: true
        contract:
          type: string
          example: MNQZ6
        side:
          $ref: '#/components/schemas/Model1450'
        type:
          type: string
          example: limit
        quantity:
          type: integer
          example: 1
        filledQuantity:
          type: integer
          example: 0
        limitPrice:
          type: number
          example: 19950.25
        stopPrice:
          type: number
          example: null
        exit:
          type: boolean
          description: True for a take-profit or stop-loss order
          example: false
        status:
          type: string
          example: cancelled
        reason:
          type: string
          example: 'Admin cancel: API key — Risk review'
    Model1450:
      type: string
      example: buy
      enum:
        - buy
        - sell
  securitySchemes:
    X-API-Key:
      type: apiKey
      name: X-API-Key
      in: header
      description: >-
        Organization API key. Format: "hp_live_{key}". Organization admins
        manage the key in the dashboard.

````

## Related topics

- [Cancel all pending orders for an account (keeps live position protection)](https://docs.hyperprop.com/trade-api/orders/cancel-all-pending-orders-for-an-account-keeps-live-position-protection.md)
- [Flatten account: close positions and cancel orders](https://docs.hyperprop.com/trade-api/positions/flatten-account:-close-positions-and-cancel-orders.md)
- [Get all orders (filled, pending, cancelled)](https://docs.hyperprop.com/trade-api/orders/get-all-orders-filled-pending-cancelled.md)
- [Closing a position](https://docs.hyperprop.com/guides/closing-positions.md)
- [Close all open positions for an account](https://docs.hyperprop.com/trade-api/positions/close-all-open-positions-for-an-account.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.