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

# Get warm hook

> Returns the environment's warm hook, warm pool status, and up to 20 recent snapshots.



## OpenAPI

````yaml /openapi.json get /v1/environments/{environment_id}/warm-hooks
openapi: 3.1.0
info:
  title: Replicas API
  version: 2.0.0
  description: >-
    Create and control workspaces, and manage the environments, automations, and
    learnings they run with.
servers:
  - url: https://api.replicas.dev
    description: Production API
security:
  - apiKey: []
tags:
  - name: Replica
    description: >-
      A replica is a Replicas workspace: a cloud sandbox where a coding agent
      works on your repositories.
  - name: Chats
    description: Manage the agent chats inside a replica.
  - name: Message queue
    description: Messages waiting for the agent to finish its turn.
  - name: Commands and terminals
    description: Run commands and open shells in a replica.
  - name: Pull requests
    description: Inspect and act on pull requests a replica opened.
  - name: Previews
    description: Public URLs for ports in a replica.
  - name: Canvas
    description: Plans, reports, and other files agents produce.
  - name: Sharing
    description: Add replicas to members' Shared view.
  - name: Environments
    description: >-
      Environments define what a workspace starts with. A fork builds on the
      environments it was forked from.
  - name: Environment variables
    description: Variables injected into workspaces.
  - name: Environment files
    description: Files written into workspaces.
  - name: Environment skills
    description: Agent skills installed into workspaces.
  - name: Environment MCPs
    description: MCP servers available to workspace agents.
  - name: Hooks
    description: Scripts that run when warm pool snapshots build and when workspaces start.
  - name: Warm pools
    description: Pre-built workspaces that start faster.
  - name: Automations
    description: Run agents on schedules and events.
  - name: Repositories
    description: Repositories connected to the organization.
  - name: Learnings
    description: Organization skills every workspace agent loads.
  - name: Agent credentials
    description: >-
      API keys and endpoints that coding agents use. Connect Claude, Codex, and
      Muse subscriptions with the CLI.
  - name: Plugins
    description: Connect integrations that workspace agents can use.
  - name: Organization
    description: Who you are and who is in your organization.
  - name: Media
    description: Screenshots, recordings, and other files workspaces produce.
  - name: Slack
    description: Route Slack threads to workspaces.
  - name: Workspace identity
    description: OIDC keys for verifying workspace identity tokens.
paths:
  /v1/environments/{environment_id}/warm-hooks:
    get:
      tags:
        - Hooks
      summary: Get warm hook
      description: >-
        Returns the environment's warm hook, warm pool status, and up to 20
        recent snapshots.
      operationId: getEnvironmentWarmHooks
      parameters:
        - name: environment_id
          in: path
          required: true
          description: Environment UUID.
          schema:
            type: string
        - $ref: '#/components/parameters/ApiVersion'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetWarmHooksResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    ApiVersion:
      name: X-Replicas-Api-Version
      in: header
      description: >-
        API version. `2026-10-07` returns `snake_case` responses. See
        [versioning](/features/api#versioning).
      required: false
      schema:
        type: string
        enum:
          - '2026-10-07'
  schemas:
    GetWarmHooksResponse:
      type: object
      properties:
        warm_hook:
          oneOf:
            - $ref: '#/components/schemas/WarmHookRecord'
            - type: 'null'
          description: >-
            The active warm hook for the environment (null if none has ever been
            saved).
        warm_pool:
          oneOf:
            - $ref: '#/components/schemas/WarmPoolConfigWithStats'
            - type: 'null'
          description: >-
            The warm pool config and current counts (null if no pool has been
            configured).
        snapshots:
          type: array
          description: Up to 20 retained snapshots ordered newest first.
          items:
            $ref: '#/components/schemas/WarmPoolSnapshotRecord'
        builds:
          type: array
          description: Up to 20 builds ordered newest first.
          items:
            $ref: '#/components/schemas/WarmPoolBuildRecord'
        serving:
          oneOf:
            - $ref: '#/components/schemas/WarmPoolServingState'
            - type: 'null'
          description: >-
            Which build new workspaces come from now, and the build in progress
            (null if no pool has been configured).
      required:
        - warm_hook
        - warm_pool
        - snapshots
        - builds
        - serving
    WarmHookRecord:
      type: object
      description: >-
        A warm hook — the shell script that runs while pre-warming workspaces
        for an environment.
      properties:
        id:
          type: string
          format: uuid
        organization_id:
          type: string
          format: uuid
        environment_id:
          type: string
          format: uuid
        version:
          type: integer
          description: Monotonic version (newer scripts have higher versions)
        content:
          type: string
          description: Shell script content
        is_active:
          type: boolean
          description: Whether this version is the active one for the environment
        created_at:
          type: string
          format: date-time
      required:
        - id
        - organization_id
        - environment_id
        - version
        - content
        - is_active
        - created_at
    WarmPoolConfigWithStats:
      type: object
      description: Warm pool configuration plus current pool counts.
      properties:
        id:
          type: string
          format: uuid
        organization_id:
          type: string
          format: uuid
        environment_id:
          type: string
          format: uuid
        enabled:
          type: boolean
        target_size:
          type: integer
          description: >-
            Target number of pre-warmed workspaces, sized from the environment's
            recent demand
        generation:
          type: integer
          description: >-
            Monotonic counter bumped on every invalidation. Workspaces and
            snapshots carry the generation they were built for; anything older
            is stale by derivation.
        error_count:
          type: integer
          description: >-
            Consecutive reconcile failures since the last success. Resets to 0
            on success; drives exponential backoff via `next_retry_at`.
        next_retry_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Earliest time the next reconcile pass may run for this config. Null
            when not in backoff.
        last_error_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When the most recent reconcile error was recorded (null if no
            current error).
        last_error_message:
          type:
            - string
            - 'null'
          description: Most recent reconcile error message (null if no current error).
        has_base_snapshot:
          type: boolean
          description: Whether the current generation has a base snapshot.
        updated_at:
          type: string
          format: date-time
        ready_count:
          type: integer
          description: >-
            Number of pre-warmed workspaces at the current generation that are
            ready to be assigned
        stale_count:
          type: integer
          description: >-
            Number of ready workspaces at older generations. Still claimable as
            a fallback; trimmed by reconcile when over target.
        warming_count:
          type: integer
          description: >-
            Number of workspaces at the current generation that are currently
            warming (warm hooks running)
        snapshotting_count:
          type: integer
          description: >-
            Number of seed workspaces currently capturing a base snapshot (E2B
            only). Always 0 on providers without live snapshots.
        last_failure_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the most recent warm-up failure occurred (null if never)
        last_failure_reason:
          type:
            - string
            - 'null'
          description: Reason for the most recent warm-up failure
      required:
        - id
        - organization_id
        - environment_id
        - enabled
        - target_size
        - generation
        - error_count
        - next_retry_at
        - last_error_at
        - last_error_message
        - has_base_snapshot
        - updated_at
        - ready_count
        - stale_count
        - warming_count
        - snapshotting_count
        - last_failure_at
        - last_failure_reason
    WarmPoolSnapshotRecord:
      type: object
      description: A retained provider snapshot for one successful warm-pool generation.
      properties:
        id:
          type: string
          format: uuid
          description: Snapshot record UUID used by the restore endpoint
        warm_pool_config_id:
          type: string
          format: uuid
        generation:
          type: integer
          description: Warm-pool generation that captured this snapshot
        is_current:
          type: boolean
          description: >-
            Whether the config is currently installed on this snapshot.
            Restoring an older version moves this flag back onto that version.
        is_fallback:
          type: boolean
          description: >-
            Whether this snapshot is serving while the current generation warms
            or recovers
        created_at:
          type: string
          format: date-time
      required:
        - id
        - warm_pool_config_id
        - generation
        - is_current
        - is_fallback
        - created_at
    WarmPoolBuildRecord:
      type: object
      description: One warm pool generation that was asked to build.
      properties:
        id:
          type: string
          format: uuid
        generation:
          type: integer
        status:
          type: string
          enum:
            - queued
            - building
            - succeeded
            - failed
            - superseded
            - cancelled
        reasons:
          type: array
          items:
            type: string
          description: Every change folded into this build while it was queued
        attempts:
          type: integer
        queued_at:
          type: string
          format: date-time
        build_after:
          type: string
          format: date-time
          description: When a queued build starts unless more edits push it back
        started_at:
          type:
            - string
            - 'null'
          format: date-time
        finished_at:
          type:
            - string
            - 'null'
          format: date-time
        superseded_by:
          type:
            - string
            - 'null'
          format: uuid
        error_message:
          type:
            - string
            - 'null'
        builder_warm_pool_workspace_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            Warm pool workspace that ran the build; stream its output from
            `/v1/warm-pool-workspaces/{id}/stream`
        changes:
          type: array
          items:
            $ref: '#/components/schemas/EnvironmentChange'
          description: >-
            Edits this build applies, including those of earlier builds that
            never went live
        failure_kind:
          type:
            - string
            - 'null'
          enum:
            - hook
            - infra
            - null
        restorable:
          type: boolean
          description: >-
            The setup this build made live is stored and can be restored with
            `POST /v1/environments/{environment_id}/restore`
        run_id:
          type:
            - string
            - 'null'
          format: uuid
          description: The latest warm hook run this build started
      required:
        - id
        - generation
        - status
        - reasons
        - attempts
        - queued_at
        - build_after
        - started_at
        - finished_at
        - superseded_by
        - error_message
        - builder_warm_pool_workspace_id
        - changes
        - failure_kind
        - restorable
        - run_id
    WarmPoolServingState:
      type: object
      properties:
        serving_build:
          oneOf:
            - $ref: '#/components/schemas/WarmPoolBuildRecord'
            - type: 'null'
          description: >-
            Build a workspace created now would be claimed from; null means it
            would start cold
        serving_generation:
          type:
            - integer
            - 'null'
        serving_is_current:
          type: boolean
        ready_count:
          type: integer
        current_ready_count:
          type: integer
        pending_build:
          oneOf:
            - $ref: '#/components/schemas/WarmPoolBuildRecord'
            - type: 'null'
          description: Queued or running build for the current generation
      required:
        - serving_build
        - serving_generation
        - serving_is_current
        - ready_count
        - current_ready_count
        - pending_build
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
        details:
          type:
            - string
            - 'null'
          description: Additional error details
        code:
          type: string
          description: Machine-readable error code when available
      required:
        - error
    EnvironmentChange:
      type: object
      description: One edit waiting to reach new workspaces.
      properties:
        kind:
          type: string
          enum:
            - repositories
            - warm_hook
            - variable
            - file
            - skill
            - skills_registry
            - default_skills
            - agent_auth
            - workspace_size
            - agent_setup
            - restore
            - system
        key:
          type:
            - string
            - 'null'
          description: >-
            The edited row: variable key, file path, skill slug, registry, or
            provider. The new size for `workspace_size`, and what happened for
            `system`
        op:
          type: string
          enum:
            - created
            - updated
            - deleted
        user_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            Who made the edit. `00000000-0000-0000-0000-000000000000` when
            Replicas made it
      required:
        - kind
        - key
        - op
        - user_id
  responses:
    BadRequest:
      description: Bad request - Missing or invalid parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized - Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: Organization or personal API key from **Settings → API Keys**.

````

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