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

# Save start hook

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

## Request

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

Saves and activates the start hook. Empty content removes it. Does not rebuild the warm pool.

## Path parameters

- `environment_id` string, required

## Headers

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

## Request body

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

## Response `201`

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

- SaveStartHookResponse
  - `start_hook` StartHookRecord, required: A start hook — the shell script that runs at workspace boot (after the warm sandbox is claimed) 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)
