> ## 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 a background run

> Stops a background revert (or undo) of this batch. The accounts it is working on right now finish; every account it had not reached is left untouched and reported as `cancelled` in `GET /revert-batches/{batchId}/items`.

- A run that had not started yet stops at once: `status: "cancelled"`, nothing was changed.
- A running one answers `status: "cancelling"` and stops within a few seconds. Poll `GET /revert-batches/{batchId}` until `job.status` is `cancelled`. The batch then reads `interrupted` (an undo returns the batch to its previous `status`).

Accounts already reverted stay reverted and can be undone with the batch. To revert the remaining accounts later, use `POST /revert-batches/{batchId}/retry-failed`.

| Code | Status | Meaning |
|------|:---:|---------|
| `BATCH_NOT_FOUND` | 404 | Unknown batch id (or it belongs to a different organization) |
| `NO_ACTIVE_JOB` | 409 | Nothing is running for this batch |

**Example:**
```bash
curl -X POST "https://api.hyperprop.com/platform/v1/organization/revert-batches/a1b2c3d4-e5f6-7890-abcd-ef1234567890/cancel" \
  -H "X-API-Key: hp_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "reason": "Wrong audience window" }'
```



## OpenAPI

````yaml https://api.hyperprop.com/platform/openapi.json post /v1/organization/revert-batches/{batchId}/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: 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: 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 key.
  - name: Logs and health
    description: API request logs, the audit log, and integration health.
  - 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/revert-batches/{batchId}/cancel:
    post:
      tags:
        - Time Machine
      summary: Cancel a background run
      description: >-
        Stops a background revert (or undo) of this batch. The accounts it is
        working on right now finish; every account it had not reached is left
        untouched and reported as `cancelled` in `GET
        /revert-batches/{batchId}/items`.


        - A run that had not started yet stops at once: `status: "cancelled"`,
        nothing was changed.

        - A running one answers `status: "cancelling"` and stops within a few
        seconds. Poll `GET /revert-batches/{batchId}` until `job.status` is
        `cancelled`. The batch then reads `interrupted` (an undo returns the
        batch to its previous `status`).


        Accounts already reverted stay reverted and can be undone with the
        batch. To revert the remaining accounts later, use `POST
        /revert-batches/{batchId}/retry-failed`.


        | Code | Status | Meaning |

        |------|:---:|---------|

        | `BATCH_NOT_FOUND` | 404 | Unknown batch id (or it belongs to a
        different organization) |

        | `NO_ACTIVE_JOB` | 409 | Nothing is running for this batch |


        **Example:**

        ```bash

        curl -X POST
        "https://api.hyperprop.com/platform/v1/organization/revert-batches/a1b2c3d4-e5f6-7890-abcd-ef1234567890/cancel"
        \
          -H "X-API-Key: hp_live_your_key_here" \
          -H "Content-Type: application/json" \
          -d '{ "reason": "Wrong audience window" }'
        ```
      operationId: postV1OrganizationRevertbatchesBatchidCancel
      parameters:
        - description: Batch id returned by the revert call
          x-format:
            guid: true
          name: batchId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Model992'
      responses:
        '200':
          description: Cancelled, or cancelling
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model995'
        '401':
          description: Authentication required
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model11'
        '403':
          description: Access denied
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model63'
        '404':
          description: Batch not found
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model996'
        '409':
          description: Nothing is running
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model998'
        '500':
          description: An unexpected error occurred
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model6'
      security:
        - X-API-Key: []
components:
  schemas:
    Model992:
      type: object
      properties:
        reason:
          type: string
          description: Why the run was stopped (for your own records)
          maxLength: 500
    Model995:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: >-
            Cancelling — accounts in progress finish, the rest are left as they
            are
        data:
          $ref: '#/components/schemas/Model994'
    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
    Model63:
      type: object
      properties:
        success:
          type: boolean
          description: Always false on errors
          example: false
        statusCode:
          type: number
          example: 403
        error:
          type: string
          example: Forbidden
        message:
          type: string
          example: Access denied
        code:
          type: string
          description: Machine-readable error code — switch on this, not on message text
          example: FORBIDDEN
    Model996:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          type: string
          example: BATCH_NOT_FOUND
        message:
          type: string
          example: Revert batch not found
    Model998:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          $ref: '#/components/schemas/Model997'
        message:
          type: string
          example: Nothing is running for this batch
    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
    Model994:
      type: object
      example:
        batchId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        jobId: f47ac10b-58cc-4372-a567-0e02b2c3d479
        status: cancelling
      properties:
        batchId:
          type: string
        jobId:
          type: string
        status:
          $ref: '#/components/schemas/Model993'
    Model997:
      type: string
      example: NO_ACTIVE_JOB
      enum:
        - NO_ACTIVE_JOB
    Model993:
      type: string
      enum:
        - cancelling
        - cancelled
  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

- [List the accounts of a background run](/platform-api/time-machine/list-the-accounts-of-a-background-run.md)
- [Retry the failed accounts of a background run](/platform-api/time-machine/retry-the-failed-accounts-of-a-background-run.md)
- [List revert batches](/platform-api/time-machine/list-revert-batches.md)
- [Inspect a revert batch](/platform-api/time-machine/inspect-a-revert-batch.md)
- [Bulk revert accounts to a trading day or an instant](/platform-api/time-machine/bulk-revert-accounts-to-a-trading-day-or-an-instant.md)


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