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

# Get L1 onchain action history

> Returns the lifecycle of onchain actions submitted via `OnchainActionManager.sol`. Public endpoint.

Onchain actions are either applied directly or with a `fallback` flag. Each onchain action is affected by the `fallback` flag uniquely:

- Deposits: sequencer moved the deposit into the `fallback_subaccount`
- SetSessionKey: no-op
- Admin actions: no-op

The onchain action can have several states:

- `applied`: action was successfully applied by the sequencer
- `applied_with_fallback`: action was applied by the sequencer with fallback=true
- `instant_fallback`: action failed its initial attempt, will be re-submitted with fallback=true
- `retry_then_fallback`: action failed its initial attempt, will be re-submitted with fallback=false until the retry budget is exceeded, then re-submitted with fallback=true
- `never_escalate`: action failed its initial attempt but will retry until successful, never with fallback=true



## OpenAPI

````yaml /openapi.json post /public/get_onchain_action_history
openapi: 3.1.0
info:
  title: Derive v3 API
  version: 0.2.0
  description: JSON-RPC 2.0 methods, served over WebSocket and HTTP POST.
servers:
  - url: https://api.derive.xyz/v3
    description: Production (HTTP POST base)
  - url: https://testnet.api.derive.xyz/v3
    description: Testnet (HTTP POST base)
security: []
tags:
  - name: Subaccounts
    description: >-
      List, inspect, and label subaccounts, portfolios, positions, and
      collateral.
  - name: Session Keys
    description: Register, edit, and list delegated signing keys.
  - name: Account
    description: Wallet-level account information and settings.
  - name: Orderbook
    description: Place, replace, cancel, and query orders, trigger orders, and algos.
  - name: RFQ
    description: 'Request-for-quote: send RFQs, quote, and execute block trades.'
  - name: Vault Shareholders
    description: >-
      Deposit into and withdraw from vaults, and track shares, requests, and
      performance.
  - name: Vault Curators
    description: >-
      Create and operate curated vaults: settle deposit and withdrawal requests,
      and manage vault metadata.
  - name: History
    description: >-
      Per-account historical records: orders, trades, transfers, and
      settlements.
  - name: Market Maker Protection
    description: Configure, read, and reset market-maker protection.
  - name: Transfers & Withdrawals
    description: Move collateral between subaccounts, to other wallets, and on-chain.
  - name: System
    description: Rate limits and transaction lookups.
  - name: Market Data
    description: Instruments, currencies, tickers, and market-wide feeds.
  - name: Referrals
    description: Referral codes and program performance.
  - name: Other
    description: Uncategorized.
paths:
  /public/get_onchain_action_history:
    post:
      tags:
        - System
      summary: Get L1 onchain action history
      description: >-
        Returns the lifecycle of onchain actions submitted via
        `OnchainActionManager.sol`. Public endpoint.


        Onchain actions are either applied directly or with a `fallback` flag.
        Each onchain action is affected by the `fallback` flag uniquely:


        - Deposits: sequencer moved the deposit into the `fallback_subaccount`

        - SetSessionKey: no-op

        - Admin actions: no-op


        The onchain action can have several states:


        - `applied`: action was successfully applied by the sequencer

        - `applied_with_fallback`: action was applied by the sequencer with
        fallback=true

        - `instant_fallback`: action failed its initial attempt, will be
        re-submitted with fallback=true

        - `retry_then_fallback`: action failed its initial attempt, will be
        re-submitted with fallback=false until the retry budget is exceeded,
        then re-submitted with fallback=true

        - `never_escalate`: action failed its initial attempt but will retry
        until successful, never with fallback=true
      operationId: public_get_onchain_action_history
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetOnchainActionHistoryParams'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetOnchainActionHistoryResponse'
        default:
          description: JSON-RPC error (see Error Codes)
components:
  schemas:
    GetOnchainActionHistoryParams:
      type: object
      properties:
        action_type:
          description: On-chain `actionType` id.
          default: null
          type:
            - integer
            - 'null'
          format: uint64
          minimum: 0
        end_timestamp:
          default: null
          type:
            - integer
            - 'null'
          format: int64
        page:
          default: null
          type:
            - integer
            - 'null'
          format: uint32
          minimum: 0
        page_size:
          default: null
          type:
            - integer
            - 'null'
          format: uint32
          minimum: 0
        start_timestamp:
          default: null
          type:
            - integer
            - 'null'
          format: int64
        wallet:
          description: L1 sender of the action (any hex casing).
          default: null
          type:
            - string
            - 'null'
    GetOnchainActionHistoryResponse:
      type: object
      required:
        - actions
        - pagination
      properties:
        actions:
          type: array
          items:
            $ref: '#/components/schemas/OnchainActionHistoryEntry'
        pagination:
          $ref: '#/components/schemas/Pagination'
    OnchainActionHistoryEntry:
      type: object
      required:
        - acc
        - action_id
        - action_type
        - action_type_label
        - block_number
        - data
        - l1_sender
        - queue
        - status
        - updated_at
      properties:
        acc:
          description: Rolling accumulator from the ActionQueued event, 0x-hex.
          type: string
        action_id:
          type: integer
          format: uint64
          minimum: 0
        action_type:
          type: integer
          format: uint64
          minimum: 0
        action_type_label:
          type: string
        block_number:
          type: integer
          format: uint64
          minimum: 0
        data:
          description: Raw action calldata, 0x-hex.
          type: string
        error_code:
          description: >-
            Most recent submit rejection; null if the action never failed. Kept
            on applied/fallback rows as the reason the action struggled. The
            verbose error text stays internal (ClickHouse only).
          type:
            - integer
            - 'null'
          format: int64
        error_message:
          type:
            - string
            - 'null'
        fallback_at:
          description: >-
            Unix ms the action was escalated with `fallback=true`; null if never
            escalated.
          type:
            - integer
            - 'null'
          format: int64
        first_failed_at:
          description: Unix ms of the first failed submit; null if the action never failed.
          type:
            - integer
            - 'null'
          format: int64
        l1_sender:
          type: string
        last_failed_at:
          description: Unix ms of the most recent failed submit; null if never failed.
          type:
            - integer
            - 'null'
          format: int64
        op_uuid:
          description: Operation uuid assigned by the sequencer; null until applied.
          type:
            - string
            - 'null'
        queue:
          description: 'Onchain queue: ''public'' or ''admin''.'
          type: string
        status:
          description: >-
            Sequencer applied states: 'applied' | 'applied_with_fallback' Failed
            States: 'instant_fallback' | 'retry_then_fallback' |
            'never_escalate'
          type: string
        tx_hash:
          type:
            - string
            - 'null'
        updated_at:
          description: Unix ms of the latest state change.
          type: integer
          format: int64
    Pagination:
      description: Response envelope for paginated RPCs.
      type: object
      required:
        - count
        - num_pages
      properties:
        count:
          type: integer
          format: uint64
          minimum: 0
        num_pages:
          type: integer
          format: uint64
          minimum: 0

````

## Related topics

- [Get a vault's economic action history](/api-reference/vault-shareholders/get-a-vaults-economic-action-history.md)
- [Get withdrawal history for a subaccount](/api-reference/history/get-withdrawal-history-for-a-subaccount.md)
- [Contracts](/getting-started/contracts.md)
