---
title: "Toggle Service Api"
method: POST
path: "/api/servers/toggle"
tags: ["Server Management"]
---

# Toggle Service Api

`POST /api/servers/toggle`

## Request

- The document declares no server URL.
- Auth: HTTP bearer

Toggle a service's enabled/disabled state via JWT authentication (External API).

This endpoint provides the same functionality as POST /api/internal/toggle
but uses modern JWT Bearer token authentication.

**Authentication:** JWT Bearer token (via nginx X-User header)
**Authorization:** Requires valid JWT token from auth system

**Request body (form data):**
- `path` (required): Service path
- `new_state` (required): New state (true=enabled, false=disabled)

**Response:**
Returns the updated service status.

**Example:**
```bash
curl -X POST https://registry.example.com/api/servers/toggle \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -F "path=/myservice" \
  -F "new_state=true"
```

## Request body `application/x-www-form-urlencoded`

- BodyToggleServiceApiApiServersTogglePost
  - `path` string, required
  - `new_state` boolean, required

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/ascending-llc/apis/mcp-gateway-registry.md) - [All operations](https://skmtc.dev/ascending-llc/apis/mcp-gateway-registry/llms.txt) - [OpenAPI document](https://skmtc.dev/ascending-llc/apis/mcp-gateway-registry/revisions/31381943e2e7?raw)
