Update an item
curl --request PATCH \
--url https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"urls": [
"<string>"
],
"values": {}
}
'import requests
url = "https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}"
payload = {
"name": "<string>",
"urls": ["<string>"],
"values": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', urls: ['<string>'], values: {}})
};
fetch('https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'urls' => [
'<string>'
],
'values' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"urls\": [\n \"<string>\"\n ],\n \"values\": {}\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"urls\": [\n \"<string>\"\n ],\n \"values\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"urls\": [\n \"<string>\"\n ],\n \"values\": {}\n}"
response = http.request(request)
puts response.read_bodyVaults
Update an item
Rename an H-hosted vault item, replace its sites, or set and remove individual values.
PATCH
/
api
/
v2
/
vaults
/
{vault_id}
/
items
/
{item_id}
Update an item
curl --request PATCH \
--url https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"urls": [
"<string>"
],
"values": {}
}
'import requests
url = "https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}"
payload = {
"name": "<string>",
"urls": ["<string>"],
"values": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', urls: ['<string>'], values: {}})
};
fetch('https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'urls' => [
'<string>'
],
'values' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"urls\": [\n \"<string>\"\n ],\n \"values\": {}\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"urls\": [\n \"<string>\"\n ],\n \"values\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"urls\": [\n \"<string>\"\n ],\n \"values\": {}\n}"
response = http.request(request)
puts response.read_bodyOnly the fields you send change. Inside
values, only the keys you send change: set a key to a string to replace that value, or to null to remove it.
Returns the updated item object.
Path parameters
string
required
The H-hosted vault’s
id (UUID).string
required
The item’s
id (UUID).Request body
string
New label for the item, 1 to 255 characters.
string[]
Replaces the item’s sites: 1 to 20
http or https URLs with a host.object
Values to set or remove, at least one key. Keys:
username, password, email, totp, api_key. A string (1 to 4096 characters) sets that value; null removes it. Keys you leave out keep their value. The item must keep at least one value.Examples
curl -X PATCH https://agp.eu.hcompany.ai/api/v2/vaults/3b8d9c2e-6f1a-4e5b-8c7d-0a9b8c7d6e5f/items/7c1e4b2a-9d3f-4a6b-8e5c-2f1a0b9c8d7e \
-H "Authorization: Bearer $HAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"values": {"password": "n3w-s3cret", "totp": null}}'
from hai_agents import Client
client = Client()
item = client.vaults.update_vault_item(
vault_id="3b8d9c2e-6f1a-4e5b-8c7d-0a9b8c7d6e5f",
item_id="7c1e4b2a-9d3f-4a6b-8e5c-2f1a0b9c8d7e",
values={"password": "n3w-s3cret", "totp": None},
)
print(item.fields)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const item = await client.vaults.updateVaultItem({
vaultId: "3b8d9c2e-6f1a-4e5b-8c7d-0a9b8c7d6e5f",
itemId: "7c1e4b2a-9d3f-4a6b-8e5c-2f1a0b9c8d7e",
values: { password: "n3w-s3cret", totp: null },
});
console.log(item.fields);
Response
{
"id": "7c1e4b2a-9d3f-4a6b-8e5c-2f1a0b9c8d7e",
"vault_id": "3b8d9c2e-6f1a-4e5b-8c7d-0a9b8c7d6e5f",
"name": "Example admin",
"urls": ["https://example.com/login"],
"fields": ["password", "username"],
"created_at": "2026-05-08T09:15:00Z",
"updated_at": "2026-05-09T11:02:00Z"
}
Errors
| Status | Cause |
|---|---|
400 | The vault is not H-hosted, the new totp value is not a valid authenticator secret, or the update would leave the item with no values. |
404 | Vault or item not found, or you don’t have access. |
422 | Body failed validation. Validation errors never echo the submitted values. |
502 | The item’s stored values could not be read. Retry; nothing was changed. |
Was this page helpful?