# Update a credential policy

`PATCH https://api.cademi.com.br/api/v3/credentials/{credential_id}/policies/{policy_id}`

Operation ID: `credentials.policies.update` · API v3

Replaces the capabilities and resources of a policy. The change publishes a new policy revision in which the other policies remain unchanged. The policy keeps the same `policy_id` across revisions.

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

Permissions that the calling credential cannot delegate are rejected with `delegation_limit_exceeded`, and no new revision is published. A credential cannot modify its own policies.

Required permissions: `credentials.policies.manage`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `credential_id` | path | string | yes |  |
| `policy_id` | path | string | yes |  |
| `If-Match` | header | string | no |  |

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `capabilities` | array of string | yes |  |
| `resources` | array of object | yes |  |

## Responses

### 200

Returns the updated policy as part of the new revision.

Body: `data`: Policy.

Fields of Policy:

| Field | Type | Required | Description |
|---|---|---|---|
| `capabilities` | array of string | yes |  |
| `id` | string | yes |  |
| `object` | string, one of `policy` | yes |  |
| `published_at` | string or null (date-time) | yes |  |
| `published_by` | object | yes |  |
| `resources` | array of object | yes |  |
| `version` | integer | 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 credential or policy was not found, the policy is not part of the credential's active policy revision, or the resource is not accessible with the current credentials.

Body: Error.

### 412

The credential has changed since the revision supplied in If-Match was retrieved.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

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