> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update JWK

> Updates an existing JWK (JSON Web Key) and deploys it to environments. Updating a JWK that was created from a source will detach it from the source.

## Endpoint

```
PUT /apiops/projects/{projectName}/jwks/{jwkName}/
```

## Authentication

Requires a Personal API Access Token.

### Header

```
Authorization: Bearer YOUR_TOKEN
```

## Request

### Headers

| Header        | Value            | Required |
| ------------- | ---------------- | -------- |
| Authorization | Bearer `{token}` | Yes      |
| Content-Type  | application/json | Yes      |

### Path Parameters

| Parameter   | Type   | Required | Description               |
| ----------- | ------ | -------- | ------------------------- |
| projectName | string | Yes      | Project name              |
| jwkName     | string | Yes      | Name of the JWK to update |

### Request Body

```json theme={null}
{
  "name": "updated-jwk",
  "description": "Updated JWK description"
}
```

### Request Body Fields

| Field       | Type   | Required | Description                              |
| ----------- | ------ | -------- | ---------------------------------------- |
| name        | string | No       | New JWK name (must be unique if changed) |
| description | string | No       | New JWK description                      |

### Notes

* If `name` is changed, it must be unique within the project
* Updating a JWK that was created from a source (URL, certificate, key, keystore) will detach it from the source
* JWK is automatically deployed to all environments after update

## Response

### Success Response (200 OK)

```json theme={null}
{
  "success": true,
  "deploymentResult": {
    "success": true,
    "message": "Deployment completed successfully",
    "environmentResults": [
      {
        "environmentName": "production",
        "success": true,
        "message": "Deployed successfully"
      }
    ]
  }
}
```

### Error Response (400 Bad Request)

```json theme={null}
{
  "error": "bad_request",
  "error_description": "JWK (name: my-jwk) is not found! Try create operation."
}
```

or

```json theme={null}
{
  "error": "bad_request",
  "error_description": "JWK (name: updated-jwk) is already exist!"
}
```

## cURL Example

```bash theme={null}
curl -X PUT \
  "https://demo.apinizer.com/apiops/projects/MyProject/jwks/my-jwk/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "updated-jwk",
    "description": "Updated JWK description"
  }'
```

## Notes and Warnings

* **Source Detachment**:
  * Updating a JWK created from a source will detach it from the source
  * The JWK becomes independent after update

* **Name Changes**:
  * Name can be changed, but must remain unique
  * All references to the old name must be updated

* **Automatic Deployment**:
  * JWK is automatically deployed after update
  * Deployment results are returned in the response

## Permissions

User must have **`SECRETS` + `MANAGE`** permission in the project. For deployment operations (when deploying JWKs to environments), user must also have **`SECRETS` + `DEPLOY_UNDEPLOY`** permission.

## Related Documentation

* [List JWKs](/api-reference/keys-secrets/crud/list-jwks) - List all JWKs
* [Get JWK](/api-reference/keys-secrets/crud/get-jwk) - Get a specific JWK
* [Create JWK](/api-reference/keys-secrets/crud/create-jwk) - Create a new JWK
* [Delete JWK](/api-reference/keys-secrets/crud/delete-jwk) - Delete a JWK
