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

# Revert an account to a trading day or an instant

> **Time Machine** (outage recovery): restore an account to its **end-of-day state** on the given trading day — or, with `revertTo`, to its **exact state at an instant** (the moment an outage began) — in one call. The reverted period stops existing for the trader.

**Two ways to name the restore point**
| Field | Restores to | Cutoff (everything after is voided) |
|---|---|---|
| `tradingDay` | the end-of-day snapshot of that Chicago trading day (or the latest traded day before it) | that day's 17:00 America/Chicago close |
| `revertTo` | the account's state at that instant: the balance the trader had at that moment, including every fill up to it. The high-water mark follows the plan's drawdown type (intraday-trailing plans take the highest balance on the way; end-of-day plans keep the base close). The status is the one in force at the instant (an account that failed later comes back to life). | the instant itself |

**What it does — the reverted period stops existing for the trader:**
1. **Closes any open positions and cancels all working orders first** (reason: "Trading day reverted by your firm: …") — no live exposure survives into the reverted world, and the closing fills land inside the voided window so they are erased too
2. Loads the account's end-of-day snapshot for `tradingDay` (or the latest traded day before it — e.g. reverting to a Sunday uses Friday's close)
3. Restores `currentBalance`, `highWaterMark`, and the daily baseline from that snapshot
4. Restores the snapshot's `status` and `violationReason` — an account failed during the bad day comes back to life
5. **Voids the daily snapshots after the target day** for this account, so consistency checks and daily-stats endpoints no longer see the reverted days (they are archived, not destroyed)
6. **Voids every order and fill after the reverted day's close** (17:00 America/Chicago): they disappear from the trader's journal, order history, and trade blotter, and the account's performance stats (trade count, win rate) are recomputed from the surviving fills. Voided activity is kept for audit — nothing is deleted.
7. Writes the audit trail (`GET /trading-accounts/{accountId}/changes`), stamps `metadata.last_revert`, and fires `account.updated` (+ status events when the status moved) with `trigger: "trading_day_revert"`
8. Applies the restored state immediately and updates the trader's open terminal in real time (balances, history, and journal), with an explanatory notice

If the account had never traded on or before the target day (e.g. it was created during the outage day itself), it is restored to its **pristine initial state** — starting balance, in_progress, entire order history voided. The account keeps existing; reverting never deletes accounts.

**Undoable.** Every executed revert returns a `batchId` and appears in the Time Machine ledger (`GET /revert-batches`). Nothing a revert touches is destroyed, so if you reverted by mistake, `POST /revert-batches/{batchId}/undo` puts the account back exactly where it was — as long as the trader hasn't produced new activity since (see that endpoint for the rules).

**Notes:**
- `preview: true` never touches positions — the flatten only happens on execute.
- Consistency: reverted days are removed from the day list automatically (their snapshots are voided).

**Recommended flow (calendar UI):** call with `"preview": true` first to show the operator what will happen (restored balance, status transition, orders voided), then call again without `preview` to execute.

**Error codes:**
| Code | Status | Meaning |
|------|:---:|---------|
| `INVALID_REVERT_POINT` | 400 | Neither/both of tradingDay and revertTo, revertTo not a timestamp, or revertTo in the future |
| `ACCOUNT_NOT_FOUND` | 404 | Account does not exist or belongs to a different organization |
| `SNAPSHOT_FETCH_ERROR` | 500 | Could not read the account's daily snapshots — retry |
| `BALANCE_AT_INSTANT_ERROR` | 500 | Could not read the fills needed to roll the balance forward to revertTo — retry |
| `SNAPSHOT_DELETE_ERROR` | 500 | Failed to void post-revert snapshots — retry (idempotent) |
| `REVERT_UPDATE_ERROR` | 500 | Failed to write the restored account state — retry (idempotent) |

The revert is safe to retry: every step is idempotent (already-voided rows keep their original stamp, and the state write is absolute).

**Example — preview, then execute:**
```bash
# 1. Dry run — nothing changes
curl -X POST ".../v1/organization/accounts/7c9e6679-7425-40de-944b-e07fc1f90ae7/revert-trading-day" \
  -H "X-API-Key: hp_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "tradingDay": "2026-07-07", "reason": "Data feed outage", "preview": true }'

# 2. Execute
curl -X POST ".../v1/organization/accounts/7c9e6679-7425-40de-944b-e07fc1f90ae7/revert-trading-day" \
  -H "X-API-Key: hp_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "tradingDay": "2026-07-07", "reason": "Data feed outage" }'
```



## OpenAPI

````yaml /api-reference/openapi.json post /v1/organization/accounts/{accountId}/revert-trading-day
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/accounts/{accountId}/revert-trading-day:
    post:
      tags:
        - Time Machine
      summary: Revert an account to a trading day or an instant
      description: >-
        **Time Machine** (outage recovery): restore an account to its
        **end-of-day state** on the given trading day — or, with `revertTo`, to
        its **exact state at an instant** (the moment an outage began) — in one
        call. The reverted period stops existing for the trader.


        **Two ways to name the restore point**

        | Field | Restores to | Cutoff (everything after is voided) |

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

        | `tradingDay` | the end-of-day snapshot of that Chicago trading day (or
        the latest traded day before it) | that day's 17:00 America/Chicago
        close |

        | `revertTo` | the account's state at that instant: the balance the
        trader had at that moment, including every fill up to it. The high-water
        mark follows the plan's drawdown type (intraday-trailing plans take the
        highest balance on the way; end-of-day plans keep the base close). The
        status is the one in force at the instant (an account that failed later
        comes back to life). | the instant itself |


        **What it does — the reverted period stops existing for the trader:**

        1. **Closes any open positions and cancels all working orders first**
        (reason: "Trading day reverted by your firm: …") — no live exposure
        survives into the reverted world, and the closing fills land inside the
        voided window so they are erased too

        2. Loads the account's end-of-day snapshot for `tradingDay` (or the
        latest traded day before it — e.g. reverting to a Sunday uses Friday's
        close)

        3. Restores `currentBalance`, `highWaterMark`, and the daily baseline
        from that snapshot

        4. Restores the snapshot's `status` and `violationReason` — an account
        failed during the bad day comes back to life

        5. **Voids the daily snapshots after the target day** for this account,
        so consistency checks and daily-stats endpoints no longer see the
        reverted days (they are archived, not destroyed)

        6. **Voids every order and fill after the reverted day's close** (17:00
        America/Chicago): they disappear from the trader's journal, order
        history, and trade blotter, and the account's performance stats (trade
        count, win rate) are recomputed from the surviving fills. Voided
        activity is kept for audit — nothing is deleted.

        7. Writes the audit trail (`GET /trading-accounts/{accountId}/changes`),
        stamps `metadata.last_revert`, and fires `account.updated` (+ status
        events when the status moved) with `trigger: "trading_day_revert"`

        8. Applies the restored state immediately and updates the trader's open
        terminal in real time (balances, history, and journal), with an
        explanatory notice


        If the account had never traded on or before the target day (e.g. it was
        created during the outage day itself), it is restored to its **pristine
        initial state** — starting balance, in_progress, entire order history
        voided. The account keeps existing; reverting never deletes accounts.


        **Undoable.** Every executed revert returns a `batchId` and appears in
        the Time Machine ledger (`GET /revert-batches`). Nothing a revert
        touches is destroyed, so if you reverted by mistake, `POST
        /revert-batches/{batchId}/undo` puts the account back exactly where it
        was — as long as the trader hasn't produced new activity since (see that
        endpoint for the rules).


        **Notes:**

        - `preview: true` never touches positions — the flatten only happens on
        execute.

        - Consistency: reverted days are removed from the day list automatically
        (their snapshots are voided).


        **Recommended flow (calendar UI):** call with `"preview": true` first to
        show the operator what will happen (restored balance, status transition,
        orders voided), then call again without `preview` to execute.


        **Error codes:**

        | Code | Status | Meaning |

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

        | `INVALID_REVERT_POINT` | 400 | Neither/both of tradingDay and
        revertTo, revertTo not a timestamp, or revertTo in the future |

        | `ACCOUNT_NOT_FOUND` | 404 | Account does not exist or belongs to a
        different organization |

        | `SNAPSHOT_FETCH_ERROR` | 500 | Could not read the account's daily
        snapshots — retry |

        | `BALANCE_AT_INSTANT_ERROR` | 500 | Could not read the fills needed to
        roll the balance forward to revertTo — retry |

        | `SNAPSHOT_DELETE_ERROR` | 500 | Failed to void post-revert snapshots —
        retry (idempotent) |

        | `REVERT_UPDATE_ERROR` | 500 | Failed to write the restored account
        state — retry (idempotent) |


        The revert is safe to retry: every step is idempotent (already-voided
        rows keep their original stamp, and the state write is absolute).


        **Example — preview, then execute:**

        ```bash

        # 1. Dry run — nothing changes

        curl -X POST
        ".../v1/organization/accounts/7c9e6679-7425-40de-944b-e07fc1f90ae7/revert-trading-day"
        \
          -H "X-API-Key: hp_live_your_key_here" \
          -H "Content-Type: application/json" \
          -d '{ "tradingDay": "2026-07-07", "reason": "Data feed outage", "preview": true }'

        # 2. Execute

        curl -X POST
        ".../v1/organization/accounts/7c9e6679-7425-40de-944b-e07fc1f90ae7/revert-trading-day"
        \
          -H "X-API-Key: hp_live_your_key_here" \
          -H "Content-Type: application/json" \
          -d '{ "tradingDay": "2026-07-07", "reason": "Data feed outage" }'
        ```
      operationId: postV1OrganizationAccountsAccountidReverttradingday
      parameters:
        - description: Trading account to revert
          x-format:
            guid: true
          name: accountId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Model724'
      responses:
        '200':
          description: Account reverted
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model726'
        '401':
          description: Authentication required
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model9'
        '403':
          description: Access denied
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model47'
        '404':
          description: Account not found
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model727'
        '500':
          description: An unexpected error occurred
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model5'
      security:
        - X-API-Key: []
components:
  schemas:
    Model724:
      type: object
      properties:
        tradingDay:
          type: string
          description: >-
            END-OF-DAY restore: Chicago trading day (YYYY-MM-DD) to revert TO.
            The account is restored to its end-of-day state on this day (or the
            latest traded day before it). Provide either tradingDay or revertTo.
          example: '2026-07-07'
          pattern: ^\d{4}-\d{2}-\d{2}$
        revertTo:
          type: string
          description: >-
            POINT-IN-TIME restore: the exact instant (ISO 8601, UTC) to revert
            TO — e.g. the moment an outage began. The account is restored to the
            state it had at that instant, with everything after the instant
            voided. Provide either tradingDay or revertTo.
          example: '2026-09-08T13:30:00Z'
          x-format:
            isoDate: true
        reason:
          type: string
          description: >-
            Why the revert happened — stored in the audit trail, account
            metadata, and webhook events.
          example: Data feed outage
          minLength: 3
        preview:
          type: boolean
          description: >-
            Dry run: return exactly what the revert WOULD do (target day,
            balances, status transition, snapshots removed, orders voided)
            without changing anything. Perfect for an "are you sure?"
            confirmation screen.
          example: true
          default: false
      required:
        - reason
    Model726:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Trading day reverted successfully
        data:
          $ref: '#/components/schemas/Model725'
    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
    Model727:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          type: string
          example: ACCOUNT_NOT_FOUND
        message:
          type: string
          example: Account not found in your organization
    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
    Model725:
      type: object
      example:
        accountId: 7c9e6679-7425-40de-944b-e07fc1f90ae7
        accountNumber: ACC-7845KXPQ
        revertedTo: '2026-07-07'
        balanceBefore: 48750
        balanceAfter: 51250
        statusBefore: failed
        statusAfter: in_progress
        snapshotsDeleted: 1
        ordersVoided: 14
        positionsClosed: 1
        ordersCancelled: 2
        batchId: f47ac10b-58cc-4372-a567-0e02b2c3d479
        preview: false
      properties:
        accountId:
          type: string
        accountNumber:
          type: string
        revertedTo:
          type: string
          description: >-
            Restore point actually used: the trading day (latest traded day
            at/before the requested day), the ISO instant for a revertTo
            restore, or "initial_state"
        balanceBefore:
          type: number
        balanceAfter:
          type: number
        statusBefore:
          type: string
        statusAfter:
          type: string
        snapshotsDeleted:
          type: number
          description: Post-revert daily snapshots voided (archived — restorable by undo)
        ordersVoided:
          type: number
          description: >-
            Order events after the reverted day voided (hidden from
            journal/history, kept for audit)
        positionsClosed:
          type: number
          description: >-
            Open positions force-closed before the revert (their fills are
            voided too)
        ordersCancelled:
          type: number
          description: Working orders cancelled before the revert
        batchId:
          type: string
          description: >-
            Time Machine ledger id — list it via GET /revert-batches, undo it
            via POST /revert-batches/{batchId}/undo. null in previews.
        revertTo:
          type: string
          description: >-
            The instant requested (ISO, UTC) for a point-in-time restore; null
            for an end-of-day restore
        preview:
          type: boolean
          description: true = dry run, nothing was changed
  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

- [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)
- [List revert batches](/platform-api/time-machine/list-revert-batches.md)
- [Inspect a revert batch](/platform-api/time-machine/inspect-a-revert-batch.md)
- [Undo a revert batch](/platform-api/time-machine/undo-a-revert-batch.md)
- [Introduction](/introduction.md)


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