# Unpublish Agent (Revert to Draft)

`POST /api/agents/{agent_id}/unpublish`

### Overview
Withdraws an agent from active service, reverting its status back to `draft`.

### Authentication & Headers
- **Auth**: Bearer Token (L1 / L2)
- **Required Header**: `API-Version: 1`

### Parameters
- **`agent_id`** *(path, string, required)*: Unique UUID of the agent to unpublish.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `agent_id` | path | string | yes | Unique UUID of the target AI Agent. |

## Responses

### 200 — Agent reverted to draft

### 400 — Bad Request - The request parameters or headers are invalid (e.g. unsupported API-Version).

### 401 — Unauthorized - Missing, invalid, or expired JWT Bearer token.

### 403 — Forbidden - Insufficient role permissions or resource access denied by RBAC policy.

### 404 — Not Found - The requested resource ID was not found.

### 422 — Validation Error

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `detail` | object[] | no |  |
| `detail[].loc` | string | integer[] | yes |  |
| `detail[].msg` | string | yes |  |
| `detail[].type` | string | yes |  |
| `detail[].input` | object | no |  |
| `detail[].ctx` | object | no |  |

```json
{
  "detail": [
    {
      "loc": [
        null
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

## Example

```bash
curl -X POST "$PINTER_URL/api/agents/agnt_risk_compliance_01/unpublish" \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```
