---
title: "[Internal] Stop a deployment via container exit hook"
method: POST
path: "/v1/hooks/stop/{request_id}"
tags: ["Deployments"]
---

# \[Internal\] Stop a deployment via container exit hook

`POST /v1/hooks/stop/{request_id}`

## Request

- Base URL: `https://api.edgegap.com`
- URL: `https://api.edgegap.com/v1/hooks/stop/{request_id}`
- Auth: API key in header `authorization`

Internal endpoint called by ExternalHooksManager when a container exits and the AppVersion restart policy requires the deployment to be stopped. Not intended for direct client use.

## Path parameters

- `request_id` string, required

## Request body

- HooksStopPayload
  - `exit_code` integer, required: Exit code returned by the container process
  - `exit_reason` string, required: Human-readable reason for the container exit as reported by Kubeless
  - `restart_policy` 'always' | 'never' | 'on_failure', required: Restart policy configured on the AppVersion that triggered this stop

## Response `200`

Stop initiated

- HooksStopResponse
  - `request_id` string, required: Unique identifier of the deployment being stopped
  - `message` string, required: Confirmation message

## Other responses

- `401`: Unauthorized
- `403`: Forbidden — deployment is protected
- `404`: Deployment not found
- `500`: Internal Server Error

---

[API](https://skmtc.dev/edgegap/apis/edgegap-v1.md) · [All operations](https://skmtc.dev/edgegap/apis/edgegap-v1/llms.txt) · [OpenAPI document](https://skmtc.dev/edgegap/apis/edgegap-v1/revisions/9fa2b393a6be?raw)
