# Update an administrator

`PATCH https://api.cademi.com.br/api/v3/administrators/{administrator_id}`

Operation ID: `administrators.update` · API v3

Updates an administrator's name or email address, or restores an administrator from the trash.

To restore a trashed administrator, set `deleted` to `false`. Restoring requires the `administrators.delete` permission and is rejected with `validation_failed` if another active administrator already uses the same email address.

The `status` field is accepted but has no effect. Roles and permissions can only be changed through the update administrator permissions operation. Fields such as `role` and `password` are rejected with `unknown_field`.

Send the `ETag` returned by the retrieve operation in the `If-Match` header to avoid overwriting a newer version.

Required permissions: `administrators.update`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `administrator_id` | path | string | yes |  |

## Request body

Content type: `application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `deleted` | boolean | no |  |
| `email` | string (email) | no |  |
| `name` | string | no |  |
| `status` | string, one of `active`, `inactive` | no |  |

## Responses

### 200

Returns the updated administrator.

Body: `data`: Administrator.

Fields of Administrator:

| Field | Type | Required | Description |
|---|---|---|---|
| `created_at` | string (date-time) | yes |  |
| `deleted` | boolean | yes |  |
| `email` | string (email) | yes |  |
| `id` | string | yes |  |
| `last_login_at` | string or null (date-time) | yes |  |
| `name` | string | yes |  |
| `object` | string, one of `administrator` | yes |  |
| `product_ids` | array of string | yes |  |
| `revision` | string | yes |  |
| `role` | string, one of `root`, `admin`, `product_admin`, `master_admin`, `support`, `designer` | yes |  |
| `status` | string, one of `active`, `inactive` | yes |  |
| `two_factor_enabled` | boolean | yes |  |
| `updated_at` | string (date-time) | yes |  |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 404

The administrator was not found or is not accessible with the current credentials.

Body: Error.

### 409

Another administrator already uses this email address.

Body: Error.

### 412

The administrator has changed since the supplied revision was retrieved.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

Full schema: https://cademi.dev/openapi/v3.json
