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

# Time Machine — bulk revert accounts to a trading day or an instant

> **Time Machine, org-wide:** the same operation as the single-account revert, applied to many accounts in one call — built for exchange/platform outages.

**Who** — exactly one of:
- `accountIds` (max 1000) — a targeted revert;
- `allAccounts: true` — every account in your organization with activity after the restore point;
- `audience: { from, to, condition }` — the accounts an outage window actually touched: `traded` (any fill in the window), `loss` (net realized P&L in the window below zero), `failed` (the account failed inside the window), or `failed_or_loss`. Everyone else is left alone.

**To when** — `tradingDay` (end-of-day state of that Chicago trading day) or `revertTo` (exact state at an instant; see the single-account endpoint for how it is reconstructed). With an `audience` and neither given, the accounts go back to `audience.from` — the point at which the issues began.

Each account is processed independently: the response lists per-account results and per-account failures (one bad account never aborts the batch — per-account error codes match the single-account endpoint). All changes share one `batchId` in the audit trail, and the batch records the restore point and the audience that selected it.

**Example — an outage at the NY open (09:30–10:00 ET on 8 Sep 2026) failed some accounts and cost others money; put exactly those accounts back to 09:30:**
```json
{
  "audience": { "from": "2026-09-08T13:30:00Z", "to": "2026-09-08T14:00:00Z", "condition": "failed_or_loss" },
  "reason": "Feed outage at the NY open, 8 Sep",
  "preview": true
}
```

**Undoable.** The returned `batchId` is a Time Machine ledger entry (`GET /revert-batches`). If the batch was a mistake, `POST /revert-batches/{batchId}/undo` restores every account in it to its pre-revert state in one call — accounts with new trader activity since the revert are skipped and reported individually.

**Batch-level error codes:**
| Code | Status | Meaning |
|------|:---:|---------|
| `NO_ACCOUNTS` | 400 | Nothing to revert (empty accountIds, or allAccounts found no affected accounts). An empty `audience` is NOT an error: 200 with `reverted: 0` |
| `TOO_MANY_ACCOUNTS` | 400 | More than 1000 accounts in one call — split into batches |
| `AMBIGUOUS_TARGET` | 400 | Not exactly one of accountIds / allAccounts / audience |
| `INVALID_AUDIENCE_WINDOW` | 400 | audience.from is not before audience.to, or not timestamps |
| `INVALID_REVERT_POINT` | 400 | Both tradingDay and revertTo, revertTo not a timestamp, or in the future |
| `AUDIENCE_ERROR` | 500 | Could not read the activity needed to resolve the audience — retry |

**Recommended flow:** run with `"preview": true` first — you get the full per-account impact report (balances restored, accounts revived, orders voided) with zero changes — then execute.

**Example — preview an org-wide revert, then execute:**
```bash
# 1. Dry run
curl -X POST ".../v1/organization/accounts/revert-trading-day" \
  -H "X-API-Key: hp_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "tradingDay": "2026-07-07", "allAccounts": true, "reason": "CME data feed outage on 2026-07-08", "preview": true }'

# 2. Execute
curl -X POST ".../v1/organization/accounts/revert-trading-day" \
  -H "X-API-Key: hp_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "tradingDay": "2026-07-07", "allAccounts": true, "reason": "CME data feed outage on 2026-07-08" }'
```



## OpenAPI

````yaml /api-reference/openapi.json post /v1/organization/accounts/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: Authentication
    description: >-
      User authentication - signup, signin, signout, password reset, email
      verification, OAuth, and MFA
  - name: User
    description: >-
      User account management - profile, notifications, agreements, dismissals,
      and audit logs. Requires Bearer token.
  - name: Organization
    description: >-
      Organization management - profile, team, trading accounts, plans, and
      rules. Supports **dual authentication**: Bearer JWT token (dashboard
      users) OR X-API-Key (programmatic access).
  - name: Market Data
    description: CME futures contracts and market data. Requires Bearer token.
  - name: Indicator Builder
    description: >-
      AI-assisted authoring of custom Hyperprop Script indicators for the web
      terminal. Requires Bearer token.
  - name: System
    description: System endpoints - health checks and connectivity
paths:
  /v1/organization/accounts/revert-trading-day:
    post:
      tags:
        - Organization
      summary: Time Machine — bulk revert accounts to a trading day or an instant
      description: >-
        **Time Machine, org-wide:** the same operation as the single-account
        revert, applied to many accounts in one call — built for
        exchange/platform outages.


        **Who** — exactly one of:

        - `accountIds` (max 1000) — a targeted revert;

        - `allAccounts: true` — every account in your organization with activity
        after the restore point;

        - `audience: { from, to, condition }` — the accounts an outage window
        actually touched: `traded` (any fill in the window), `loss` (net
        realized P&L in the window below zero), `failed` (the account failed
        inside the window), or `failed_or_loss`. Everyone else is left alone.


        **To when** — `tradingDay` (end-of-day state of that Chicago trading
        day) or `revertTo` (exact state at an instant; see the single-account
        endpoint for how it is reconstructed). With an `audience` and neither
        given, the accounts go back to `audience.from` — the point at which the
        issues began.


        Each account is processed independently: the response lists per-account
        results and per-account failures (one bad account never aborts the batch
        — per-account error codes match the single-account endpoint). All
        changes share one `batchId` in the audit trail, and the batch records
        the restore point and the audience that selected it.


        **Example — an outage at the NY open (09:30–10:00 ET on 8 Sep 2026)
        failed some accounts and cost others money; put exactly those accounts
        back to 09:30:**

        ```json

        {
          "audience": { "from": "2026-09-08T13:30:00Z", "to": "2026-09-08T14:00:00Z", "condition": "failed_or_loss" },
          "reason": "Feed outage at the NY open, 8 Sep",
          "preview": true
        }

        ```


        **Undoable.** The returned `batchId` is a Time Machine ledger entry
        (`GET /revert-batches`). If the batch was a mistake, `POST
        /revert-batches/{batchId}/undo` restores every account in it to its
        pre-revert state in one call — accounts with new trader activity since
        the revert are skipped and reported individually.


        **Batch-level error codes:**

        | Code | Status | Meaning |

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

        | `NO_ACCOUNTS` | 400 | Nothing to revert (empty accountIds, or
        allAccounts found no affected accounts). An empty `audience` is NOT an
        error: 200 with `reverted: 0` |

        | `TOO_MANY_ACCOUNTS` | 400 | More than 1000 accounts in one call —
        split into batches |

        | `AMBIGUOUS_TARGET` | 400 | Not exactly one of accountIds / allAccounts
        / audience |

        | `INVALID_AUDIENCE_WINDOW` | 400 | audience.from is not before
        audience.to, or not timestamps |

        | `INVALID_REVERT_POINT` | 400 | Both tradingDay and revertTo, revertTo
        not a timestamp, or in the future |

        | `AUDIENCE_ERROR` | 500 | Could not read the activity needed to resolve
        the audience — retry |


        **Recommended flow:** run with `"preview": true` first — you get the
        full per-account impact report (balances restored, accounts revived,
        orders voided) with zero changes — then execute.


        **Example — preview an org-wide revert, then execute:**

        ```bash

        # 1. Dry run

        curl -X POST ".../v1/organization/accounts/revert-trading-day" \
          -H "X-API-Key: hp_live_your_key_here" \
          -H "Content-Type: application/json" \
          -d '{ "tradingDay": "2026-07-07", "allAccounts": true, "reason": "CME data feed outage on 2026-07-08", "preview": true }'

        # 2. Execute

        curl -X POST ".../v1/organization/accounts/revert-trading-day" \
          -H "X-API-Key: hp_live_your_key_here" \
          -H "Content-Type: application/json" \
          -d '{ "tradingDay": "2026-07-07", "allAccounts": true, "reason": "CME data feed outage on 2026-07-08" }'
        ```
      operationId: postV1OrganizationAccountsReverttradingday
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Model600'
      responses:
        '200':
          description: Bulk revert processed (check per-account failures)
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model606'
        '400':
          description: No accounts / too many accounts
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model607'
        '401':
          description: Authentication required
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model9'
        '403':
          description: Access denied
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model44'
        '500':
          description: An unexpected error occurred
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model5'
      security:
        - Bearer: []
        - X-API-Key: []
components:
  schemas:
    Model600:
      type: object
      properties:
        tradingDay:
          type: string
          description: >-
            END-OF-DAY restore: Chicago trading day (YYYY-MM-DD) to revert TO.
            One of tradingDay / revertTo; with an `audience` and neither given,
            the accounts are restored to `audience.from`.
          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) every
            targeted account is restored to — typically the moment the outage
            began. See the single-account endpoint for how the state at an
            instant is reconstructed.
          example: '2026-09-08T13:30:00Z'
          x-format:
            isoDate: true
        reason:
          type: string
          description: Why — audit trail, account metadata, webhooks
          example: CME data feed outage on 2026-07-08
          minLength: 3
        accountIds:
          $ref: '#/components/schemas/Model597'
        allAccounts:
          type: boolean
          description: >-
            Revert every account in the organization with activity after the
            restore point (later trades or snapshots) — including accounts
            created during the outage day itself. Untouched accounts are
            skipped.
          enum:
            - true
        audience:
          $ref: '#/components/schemas/Model599'
        preview:
          type: boolean
          description: >-
            Dry run: per-account report of what WOULD happen, nothing changed.
            Use it to build the confirmation screen before an org-wide revert.
          example: true
          default: false
      required:
        - reason
    Model606:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Reverted 42 accounts to 2026-07-07
        data:
          $ref: '#/components/schemas/Model605'
    Model607:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          type: string
          example: TOO_MANY_ACCOUNTS
        message:
          type: string
          example: Too many accounts in one revert (max 1000) — split into batches
    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
    Model44:
      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
    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
    Model597:
      type: array
      description: Specific accounts to revert (max 1000 per call)
      minItems: 1
      maxItems: 1000
      items:
        type: string
        x-format:
          guid: true
    Model599:
      type: object
      description: >-
        Target the accounts an outage window actually touched, instead of naming
        them. Only non-voided activity counts. The response reports how many
        matched; an empty audience returns 200 with `reverted: 0` (nothing to do
        is not an error).
      properties:
        from:
          type: string
          description: Start of the outage window (ISO 8601, UTC)
          example: '2026-09-08T13:30:00Z'
          x-format:
            isoDate: true
        to:
          type: string
          description: 'End of the outage window (ISO 8601, UTC). Default: now.'
          example: '2026-09-08T14:00:00Z'
          x-format:
            isoDate: true
        condition:
          $ref: '#/components/schemas/Model598'
      required:
        - from
        - condition
    Model605:
      type: object
      example:
        batchId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        tradingDay: '2026-07-07'
        reverted: 2
        failed: 0
        accounts:
          - 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
          - accountId: 8d0f7780-8536-51ef-b55c-f18gd2g01bf8
            accountNumber: ACC-9921MZPL
            revertedTo: '2026-07-07'
            balanceBefore: 50100
            balanceAfter: 50900
            statusBefore: in_progress
            statusAfter: in_progress
            snapshotsDeleted: 1
            ordersVoided: 9
            positionsClosed: 0
            ordersCancelled: 0
        failures: []
      properties:
        batchId:
          type: string
          description: >-
            Time Machine ledger id — list it via GET /revert-batches, undo the
            whole batch via POST /revert-batches/{batchId}/undo. null in
            previews.
        tradingDay:
          type: string
          description: >-
            Chicago trading day restored (end-of-day restore) or containing the
            instant (point-in-time restore)
        revertTo:
          type: string
          description: >-
            The instant (ISO, UTC) for a point-in-time restore; null for an
            end-of-day restore
        audience:
          $ref: '#/components/schemas/Model601'
        preview:
          type: boolean
          description: true = dry run, nothing was changed
        reverted:
          type: number
        failed:
          type: number
        accounts:
          $ref: '#/components/schemas/Model603'
        failures:
          $ref: '#/components/schemas/failures'
    Model598:
      type: string
      description: >-
        Who inside the window: `traded` = any fill in the window · `loss` = net
        realized P&L in the window is negative · `failed` = the account failed
        in the window · `failed_or_loss` = either
      example: failed_or_loss
      enum:
        - traded
        - loss
        - failed
        - failed_or_loss
    Model601:
      type: object
      description: >-
        Echo of the audience that selected the accounts; null when
        accountIds/allAccounts were used
      properties:
        from:
          type: string
        to:
          type: string
        condition:
          type: string
        matched:
          type: number
          description: Accounts the window + condition selected
    Model603:
      type: array
      items:
        $ref: '#/components/schemas/Model602'
    failures:
      type: array
      items:
        $ref: '#/components/schemas/Model604'
    Model602:
      type: object
      properties:
        accountId:
          type: string
        accountNumber:
          type: string
        revertedTo:
          type: string
        balanceBefore:
          type: number
        balanceAfter:
          type: number
        statusBefore:
          type: string
        statusAfter:
          type: string
        snapshotsDeleted:
          type: number
        ordersVoided:
          type: number
        positionsClosed:
          type: number
          description: Open positions force-closed before the revert
        ordersCancelled:
          type: number
          description: Working orders cancelled before the revert
    Model604:
      type: object
      properties:
        accountId:
          type: string
        code:
          type: string
        message:
          type: string
  securitySchemes:
    Bearer:
      type: apiKey
      name: Authorization
      in: header
      description: >-
        JWT Bearer token for user session auth. Format: "Bearer {token}". Used
        by User and Organization endpoints.
    X-API-Key:
      type: apiKey
      name: X-API-Key
      in: header
      description: >-
        Organization API key for programmatic access. Format: "hp_live_{key}".
        Used by Organization endpoints as an alternative to Bearer token. Keys
        are managed in the dashboard.

````

## Related topics

- [Time Machine — revert an account to a trading day or an instant](/platform-api/organization/time-machine-—-revert-an-account-to-a-trading-day-or-an-instant.md)
- [Time Machine — list revert batches](/platform-api/organization/time-machine-—-list-revert-batches.md)
- [Time Machine — inspect a revert batch](/platform-api/organization/time-machine-—-inspect-a-revert-batch.md)
- [Changelog](/changelog.md)
- [Time Machine — undo a revert batch](/platform-api/organization/time-machine-—-undo-a-revert-batch.md)
