---
title: "Save Start Hook"
method: POST
path: "/v1/environments/{environmentId}/start-hooks/save"
tags: ["Environments"]
---

# Save Start Hook

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

Persists and activates the supplied script as the start hook for the environment. Empty content clears the active start hook. Editing a start hook does not invalidate the warm pool — the new content is picked up automatically on the next claim, since start hooks run at workspace boot rather than during warming.

## Path parameters

- `environmentId` string, required

## 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.net/tryreplicas/apis/replica-api.md) · [All operations](https://skmtc.net/tryreplicas/apis/replica-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tryreplicas/replica-api/versions/aa3b4c932f7a/schema)
