# Unpublish

Takes the agent offline: visitors see a not found page until it is published again.

|  |  |
| --- | --- |
| REST | `POST /api/v1/agents/{agent_id}/unpublish` |
| MCP tool | `unpublish_agent` |
| Classification | **Sensitive write** |
| Scope | `agents:publish` |
| Minimum role on the agent | admin |
| Confirmation | Required: `confirm: true`, after the person agrees |
| Retry safety | Safe to retry with the same input |
| Success status | 200 |

## What it does

Takes the agent offline: visitors see a not found page until it is published again. Needs agents:publish and confirm: true.

## Side effects

Takes the agent offline: its page and short links answer not found until it is published again.

## Inputs

| Name | Type | Required | In | Description |
| --- | --- | --- | --- | --- |
| `agent_id` | string | yes | path | The agent id (agt_...), from list_agents. |
| `confirm` | true | no | body | Set to true after reviewing the effect with the person you work for. Required for destructive operations. |

## Example

REST:

```bash
curl -X POST "https://covo.lanaai.io/api/v1/agents/agt_4edc89bb2964/unpublish" \
  -H "Authorization: Bearer $COVO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"confirm":true}'
```

MCP (POST /mcp):

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "unpublish_agent",
    "arguments": {
      "agent_id": "agt_4edc89bb2964",
      "confirm": true
    }
  }
}
```

## Response

Returns an object with `agent_id`, `status`, `published_at`, `revision`, `latest_version`, `url`, `permanent_url`, `passport_url` and `places`. This is a real response, shortened to two items per list.

200 response:

```json
{
  "agent_id": "agt_4edc89bb2964",
  "status": "draft",
  "published_at": "2026-10-07T20:14:41.981Z",
  "revision": 9,
  "latest_version": 4,
  "url": "https://covo.lanaai.io/avery",
  "permanent_url": "https://covo.lanaai.io/a/agt_4edc89bb2964",
  "passport_url": null,
  "places": [
    {
      "id": "56a01a61-e1a5-4bdf-b1d7-533d280b81e9",
      "key": "pl_a82927d351",
      "kind": "profile",
      "name": "Main link",
      "enabled": true,
      "link": "https://covo.lanaai.io/avery",
      "short_link": "https://covo.lanaai.io/go/URj6uSU",
      "embed": null
    }
  ]
}
```

Over MCP the same object comes back as the tool result, in `structuredContent` and as JSON text.

## Errors

| Status | Code | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | No token, or it is unknown, revoked or expired. OAuth apps refresh or reconnect. |
| 403 | `account_suspended` | The account that owns the token is paused. |
| 403 | `insufficient_scope` | The token lacks `agents:publish`. |
| 403 | `role_insufficient` | The person is not an admin or owner of this agent. |
| 404 | `agent_not_found` | Unknown agent, or not reachable with this token. |
| 400 | `bad_request` | An input is invalid; `field` names it. |
| 409 | `confirmation_required` | Review the effect with the person you work for, then send `confirm: true`. |
| 429 | `rate_limited` | Wait `Retry-After` seconds. |
