---
title: "Api Prepare Restart"
method: POST
path: "/admin/api/prepare-restart"
tags: ["admin"]
---

# Api Prepare Restart

`POST /admin/api/prepare-restart`

## Request

- Base URL: `https://mcp.sentinelx.app` (the document declares no server; this is the origin it was published from)
- URL: `https://mcp.sentinelx.app/admin/api/prepare-restart`
- Auth: none declared

Drain this worker's agents ahead of a planned restart.

Called by the deploy before stopping the process, because by the time a
shutdown hook runs uvicorn has already closed the sockets: the hint would
have nobody left to tell. Here the sessions are still up, so each agent is
given its own retry_after and comes back spread over a window rather than
the whole fleet arriving at once while the hub is still starting.

Draining also stops the per-session Redis cleanup that a mass disconnect
triggers. That cleanup is three or four round trips per session, it
exhausts a pool of 100 within seconds, and it fails for nearly every
session anyway -- 10,280 "Too many connections" in a single restart. What
it would have written expires by itself in 90 seconds.

Only this worker's own sessions are reachable from here; with several
workers the deploy calls it once per worker, or simply accepts that the
remainder fall back to their own schedule.

## Query parameters

- `spread_seconds` number, nullable
- `refuse_new_work` boolean

## Cookies

- `sentinelx_dash_session` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/sentinelx/apis/sentinelx-hub.md) · [All operations](https://skmtc.dev/sentinelx/apis/sentinelx-hub/llms.txt) · [OpenAPI document](https://skmtc.dev/sentinelx/apis/sentinelx-hub/revisions/d1f84924795e?raw)
