Update a vault
curl --request PATCH \
--url https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"provider_config": {}
}
'import requests
url = "https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}"
payload = {
"name": "<string>",
"provider_config": {}
}
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>', provider_config: {}})
};
fetch('https://agp.eu.hcompany.ai/api/v2/vaults/{vault_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}",
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>',
'provider_config' => [
]
]),
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}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"provider_config\": {}\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}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"provider_config\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/vaults/{vault_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 \"provider_config\": {}\n}"
response = http.request(request)
puts response.read_bodyVaults
Update a vault
Change a vault config’s name or provider settings.
PATCH
/
api
/
v2
/
vaults
/
{vault_id}
Update a vault
curl --request PATCH \
--url https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"provider_config": {}
}
'import requests
url = "https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}"
payload = {
"name": "<string>",
"provider_config": {}
}
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>', provider_config: {}})
};
fetch('https://agp.eu.hcompany.ai/api/v2/vaults/{vault_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}",
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>',
'provider_config' => [
]
]),
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}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"provider_config\": {}\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}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"provider_config\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/vaults/{vault_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 \"provider_config\": {}\n}"
response = http.request(request)
puts response.read_bodyPartially updates a vault config. Only the fields you send are changed. To replace the stored service account token, use Rotate the token instead.
Returns the updated vault object.
Path parameters
The vault config’s
id (UUID).Request body
New label for the config.
Replacement provider settings:
provider (optional, defaults onepassword) and op_vault_id (required when provided).Examples
curl -X PATCH https://agp.eu.hcompany.ai/api/v2/vaults/f47ac10b-58cc-4372-a567-0e02b2c3d479 \
-H "Authorization: Bearer $HAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "prod-1password-eu"}'
from hai_agents import Client
client = Client()
vault = client.vaults.update_vault(
vault_id="f47ac10b-58cc-4372-a567-0e02b2c3d479",
name="prod-1password-eu",
)
print(vault.name)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const vault = await client.vaults.updateVault({
vaultId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
name: "prod-1password-eu",
});
console.log(vault.name);
Errors
| Status | Cause |
|---|---|
404 | Vault not found or you don’t have access. |
422 | Body failed validation. |
Was this page helpful?
⌘I