---
title: "Save warm hook"
method: POST
path: "/v1/environments/{environment_id}/warm-hooks/save"
tags: ["Hooks"]
---

# Save warm hook

`POST /v1/environments/{environment_id}/warm-hooks/save`

## Request

- Base URL: `https://api.replicas.dev`
- URL: `https://api.replicas.dev/v1/environments/{environment_id}/warm-hooks/save`
- Auth: HTTP bearer

Saves and activates the warm hook without testing it. Empty content removes it.

## Path parameters

- `environment_id` string, required

## Headers

- `X-Replicas-Api-Version` '2026-10-07'

## Request body

- SaveWarmHookRequest
  - `content` string, required: Shell script to persist and activate. Empty content clears the active warm hook.

## Response `201`

Warm hook saved and activated, or cleared when content is empty

- SaveWarmHookResponse
  - `warm_hook` WarmHookRecord, required: A warm hook — the shell script that runs while pre-warming workspaces for an environment.
    - `id` string, uuid, required
    - `organization_id` string, uuid, required
    - `environment_id` string, uuid, required
    - `version` integer, required: Monotonic version (newer scripts have higher versions)
    - `content` string, required: Shell script content
    - `is_active` boolean, required: Whether this version is the active one for the environment
    - `created_at` string, date-time, required

## Other responses

- `400`: Bad request - Missing or invalid parameters
- `401`: Unauthorized - Invalid or missing API key
- `500`: Internal server error

---

[API](https://skmtc.dev/replicas/apis/replicas-api.md) - [All operations](https://skmtc.dev/replicas/apis/replicas-api/llms.txt) - [OpenAPI document](https://skmtc.dev/replicas/apis/replicas-api/revisions/2703ac1c9cb7?raw)
