Vaults
Reveal an item
Read an H-hosted vault item’s values, with the current TOTP code in place of its secret. Audit-logged.
POST
/
api
/
v2
/
vaults
/
{vault_id}
/
items
/
{item_id}
/
reveal
Reveal an item
curl --request POST \
--url https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}/reveal \
--header 'Authorization: Bearer <token>'import requests
url = "https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}/reveal"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}/reveal', 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}/reveal",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}/reveal"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}/reveal")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}/reveal")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"values": {},
"totp_code": {},
"totp_expires_in": {}
}A stored
totp secret is never returned: you get its current code and when that code expires instead. Any member of your organization can reveal an item, and every reveal is audit-logged with who read which fields.
Returns the values object below. The response carries Cache-Control: no-store.
Path parameters
Response
Whole seconds
totp_code stays valid, counted when it was generated, and at least 3. Count down from when you sent the request, so your clock’s skew doesn’t matter. null if the item has no totp secret.Examples
curl -X POST https://agp.eu.hcompany.ai/api/v2/vaults/3b8d9c2e-6f1a-4e5b-8c7d-0a9b8c7d6e5f/items/7c1e4b2a-9d3f-4a6b-8e5c-2f1a0b9c8d7e/reveal \
-H "Authorization: Bearer $HAI_API_KEY"
from hai_agents import Client
client = Client()
revealed = client.vaults.reveal_vault_item(
vault_id="3b8d9c2e-6f1a-4e5b-8c7d-0a9b8c7d6e5f",
item_id="7c1e4b2a-9d3f-4a6b-8e5c-2f1a0b9c8d7e",
)
print(revealed.values["username"], revealed.totp_code)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const revealed = await client.vaults.revealVaultItem({
vaultId: "3b8d9c2e-6f1a-4e5b-8c7d-0a9b8c7d6e5f",
itemId: "7c1e4b2a-9d3f-4a6b-8e5c-2f1a0b9c8d7e",
});
console.log(revealed.values.username, revealed.totpCode);
Response
{
"values": {"username": "admin@example.com", "password": "s3cret"},
"totp_code": "492039",
"totp_expires_in": 27
}
Errors
| Status | Cause |
|---|---|
400 | The vault is not H-hosted. |
404 | Vault or item not found, or you don’t have access. |
502 | The item’s stored values could not be read. Retry. |
Was this page helpful?
⌘I
Reveal an item
curl --request POST \
--url https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}/reveal \
--header 'Authorization: Bearer <token>'import requests
url = "https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}/reveal"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}/reveal', 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}/reveal",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}/reveal"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}/reveal")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/vaults/{vault_id}/items/{item_id}/reveal")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"values": {},
"totp_code": {},
"totp_expires_in": {}
}