---
title: "Rename an agent or change its model connection or channels (null disconnects a channel). A running agent restarts to use them."
method: PATCH
path: "/agents/{agentId}"
tags: ["Agents"]
---

# Rename an agent or change its model connection or channels (null disconnects a channel). A running agent restarts to use them.

`PATCH /agents/{agentId}`

## Request

- Base URL: `https://hostingsurge.com/api/v1`
- URL: `https://hostingsurge.com/api/v1/agents/{agentId}`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-hs_session`

## Path parameters

- `agentId` string, uuid, required

## Request body

- object
  - `name` string
  - `model` union
    - object
      - `mode` 'none', required
    - object
      - `mode` 'byok', required
      - `provider` 'openrouter' | 'openai' | 'anthropic' | 'custom', required
      - `modelId` string
      - `baseUrl` string
      - `apiKey` string
    - object
      - `mode` 'platform', required
      - `modelId` string
  - `channels` object
    - `telegram` object, nullable
      - `botToken` string
      - `allowedUsers` string[], required
    - `discord` object, nullable
      - `botToken` string
      - `allowedUsers` string[], required

## Response `200`

Saved

- object
  - `id` string, required
  - `organizationId` string, required
  - `projectId` string, nullable, required
  - `name` string, required
  - `kind` 'hermes' | 'openclaw', required
  - `kindName` string, required
  - `version` string, required
  - `status` 'provisioning' | 'running' | 'stopped' | 'error' | 'deleting' | 'deleted', required
  - `statusDetail` string, nullable, required
  - `health` 'healthy' | 'unhealthy' | 'starting' | 'unknown', required
  - `healthCheckedAt` string, nullable, required: ISO-8601 timestamp
  - `resources` object, required
    - `cpus` number, required
    - `memoryMb` number, required
  - `model` object, required
    - `mode` 'none' | 'byok' | 'platform', required
    - `provider` 'openrouter' | 'openai' | 'anthropic' | 'custom' | 'null', nullable, required
    - `modelId` string, nullable, required
    - `baseUrl` string, nullable, required
    - `keySet` boolean, required
  - `channels` object[], required
    - `channel` 'telegram' | 'discord', required
    - `connected` boolean, required
    - `allowedUsers` string[], required
    - `tokenSet` boolean, required
  - `billing` 'free_beta' | 'plan', required
  - `alwaysOn` true, required
  - `backups` object, required
    - `included` true, required
  - `createdAt` string, required: ISO-8601 timestamp
  - `updatedAt` string, required: ISO-8601 timestamp

## Other responses

- `400`: Invalid request (code invalid_request)
- `401`: Missing or invalid session/token (code unauthorized)
- `402`: The plan does not include private agents (upgrade_required) or the team has as many as it may (limit_reached)
- `403`: Authenticated but not permitted (code forbidden)
- `404`: Not found or not visible to the caller (code not_found)
- `409`: Conflict (code conflict), e.g. the agent is being deleted
- `413`: The request body is too large
- `429`: Too many requests (code rate_limited)
- `501`: Not available on this server (code not_configured): switched off, or migration 199 is not applied
- `503`: The hosting engine is unavailable (code engine_unavailable)

---

[API](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api.md) · [All operations](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/revisions/4d08337cdff1?raw)
