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

# Start or extend a trader lockout

> Irreversible. Locks trading on the named accounts, or on every active account this key can see (`all_accounts`), until the chosen time. It cannot be ended or shortened early, by you or by Support, so `acknowledged: true` is required. Choose the unlock time with a `duration` preset (as on the website: 15 minutes to 24 hours, or the next midnight New York time) or an exact future `expires_at`, at most 90 days away. A request may extend an account's running lockout, never shorten it: an unlock time earlier than a running lockout is refused with `409 trader_lockout_ends_later`. Open positions, resting orders, exit orders, and running TWAP and scaled orders stay as they are unless `close_trades_first` is true. Then every open trade on up to 100 accounts is canceled or closed with reduce-only market orders first, and the accounts lock only once all of them are flat; otherwise nothing locks and the response says what was closed. Closing gets about 70 seconds; trades still open after that are reported the same way, with nothing locked. Requires trade scope. Starting lockouts is rate limited per user: 5 at once, refilling at 10 an hour, and refused requests count too. Close-and-lock is limited further, per user to a burst of one, refilling at 4 an hour, and can return `429` when many are running across the platform. A key revoked or narrowed while a request runs stops it before the next close or the lock. The reported counts and `pending_work` cover only the closes and cancels this request submitted itself. When a selected account leads copy trading, copies of its closes on follower accounts run separately and are not counted, even on a selected follower; a selected follower still locks only once it is flat.



## OpenAPI

````yaml /openapi.yaml post /v1/trader-lockout
openapi: 3.1.0
info:
  title: MyFundedPerps API (Beta)
  version: 1.0.0
  description: >-
    The developer API is in beta. Breaking changes may be introduced at any
    time. Programmatic access to MyFundedPerps paper-trading challenge accounts.
    API trades use the same real order books and simulated execution engine as
    the web trading interface. Every response carries an `X-Request-Id` header
    for support and log correlation.
  contact:
    url: https://myfundedperpetuals.com/contact
servers:
  - url: https://developers.myfundedperpetuals.com
    description: Live
  - url: https://sandbox.myfundedperpetuals.com
    description: Sandbox (test keys and sandbox accounts only)
security:
  - bearerAuth: []
  - bearerAuth: []
    partnerKey: []
tags:
  - name: General
  - name: Authentication
  - name: Accounts
  - name: Markets
  - name: Positions
  - name: Orders
  - name: Fills
  - name: Strategy Orders
  - name: Trader Lockout
    description: >-
      Lock your own accounts out of trading until a time you choose, the same
      Trader Lockout as Settings > Trading on the website. A lockout cannot be
      ended or shortened early, by you or by Support, and there is no unlock
      endpoint: it ends only at `expires_at`. While it runs, new orders, order
      edits, cancels, manual closes, and exit-order changes on the account are
      rejected with `422 account_trader_lockout_active` and
      `error.details.expires_at`.
  - name: Price Alerts
  - name: Script Data
    description: >-
      Small text values your own Pine scripts read with `request.data("key")`,
      such as a daily options gamma histogram or call and put walls. Script data
      belongs to the key's owner, not an account, so any of your live keys
      reaches all of it, including keys limited to some accounts. Reading needs
      read or trade scope; creating, updating, and deleting need trade scope.
      Test keys can't use these endpoints. A script someone shares with you
      reads your own script data, never theirs. You can keep up to 20 keys, each
      holding up to 65,536 UTF-16 code units, and make up to 30 writes a minute
      and 1,440 a day. Charts showing a script that reads a key update within
      seconds of a write.
  - name: Affiliate
paths:
  /v1/trader-lockout:
    post:
      tags:
        - Trader Lockout
      summary: Start or extend a trader lockout
      description: >-
        Irreversible. Locks trading on the named accounts, or on every active
        account this key can see (`all_accounts`), until the chosen time. It
        cannot be ended or shortened early, by you or by Support, so
        `acknowledged: true` is required. Choose the unlock time with a
        `duration` preset (as on the website: 15 minutes to 24 hours, or the
        next midnight New York time) or an exact future `expires_at`, at most 90
        days away. A request may extend an account's running lockout, never
        shorten it: an unlock time earlier than a running lockout is refused
        with `409 trader_lockout_ends_later`. Open positions, resting orders,
        exit orders, and running TWAP and scaled orders stay as they are unless
        `close_trades_first` is true. Then every open trade on up to 100
        accounts is canceled or closed with reduce-only market orders first, and
        the accounts lock only once all of them are flat; otherwise nothing
        locks and the response says what was closed. Closing gets about 70
        seconds; trades still open after that are reported the same way, with
        nothing locked. Requires trade scope. Starting lockouts is rate limited
        per user: 5 at once, refilling at 10 an hour, and refused requests count
        too. Close-and-lock is limited further, per user to a burst of one,
        refilling at 4 an hour, and can return `429` when many are running
        across the platform. A key revoked or narrowed while a request runs
        stops it before the next close or the lock. The reported counts and
        `pending_work` cover only the closes and cancels this request submitted
        itself. When a selected account leads copy trading, copies of its closes
        on follower accounts run separately and are not counted, even on a
        selected follower; a selected follower still locks only once it is flat.
      operationId: startTraderLockout
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StartTraderLockoutRequest'
      responses:
        '200':
          description: The accounts are locked.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/TraderLockoutResult'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            `trader_lockout_ends_later`: a running lockout on a selected account
            ends after the requested time; nothing was locked.
            `trader_lockout_not_locked`: with `close_trades_first`, trades could
            not all be closed and nothing was locked; `error.details` gives the
            reason and how many positions were closed and orders canceled. When
            `error.details.pending_work` is above 0, that many of the request's
            closes or cancels were still settling, so the counts are provisional
            and those orders can still fill or cancel: read your positions and
            orders before retrying. `trader_lockout_outcome_unknown`: with
            `close_trades_first`, the server could not confirm what the request
            changed, including whether the lock was applied; `error.details`
            counts are null. Read the lockout (`GET /v1/trader-lockout`), your
            positions, and your orders before retrying.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TraderLockoutRefusalEnvelope'
        '413':
          description: Request body exceeds 64 KiB, which fits 1,000 `account_ids`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '415':
          description: Request body is not sent as application/json.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: >-
            Nothing was locked: the unlock time has passed
            (`trader_lockout_expired`), is more than 90 days and 5 minutes away
            (`trader_lockout_too_long`, `trader_lockout_extends_long_existing`),
            a named account is no longer active
            (`trader_lockout_account_inactive`), there is no active account to
            lock (`trader_lockout_no_active_account`), with `all_accounts` on a
            key not limited to certain accounts the owner has more than 1,000
            unarchived accounts (`trader_lockout_too_many_accounts`; more than
            1,000 `account_ids` is a `400`), with `close_trades_first` an
            already-locked account still has open trades it can't close
            (`trader_lockout_locked_trades_open`), or a close-and-lock limit is
            exceeded (`trader_lockout_close_too_many_*`).
            `error.details.account_id` names the account when there is one.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TraderLockoutRefusalEnvelope'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    StartTraderLockoutRequest:
      type: object
      additionalProperties: false
      required:
        - acknowledged
      description: >-
        Send exactly one of `account_ids` and `all_accounts`, and exactly one of
        `duration` and `expires_at`.
      properties:
        account_ids:
          type: array
          minItems: 1
          maxItems: 1000
          items:
            type: string
          description: Accounts to lock. Each must be active.
        all_accounts:
          type: boolean
          enum:
            - true
          description: >-
            Lock every active, unarchived account this key can see. For a key
            not limited to certain accounts, refused with `422` when the owner
            has more than 1,000 unarchived accounts of any status.
        duration:
          type: string
          enum:
            - 15m
            - 30m
            - 1h
            - 2h
            - 4h
            - 8h
            - 12h
            - 24h
            - next_midnight_et
          description: >-
            How long to lock from now. `next_midnight_et` locks until the next
            midnight in New York (Eastern time).
        expires_at:
          description: >-
            Exact unlock time, in the future and at most 90 days away (the
            server allows 5 extra minutes for clock differences): Unix
            milliseconds, or an ISO 8601 time with `Z` or a UTC offset.
            Fractional seconds finer than a millisecond are truncated to the
            millisecond.
          oneOf:
            - type: integer
            - type: string
              format: date-time
        acknowledged:
          type: boolean
          enum:
            - true
          description: >-
            Confirms the lockout cannot be ended early, by you or by Support.
            Required.
        close_trades_first:
          type: boolean
          default: false
          description: >-
            Close every open trade on the accounts first and lock only once all
            are flat, within about 70 seconds. At most 100 accounts, 200
            positions, and 1,000 working orders. Defaults to false, which keeps
            trades open.
    TraderLockoutResult:
      type: object
      required:
        - status
        - expires_at
        - accounts
        - closed_positions
        - canceled_orders
      properties:
        status:
          type: string
          enum:
            - locked
        expires_at:
          type: integer
          description: >-
            The unlock time applied to every returned account, Unix
            milliseconds. A request whose time is earlier than a running lockout
            is refused instead (`409 trader_lockout_ends_later`).
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/TraderLockoutAccount'
        closed_positions:
          type: integer
          description: Positions closed first (only with `close_trades_first`).
        canceled_orders:
          type: integer
          description: Orders and TWAPs canceled first (only with `close_trades_first`).
    TraderLockoutRefusalEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/ErrorBase'
            - type: object
              properties:
                details:
                  type: object
                  description: >-
                    `account_id` names the account the refusal is about, and
                    `limit` the close-and-lock limit exceeded. For
                    `trader_lockout_not_locked` and
                    `trader_lockout_outcome_unknown`, `reason` (`close_failed`,
                    `still_open`, or `refused`), `code`, `account_id`, `symbol`,
                    `closed_positions`, `canceled_orders`, and `pending_work`
                    (closes or cancels still settling, which makes the counts
                    provisional) say what happened; for
                    `trader_lockout_outcome_unknown` all three are null.
                  additionalProperties: true
    ErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/Error'
    TraderLockoutAccount:
      type: object
      required:
        - account_id
        - name
        - trader_lockout
      properties:
        account_id:
          type: string
        name:
          type: string
        trader_lockout:
          description: The running lockout, or null when the account is not locked.
          oneOf:
            - $ref: '#/components/schemas/TraderLockout'
            - type: 'null'
    ErrorBase:
      type: object
      required:
        - code
        - message
        - request_id
      properties:
        code:
          type: string
        message:
          type: string
        request_id:
          type: string
          format: uuid
    Error:
      type: object
      required:
        - code
        - message
        - request_id
      properties:
        code:
          type: string
        message:
          type: string
        request_id:
          type: string
          format: uuid
        details:
          type: array
          description: >-
            Present on request-validation failures, with one entry per invalid
            field so a request can be fixed in one pass.
          items:
            $ref: '#/components/schemas/ValidationIssue'
    TraderLockout:
      type: object
      required:
        - id
        - started_at
        - expires_at
      properties:
        id:
          type: string
        started_at:
          type: integer
          description: When the lockout started or was last extended, Unix milliseconds.
        expires_at:
          type: integer
          description: When trading unlocks, Unix milliseconds. Nothing ends it sooner.
    ValidationIssue:
      type: object
      required:
        - field
        - issue
      properties:
        field:
          type: string
          description: >-
            Wire name of the offending request field, such as `size` or
            `operations[2].price`. The value `body` refers to the whole payload.
        issue:
          type: string
  responses:
    BadRequest:
      description: >-
        Invalid request. Validation failures list every offending field in
        `error.details`.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unauthorized:
      description: Missing, invalid, or revoked API key, or an invalid partner key.
      headers:
        WWW-Authenticate:
          schema:
            type: string
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: The API key is valid but does not allow this operation.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    NotFound:
      description: Resource not found or not owned by the authenticated user.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RateLimited:
      description: >-
        The per-IP request limit, a per-key GET limit, a partner budget, or an
        account-wide operation budget is exhausted.
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-RateLimit-Scope:
          $ref: '#/components/headers/RateLimitScope'
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  headers:
    RequestId:
      description: Stable identifier for support and log correlation.
      schema:
        type: string
        format: uuid
    RetryAfter:
      description: Seconds to wait before retrying.
      schema:
        type: integer
        minimum: 1
    RateLimitLimit:
      description: >-
        Requests per minute allowed by the request budget that ran out. Sent on
        request-budget 429s; account-wide operation budget 429s omit it.
      schema:
        type: integer
        minimum: 1
    RateLimitScope:
      description: >-
        Which request budget ran out: `ip` for the per-address limit, `api_key`
        for a per-key budget (default per-key GET limit, custom key limit, or a
        partner's per-trader-key budget), or `partner` for a partner's combined
        budget. Sent on request-budget 429s; account-wide operation budget 429s
        omit it.
      schema:
        type: string
        enum:
          - ip
          - api_key
          - partner
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: MyFundedPerps API key
      description: >-
        API key beginning with `fp_live_` (live keys, served at
        developers.myfundedperpetuals.com) or `fp_test_` (test keys, served at
        sandbox.myfundedperpetuals.com). A key presented on the other host is
        rejected with `401` and a message naming the correct host. Affiliate API
        keys are `fp_live_` keys created on the Affiliates page: they read only
        the `/v1/affiliate` endpoints and get `403` with code
        `insufficient_scope` on every other authenticated endpoint. Every other
        key gets the same `403` on `/v1/affiliate`.
    partnerKey:
      type: apiKey
      in: header
      name: X-MFP-Partner-Key
      description: >-
        Optional partner key beginning with `mfp_partner_`, issued by
        MyFundedPerps to platforms that call the live API on behalf of many
        traders. Send it beside the trader's own `fp_live_` key: the request is
        then counted against the partner's budgets instead of the per-address
        limit. It grants no access on its own. An unknown, malformed, or revoked
        partner key returns `401` with code `invalid_partner_key`. The header is
        ignored on the sandbox host and on requests without a live trader key.

````

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