> ## 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.

# Undo a revert batch

> **The undo button.** Puts every account in a revert batch back **exactly where it was the moment before the revert ran**: pre-revert balance, status, high-water mark and daily baseline are restored from the ledger, and every snapshot and order the batch voided is un-voided — the trader's journal, order history, and daily stats come back like the revert never happened. Open terminals update live.

A revert destroys nothing (rows are stamped, not deleted), which is what makes this possible.

**Per-account rules** (each account is checked independently — eligible ones proceed, blocked ones come back in `failures`):
| Code | Meaning |
|------|---------|
| `NEW_ACTIVITY` | The trader placed orders after the revert, or a market close recorded a day with real activity since. The old timeline can't be restored over a new one — this account stays as-is. |
| `NOT_LATEST_REVERT` | A newer revert covers this account. Reverts undo newest-first, like a stack — undo the newer batch first. |
| `UNDO_UPDATE_ERROR` | Failed to write the restored state — retry (idempotent). |

**Batch-level error codes:**
| Code | Status | Meaning |
|------|:---:|---------|
| `BATCH_NOT_FOUND` | 404 | Unknown batch id (or it belongs to a different organization) |
| `ALREADY_UNDONE` | 409 | Every account in this batch has already been undone |

**Timing:** the undo window stays open as long as the account has no new activity — minutes or days later both work. In practice: if you realize the mistake before traders resume trading, everything restores; accounts that already traded again are individually skipped and reported.

**Recommended flow:** `"preview": true` first — you get the exact per-account restore report plus who would be blocked and why — then execute.

**Example — preview, then undo:**
```bash
# 1. Dry run — nothing changes
curl -X POST ".../v1/organization/revert-batches/a1b2c3d4-e5f6-7890-abcd-ef1234567890/undo" \
  -H "X-API-Key: hp_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "preview": true }'

# 2. Execute
curl -X POST ".../v1/organization/revert-batches/a1b2c3d4-e5f6-7890-abcd-ef1234567890/undo" \
  -H "X-API-Key: hp_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "reason": "Reverted the wrong day — restoring" }'
```



## OpenAPI

````yaml /api-reference/openapi.json post /v1/organization/revert-batches/{batchId}/undo
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}/undo:
    post:
      tags:
        - Time Machine
      summary: Undo a revert batch
      description: >-
        **The undo button.** Puts every account in a revert batch back **exactly
        where it was the moment before the revert ran**: pre-revert balance,
        status, high-water mark and daily baseline are restored from the ledger,
        and every snapshot and order the batch voided is un-voided — the
        trader's journal, order history, and daily stats come back like the
        revert never happened. Open terminals update live.


        A revert destroys nothing (rows are stamped, not deleted), which is what
        makes this possible.


        **Per-account rules** (each account is checked independently — eligible
        ones proceed, blocked ones come back in `failures`):

        | Code | Meaning |

        |------|---------|

        | `NEW_ACTIVITY` | The trader placed orders after the revert, or a
        market close recorded a day with real activity since. The old timeline
        can't be restored over a new one — this account stays as-is. |

        | `NOT_LATEST_REVERT` | A newer revert covers this account. Reverts undo
        newest-first, like a stack — undo the newer batch first. |

        | `UNDO_UPDATE_ERROR` | Failed to write the restored state — retry
        (idempotent). |


        **Batch-level error codes:**

        | Code | Status | Meaning |

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

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

        | `ALREADY_UNDONE` | 409 | Every account in this batch has already been
        undone |


        **Timing:** the undo window stays open as long as the account has no new
        activity — minutes or days later both work. In practice: if you realize
        the mistake before traders resume trading, everything restores; accounts
        that already traded again are individually skipped and reported.


        **Recommended flow:** `"preview": true` first — you get the exact
        per-account restore report plus who would be blocked and why — then
        execute.


        **Example — preview, then undo:**

        ```bash

        # 1. Dry run — nothing changes

        curl -X POST
        ".../v1/organization/revert-batches/a1b2c3d4-e5f6-7890-abcd-ef1234567890/undo"
        \
          -H "X-API-Key: hp_live_your_key_here" \
          -H "Content-Type: application/json" \
          -d '{ "preview": true }'

        # 2. Execute

        curl -X POST
        ".../v1/organization/revert-batches/a1b2c3d4-e5f6-7890-abcd-ef1234567890/undo"
        \
          -H "X-API-Key: hp_live_your_key_here" \
          -H "Content-Type: application/json" \
          -d '{ "reason": "Reverted the wrong day — restoring" }'
        ```
      operationId: postV1OrganizationRevertbatchesBatchidUndo
      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/Model728'
      responses:
        '200':
          description: Undo processed (check per-account failures)
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model734'
        '401':
          description: Authentication required
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model9'
        '403':
          description: Access denied
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model47'
        '404':
          description: Batch not found
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model735'
        '409':
          description: Already undone
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model736'
        '500':
          description: An unexpected error occurred
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model5'
      security:
        - X-API-Key: []
components:
  schemas:
    Model728:
      type: object
      properties:
        reason:
          type: string
          description: >-
            Why the undo happened — stored in the audit trail and webhook
            events. Defaults to a generated message.
          example: Reverted the wrong day — restoring
          minLength: 3
        preview:
          type: boolean
          description: >-
            Dry run: per-account report of what the undo WOULD restore (and
            which accounts are blocked), nothing changed.
          example: true
          default: false
    Model734:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Restored 1 account to their pre-revert state
        data:
          $ref: '#/components/schemas/Model733'
    Model9:
      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
    Model47:
      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
    Model735:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          type: string
          example: BATCH_NOT_FOUND
        message:
          type: string
          example: Revert batch not found
    Model736:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          type: string
          example: ALREADY_UNDONE
        message:
          type: string
          example: This revert batch has already been undone
    Model5:
      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
    Model733:
      type: object
      example:
        batchId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        tradingDay: '2026-07-07'
        preview: false
        restored: 1
        failed: 1
        accounts:
          - accountId: 7c9e6679-7425-40de-944b-e07fc1f90ae7
            accountNumber: ACC-7845KXPQ
            balanceBefore: 51250
            balanceAfter: 48750
            statusBefore: in_progress
            statusAfter: failed
            snapshotsRestored: 1
            ordersRestored: 14
        failures:
          - accountId: 8d0f7780-8536-51ef-b55c-f18gd2g01bf8
            code: NEW_ACTIVITY
            message: >-
              The trader has new order activity after the revert — the old
              timeline can no longer be restored
      properties:
        batchId:
          type: string
        tradingDay:
          type: string
          description: The day the original batch reverted to
        preview:
          type: boolean
        restored:
          type: number
        failed:
          type: number
        accounts:
          $ref: '#/components/schemas/Model730'
        failures:
          $ref: '#/components/schemas/Model732'
    Model730:
      type: array
      items:
        $ref: '#/components/schemas/Model729'
    Model732:
      type: array
      items:
        $ref: '#/components/schemas/Model731'
    Model729:
      type: object
      properties:
        accountId:
          type: string
        accountNumber:
          type: string
        balanceBefore:
          type: number
          description: Balance while reverted
        balanceAfter:
          type: number
          description: Restored pre-revert balance
        statusBefore:
          type: string
        statusAfter:
          type: string
        snapshotsRestored:
          type: number
          description: Voided daily snapshots brought back
        ordersRestored:
          type: number
          description: Voided order events brought back into journal/history
    Model731:
      type: object
      properties:
        accountId:
          type: string
        code:
          type: string
        message:
          type: string
  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 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)
- [Revert an account to a trading day or an instant](/platform-api/time-machine/revert-an-account-to-a-trading-day-or-an-instant.md)
- [Get bulk operation details](/platform-api/trading-accounts/get-bulk-operation-details.md)


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