# Change a cloud account

`PATCH https://evohub.io/api/v1/catalog/connections/{id}`

Part of the [Catalog API](https://docs.evohub.io/catalog.md) reference · operationId `updateConnection`.

Changes the name, role ARN, directory id or regions, or gives a
portvMind application credential (`credential_id` and
`credential_secret`). The secret is stored encrypted and never
returned; reads show `has_secret`. A changed role is read at once,
but not within two minutes of the last read.

Requires the `identity:cloudaccount:write` scope.

## Authorization

Any one of:

- `bearerKey`
- `headerKey`

Where:

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

## Path parameters

- `id` (string, required, example `con_7d9f1b3a5c7e9a2c4e6b8d0f2a4c6e8b`): The cloud account's ID.

## Request body (required)

Content type: `application/json`

Type: `object`

- `name` (string, max length 100)
- `role_arn` (string)
- `tenant_id` (string)
- `credential_id` (string)
- `credential_secret` (string, max length 512, write-only)
- `regions` (array of string, max items 40)

## Responses

### 200 — The cloud account.

Content type: `application/json`

Type: `object`

- `data` (CloudConnection)
  - `id` (string, example `con_7d9f1b3a5c7e9a2c4e6b8d0f2a4c6e8b`)
  - `source_id` (string)
  - `environment_id` (string)
  - `provider` (string, one of `aws`, `azure`, `gcp`, `vmind`)
  - `name` (string)
  - `role_arn` (string)
  - `tenant_id` (string)
  - `credential_id` (string)
  - `has_secret` (boolean)
  - `external_id` (string): Ours, random and unique. Empty without `identity:cloudaccount:write`.
  - `regions` (array of string): Empty means every region the account has enabled.
  - `account_id` (string)
  - `status` (string, one of `pending`, `ok`, `error`, `paused`)
  - `last_error` (string)
  - `denied` (array of string): Services the access did not let it read on the last read. Not a failure.
  - `last_polled_at` (string (date-time) | null)
  - `next_poll_at` (string (date-time))
  - `created_by` (string)
  - `created_at` (string (date-time))
  - `updated_at` (string (date-time))

### 400 — The request is not valid: a field or filter value is wrong (`VALIDATION_ERROR`, with a sentence saying what), the body is not the expected JSON or carries an unknown field (`INVALID_BODY`), the cursor is not one this list gave (`INVALID_CURSOR`), a binding names a service that does not exist (`UNKNOWN_COMPONENT`), or a `PATCH` tries to change a slug (`SLUG_IMMUTABLE`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `not found`)
  - `request_id` (string)

### 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, example `NOT_FOUND`)
  - `message` (string, required, example `not found`)
  - `request_id` (string)

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

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `not found`)
  - `request_id` (string)

### 404 — Nothing with this ID (or slug) exists in the organization (`NOT_FOUND`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `not found`)
  - `request_id` (string)

### 409 — Another one already has this name (`NAME_TAKEN`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `not found`)
  - `request_id` (string)

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

Headers:

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

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `not found`)
  - `request_id` (string)

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

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `not found`)
  - `request_id` (string)

### 503 — Cloud accounts for this provider cannot be connected on this EvoHub (`CLOUD_NOT_CONFIGURED`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `not found`)
  - `request_id` (string)

## Example request

```bash
curl -X PATCH 'https://evohub.io/api/v1/catalog/connections/con_7d9f1b3a5c7e9a2c4e6b8d0f2a4c6e8b' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <TOKEN>' \
  -d '{
  "role_arn": "arn:aws:iam::123456789012:role/EvoHubCatalogReadOnly"
}'
```
