> For the complete documentation index, see [llms.txt](https://docs.enclaive.cloud/virtual-hsm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.enclaive.cloud/virtual-hsm/cli/storage-and-data-mangement/vhsm-patch.md).

# vhsm patch

The `vhsm patch` command updates data in vHSM server at the specified path. It functions as a wrapper for HTTP PATCH, using the JSON Patch format. The data can include credentials, secrets, configuration, or arbitrary key-value pairs.

Unlike `write`, the `patch` command only modifies specified data without overwriting other existing values.

### **Examples**

| Action                                         | Command                                                 |
| ---------------------------------------------- | ------------------------------------------------------- |
| Update a PKI role to modify a single parameter | `vhsm patch pki/roles/example allow_localhost=false`    |
| Update a PKI role using JSON input             | `vhsm patch pki/roles/example - < request_payload.json` |

#### **API  versus CLI equivalent**

The following `vhsm patch` command:

```sh
vhsm patch pki/roles/example allow_localhost=false
```

Is equivalent to the following cURL command:

```sh
tee request_payload.json -<<EOF
{
   "organization": "enclaive"
}
EOF

curl --header "X-Vault-Token: $VAULT_TOKEN" \
     --request PATCH \
     --header 'Content-Type: application/merge-patch+json' \
     --data @request_payload.json \
     $VAULT_ADDR/v1/pki/roles/example
```

The CLI `vhsm patch` simplifies this API call.

### **Usage**

```
vhsm patch <path> [options] [key=value] [...]
```

* The command updates existing values at the given vHSM path.
* Data can be provided as key-value pairs, from a file (`@filename`), or via stdin (`-`).

### **Command Options**

| Option             | Description                                                                          | Default |
| ------------------ | ------------------------------------------------------------------------------------ | ------- |
| `-field=<name>`    | Print only a specific field in the output                                            | `None`  |
| `-format=<format>` | Output format: `table`, `json`, or `yaml`                                            | `table` |
| `-force` or `-f`   | Allow operation with no `key=value` pairs (useful for paths that don't require data) | `false` |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.enclaive.cloud/virtual-hsm/cli/storage-and-data-mangement/vhsm-patch.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
