---
title: "Update an agent"
method: PATCH
path: "/api/workspaces/{workspaceId}/agents/{agentId}"
tags: ["Agents"]
---

# Update an agent

`PATCH /api/workspaces/{workspaceId}/agents/{agentId}`

## Request

- Base URL: `https://hiveship.app/api`
- URL: `https://hiveship.app/api/api/workspaces/{workspaceId}/agents/{agentId}`
- Auth: API key in cookie `hiveship_access`

## Path parameters

- `workspaceId` string, required
- `agentId` string, required

## Request body

- object
  - `name` string
  - `isActive` boolean
  - `scope` 'READ' | 'SESSION' | 'WORKSPACE'
  - `avatarKey` string
  - `ownerId` string, cuid, nullable

## Response `200`

Agent updated

- object
  - `success` boolean, required
  - `data` object, required
    - `id` string, cuid, required
    - `name` string, required
    - `provider` 'CURSOR' | 'CLAUDE_CODE' | 'CODEX' | 'AIDER' | 'DEVIN' | 'COPILOT' | 'CUSTOM', required
    - `scope` 'READ' | 'SESSION' | 'WORKSPACE', required
    - `avatarUrl` string, nullable, required
    - `avatarKey` string, nullable, required
    - `isActive` boolean, required
    - `sessionCount` integer, required
    - `activeSessionCount` integer, required
    - `hasApiToken` boolean, required
    - `apiTokenRotatedAt` string, date-time, nullable, required
    - `apiTokenHint` string, nullable, required
    - `lastActivityAt` string, date-time, nullable, required
    - `recentSessionStatuses` string[], required
    - `owner` object, nullable, required
      - `id` string, cuid, required
      - `name` string, required
      - `avatarUrl` string, nullable, required
    - `dispatchWebhookUrl` string, nullable, required
    - `dispatchSecretHint` string, nullable, required

## Other responses

- `400`: Validation error
- `404`: Agent not found

---

[API](https://skmtc.dev/hiveship/apis/hiveship-api.md) · [All operations](https://skmtc.dev/hiveship/apis/hiveship-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hiveship/apis/hiveship-api/revisions/73d3e26544e4?raw)
