# Update a component

`PUT https://evohub.io/api/v1/components/{componentID}`

Part of the [Status API](https://docs-dev.evohub.io/status.md) reference · operationId `updateComponent`.

Updates a component. `current_status` and `position` left out are kept;
`description` and `group` are written as sent (left out clears them).

**Permission (API-key scope):** `status:component:write`.

## Authorization

Any one of:

- `bearerAuth` (status:component:write)
- `apiKeyHeader` (status:component:write)

Where:

- `bearerAuth`: HTTP Bearer — An EvoHub API key (`evohub_…`) as a bearer token.
- `apiKeyHeader`: API key in the header `X-API-Key` — An EvoHub API key (`evohub_…`).

## Path parameters

- `componentID` (string (uuid), required, example `a7c1e3f5-2b4d-4c6e-8f0a-1b3d5f7a9c2e`): The component's id (a UUID).

## Request body (required)

Content type: `application/json`

Type: `ComponentWrite`

- `name` (string, required)
- `description` (string | null)
- `source` (string, one of `manual`, `uptime_monitor`, default `manual`)
- `monitor_id` (string | null, pattern `^[A-Za-z0-9_-]{1,128}$`): Required for `uptime_monitor`: one of your organization's Uptime monitors.
- `current_status` (ComponentStatus, one of `operational`, `degraded`, `partial_outage`, `major_outage`, `maintenance`): On create defaults to `operational`; on update, left out keeps it. A monitor-linked component shows its monitor's live state instead.
- `position` (integer | null): On create, left out puts it last; on update, left out keeps it.
- `group` (string | null): Written as sent: on update, leaving it out or sending `""` ungroups it.

## Responses

### 200 — The component.

Content type: `application/json`

Type: `object`

- `data` (Component, required)
  - `id` (string (uuid), required)
  - `org_id` (string, required)
  - `page_id` (string (uuid), required)
  - `name` (string, required)
  - `description` (string)
  - `source` (string, required, one of `manual`, `uptime_monitor`)
  - `monitor_id` (string): The Uptime monitor it mirrors (source `uptime_monitor`).
  - `current_status` (ComponentStatus, required, one of `operational`, `degraded`, `partial_outage`, `major_outage`, `maintenance`)
  - `position` (integer, required)
  - `group` (string): The group (product) it appears under; absent when ungrouped.
  - `shown_status` (ComponentStatus, one of `operational`, `degraded`, `partial_outage`, `major_outage`, `maintenance`): In the page's component list only, and only when a live incident or maintenance shows it differently from `current_status` on the public page.
  - `shown_because` (string): The live incident's or maintenance's title that makes visitors see `shown_status`.
  - `created_at` (string (date-time), required)
  - `updated_at` (string (date-time), required)
- `success` (boolean, required, value `true`)

### 400 — A field is missing or invalid (`VALIDATION_ERROR`), the monitor is not your organization's (`MONITOR_NOT_FOUND`), or the body is not valid (`INVALID_BODY`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

### 401 — No API key was sent, or it is unknown, revoked or expired (`UNAUTHORIZED`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

### 403 — The key lacks the scope this endpoint needs (`FORBIDDEN`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

### 404 — No such item, or one the caller cannot see (`NOT_FOUND`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

### 409 — A page per group is on and this would make more than 3 groups (`PRODUCT_LIMIT`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

### 429 — Too many requests (`RATE_LIMITED`). Wait `Retry-After` seconds.

Headers:

- `Retry-After` (integer): Seconds to wait.

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

### 500 — Something went wrong on EvoHub's side (`INTERNAL_ERROR`). Retry later.

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

## Example request

```bash
curl -X PUT 'https://evohub.io/api/v1/components/a7c1e3f5-2b4d-4c6e-8f0a-1b3d5f7a9c2e' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <TOKEN>' \
  -d '{
  "name": "API",
  "group": "Platform",
  "source": "uptime_monitor",
  "monitor_id": "mon_7a8b9c",
  "description": "Public REST API (v2)"
}'
```
