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

# Test Start Hook

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

Runs the supplied start hook script in an isolated sandbox without persisting it, and returns the full result once the hook finishes. Useful for short-lived clients (CLI, scripts) that prefer a single response over an SSE stream. Takes 30–90 seconds to return.

## Path parameters

- `environmentId` string, required

## Request body

- TestStartHookRequest
  - `content` string, required — Shell script to execute (not persisted)

## Response `200`

Test executed

- TestStartHookResponse
  - `test` StartHookTestResult, required — Result of running a start hook script in an isolated sandbox.
    - `exit_code` integer, required — Process exit code (0 = success)
    - `output` string, required — Captured stdout + stderr
    - `timed_out` boolean, required — Whether execution was killed for taking too long

## 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)
