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

# Pause or resume trading on every instrument with the given expiration

> Operational kill-switch. When `paused = true`, the matching engine
rejects new limit and market orders for every instrument matching
`expiration` with the `INSTRUMENT_PAUSED` (1014) error code.
Existing resting orders are unaffected — owners can still cancel
them, and a subsequent `paused = false` call lifts the block.

Atomic in two phases: durable UPDATE first (with `RETURNING id`),
then mirror into the in-memory matching engine. The response
surfaces both counts plus any drift between the two layers
(`engine_missing`) so an operator can verify the change took.
Idempotent: re-invoking with the same `paused` value updates zero
rows the second time without raising an error.




## OpenAPI

````yaml /_generated/openapi.yaml post /v1/admin/instruments/pause-by-expiration
openapi: 3.1.0
info:
  title: Joyride Exchange REST API
  version: 1.0.0
  description: >
    REST API for the Joyride 0DTE Options Exchange.


    ## Authentication


    **Public endpoints** (`/health`, `/v1/market/*`, `/v1/spot/*`,
    `/v1/oracle/*`) require no authentication.


    **Competition prize claims** (`/v1/competition/claim`) are
    self-authenticated

    by a Solana ed25519 signature over the wallet, Discord handle, and payout

    destination in the request body. No JWT is required for that endpoint.


    **Account endpoints** (`/v1/account/*`, `/v1/orders/*`,
    `/v1/social/profile`, `/v1/social/avatar`) require JWT authentication via
    one of:

    1. `Authorization: Bearer <jwt>` header (primary — native clients)

    2. `Cookie: joyride_session=<jwt>` (web clients, set automatically by
    `/v1/auth/verify`)


    **Withdrawal endpoints** (`/withdrawals`, `/v1/withdrawals`) require the

    `Authorization: Bearer <jwt>` header. A session cookie alone is not
    accepted.


    Obtain a JWT by completing the SIWS (Sign In With Solana) flow:

    1. `POST /v1/auth/nonce` with your wallet address to get a nonce

    2. Sign the canonical SIWS message with your wallet

    3. `POST /v1/auth/verify` with wallet, signature, and message to receive a
    JWT


    **Mutating admin endpoints** require a bearer token:

    ```

    Authorization: Bearer <ADMIN_TOKEN>

    ```


    ## Data Conventions


    - **Prices**: Integer values in USDC micros (1 USDC = 1,000,000 micros).
      Example: `1500000` = $1.50
    - **Sizes**: Integer values in millicontracts (1 contract = 1000
    millicontracts).
      Example: `1000` = 1 contract
    - **Balances**: USDC micros. Example: `10_000_000_000` = $10,000

    - **Timestamps**: Unix microseconds (µs since epoch)

    - **Instrument IDs**: Format `{ASSET}_USDC-{DMMMYY}-{STRIKE}-{C|P}`.
      Example: `SOL_USDC-28FEB26-150-C`

    ## Trading


    **Trading is WebSocket-only.** The HTTP API has no order placement
    endpoints.

    See the AsyncAPI spec for WebSocket trading methods.
  contact:
    name: Joyride Engineering
    email: engineering@joyride.exchange
  license:
    name: Proprietary
servers:
  - url: https://joyride.exchange/api
    description: Production
security: []
tags:
  - name: Authentication
    description: |
      SIWS (Sign In With Solana) authentication flow. Obtain a JWT for use
      with all authenticated endpoints. No prior authentication required.
  - name: Health
    description: Service health check.
  - name: Market Data
    description: Publicly accessible market data. No authentication required.
  - name: Account
    description: User-specific account data. Requires user identification.
  - name: Orders
    description: User order history. Requires user identification.
  - name: Withdrawals
    description: Request signed withdrawal authorizations and list withdrawal history.
  - name: Social
    description: Social features — profiles, leaderboard, and activity.
  - name: Referrals
    description: Referral-code validation and attribution surfaces.
  - name: Competition
    description: Competition-specific collection flows.
  - name: Spot
    description: Spot prices and volatility data.
  - name: Oracle
    description: Oracle data — prices, TWAP previews, and settlement timing.
  - name: AI Chat
    description: >
      AI-powered trading assistant. Uses SIWS (Sign In With Solana)
      authentication

      and JWT sessions. Returns responses as Server-Sent Events (SSE).
  - name: Admin
    description: Administrative operations. Requires admin bearer token.
paths:
  /v1/admin/instruments/pause-by-expiration:
    post:
      tags:
        - Admin
      summary: Pause or resume trading on every instrument with the given expiration
      description: |
        Operational kill-switch. When `paused = true`, the matching engine
        rejects new limit and market orders for every instrument matching
        `expiration` with the `INSTRUMENT_PAUSED` (1014) error code.
        Existing resting orders are unaffected — owners can still cancel
        them, and a subsequent `paused = false` call lifts the block.

        Atomic in two phases: durable UPDATE first (with `RETURNING id`),
        then mirror into the in-memory matching engine. The response
        surfaces both counts plus any drift between the two layers
        (`engine_missing`) so an operator can verify the change took.
        Idempotent: re-invoking with the same `paused` value updates zero
        rows the second time without raising an error.
      operationId: pauseInstrumentsByExpiration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                expiration:
                  type: integer
                  description: >-
                    Expiration timestamp (Unix seconds). All instruments with
                    this exact expiration are flipped.
                  example: 1740816000
                paused:
                  type: boolean
                  description: >-
                    Target state. `true` blocks new orders; `false` lifts the
                    block.
                  example: true
              required:
                - expiration
                - paused
      responses:
        '200':
          description: Pause/resume applied
          content:
            application/json:
              schema:
                type: object
                properties:
                  expiration:
                    type: integer
                    example: 1740816000
                  paused:
                    type: boolean
                    example: true
                  db_updated:
                    type: integer
                    description: |
                      Number of rows updated in the `instruments` table.
                      Only rows whose `paused` value actually changed are
                      counted (idempotent SQL via `IS DISTINCT FROM`).
                    example: 50
                  engine_updated:
                    type: integer
                    description: |
                      Number of in-memory engine instruments whose pause
                      flag was flipped this call. May be lower than
                      `db_updated` even in the happy path if the engine
                      was already at the target state for some
                      instruments (drift correction). A separate signal
                      from `engine_missing`.
                    example: 50
                  engine_missing:
                    type: array
                    items:
                      type: string
                    description: |
                      Instrument ids that were updated in the database
                      but are NOT registered in the in-memory engine at
                      all (engine has no entry for them). A non-empty
                      list signals genuine DB-vs-engine membership
                      drift — likely a gateway restart in progress, or
                      a row inserted directly without going through
                      `engine.create_expiration`. The "engine knew about
                      it but was already at target" case is distinct
                      and shows up as `engine_updated < db_updated`
                      with an empty `engine_missing`.
                    example: []
                required:
                  - expiration
                  - paused
                  - db_updated
                  - engine_updated
                  - engine_missing
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - adminAuth: []
components:
  responses:
    Unauthorized:
      description: >
        Authentication required or invalid admin token.

        For JWT-protected endpoints, `error` is prefixed with an auth code:

        `auth_missing`, `auth_missing_or_wallet_query`, `auth_malformed`,
        `auth_expired`, or `auth_signature_invalid`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
          description: >-
            Human-readable error message (auth failures may include an `auth_*`
            code prefix)
          example: Instrument not found
      required:
        - error
  securitySchemes:
    adminAuth:
      type: http
      scheme: bearer
      description: Admin token set via the ADMIN_TOKEN environment variable.

````