Vaults
A vault is a shared space in your organization: its members share memory, rules, and files. Create one, manage members, and chat inside it.
A vault is a container inside your organization that a set of members share.
It holds memory that chat can recall, its own standing rules, and files. A
chat request names the vault it is happening inside with vault_id. Access is
by membership: administering an organization does not, by itself, let you read
a vault you are not a member of.
Create a vault
POST /api/v1/vaults creates a vault. Only name is required, and names are
unique within an organization. You become the owner, and a member with read,
write, and share.
curl https://api.cruxy.ai/api/v1/vaults \
-H "Authorization: Bearer $CRUXY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Platform team",
"description": "Shared context for the platform team",
"external_id": "app-vault-8f2c"
}'const res = await fetch('https://api.cruxy.ai/api/v1/vaults', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CRUXY_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Platform team',
description: 'Shared context for the platform team',
external_id: 'app-vault-8f2c', // your own id for the vault; makes a retry safe
}),
})
if (!res.ok) throw new Error(`create failed: ${res.status} ${await res.text()}`)
const vault = await res.json()
// 201 with created: true the first time; 200 with created: false on a retry.
console.log(vault.id, vault.created, vault.permissions)Send external_id, your own system's identifier for the vault, whenever a
retry is possible. A second create naming an external_id your organization
has already seen returns the existing vault with 200 and created: false,
and writes nothing. Without it, a retry after a timeout hits 409
vault_name_exists, which carries no vault id. Reusing an external_id that
names a vault somebody else owns is 409 vault_external_id_conflict.
The optional fields:
| Field | Meaning |
|---|---|
description | Free text, at most 2000 characters. |
icon, color | Presentation, each from a fixed vocabulary that API Reference lists. An unknown value is 400 invalid_request. |
memory_scope | default or vault_only; see Chat inside a vault. |
external_id | Your identifier for the vault, which makes the create idempotent. |
PATCH /api/v1/vaults/{id} changes name, description, icon, color, or
memory_scope, and requires can_write. GET /api/v1/vaults/{id} reads one
vault, and GET /api/v1/vaults lists the vaults you can use, with two
filters: scope (all, owned, or shared) and archived.
Permissions
Every vault read carries a permissions block with your own four flags:
| Flag | What it allows |
|---|---|
can_read | Read the vault's content. |
can_write | Change the vault's content and metadata, and archive it. |
can_share | Add and remove members, granting only permissions you hold yourself. |
can_administer | Delete the vault, and hold or restore its members. It is true for the vault's owner and for an admin of its organization. |
The four do not imply one another: a member with read, write, and share does
not administer the vault. Each flag is resolved from the same check that gates
the matching request, so you can show or hide controls from this block alone.
Treat an absent can_administer as false.
A vault you cannot read answers 404 vault_not_found, whether it is in
another organization, you are not a member, or you are held. A member who is
refused an action they lack the flag for gets 403 vault_forbidden.
Members
POST /api/v1/vaults/{id}/members adds a member of your organization with
the permissions you name. All four fields are required.
curl https://api.cruxy.ai/api/v1/vaults/$VAULT_ID/members \
-H "Authorization: Bearer $CRUXY_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"user_id\": \"$USER_ID\",
\"can_read\": true,
\"can_write\": true,
\"can_share\": false
}"const vaultId = process.env.VAULT_ID
const userId = process.env.USER_ID // a member of your organization
const res = await fetch(`https://api.cruxy.ai/api/v1/vaults/${vaultId}/members`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CRUXY_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ user_id: userId, can_read: true, can_write: true, can_share: false }),
})
if (!res.ok) throw new Error(`add member failed: ${res.status} ${await res.text()}`)
const member = await res.json()
console.log(member.user_id, member.email, member.held)- Who may add. The vault's owner and organization admins may grant
anything. A member with
can_sharemay grant only permissions they hold: a member who cannot write cannot create a member who can. - Errors. A user outside your organization is
404user_not_found, and one who is already a member is409vault_member_exists. - List.
GET /api/v1/vaults/{id}/memberslists the members with their permissions, held members included. - Change.
PATCH /api/v1/vaults/{id}/members/{user_id}changes a member's read, write, and share flags; omitted fields keep their value. The rule against granting more than you hold applies to the resulting set of permissions. - Remove.
DELETE /api/v1/vaults/{id}/members/{user_id}removes a member, and their access ends immediately. The owner cannot be removed, and nobody can modify the owner's membership; delete the vault instead.
Hold a member
A hold suspends a member without changing their permissions.
PUT /api/v1/vaults/{id}/members/{user_id}/held with {"held": true} makes
the member's read, write, and share inert, and the vault reads to them as if
it did not exist. {"held": false} restores exactly the permissions they had.
curl -X PUT https://api.cruxy.ai/api/v1/vaults/$VAULT_ID/members/$USER_ID/held \
-H "Authorization: Bearer $CRUXY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "held": true }'const vaultId = process.env.VAULT_ID
const userId = process.env.USER_ID
const res = await fetch(
`https://api.cruxy.ai/api/v1/vaults/${vaultId}/members/${userId}/held`,
{
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.CRUXY_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ held: true }),
},
)
if (!res.ok) throw new Error(`hold failed: ${res.status} ${await res.text()}`)
const member = await res.json()
console.log(member.user_id, member.held) // the flags are unchangedOnly the vault's owner or an organization admin may set or clear a hold, which
is what can_administer reports; can_share does not allow it. The owner
cannot be held.
Archive and pin
- Archive.
PUT /api/v1/vaults/{id}/archivehides the vault from the default list; it appears only witharchived=true, and reads reportarchived: true. The vault and all its memory are untouched.DELETE /api/v1/vaults/{id}/archiverestores it. Both requirecan_write, are idempotent, and answer204. - Pin.
PUT /api/v1/vaults/{id}/pinpins the vault for you alone: a personal bookmark, reported aspinnedon your reads of the vault and never visible to other members.DELETE /api/v1/vaults/{id}/pinremoves it. Both need only that you can read the vault, are idempotent, and answer204. - Delete.
DELETE /api/v1/vaults/{id}deletes the vault, its membership list, and all memory stored in it. It requirescan_administer.
Files in a vault
A vault holds files for every member who can read it.
POST /api/v1/vaults/{id}/filesuploads a file into the vault. It is the same multipart upload asPOST /api/v1/files, with the same detection, document reading, and limits; see Files. It requirescan_write, andpurpose=chat_attachmentis refused.POST /api/v1/vaults/{id}/files/sharecopies one of your own files into the vault, named byfile_id, as a new vault file with its own id. The original stays yours and unchanged, and deleting either one never touches the other. The copy counts against your storage pool and spends no monthly upload allowance.GET /api/v1/vaults/{id}/fileslists the vault's files, newest first, paged likeGET /api/v1/files.GET /api/v1/vaults/{id}/files/{file_id}reads one, andGET /api/v1/vaults/{id}/files/{file_id}/contentdownloads its bytes. All three requirecan_read.DELETE /api/v1/vaults/{id}/files/{file_id}deletes a vault file for every member. Any member withcan_writemay delete any file in the vault, not only their own.
# Upload a file straight into the vault.
curl https://api.cruxy.ai/api/v1/vaults/$VAULT_ID/files \
-H "Authorization: Bearer $CRUXY_API_KEY" \
-F "[email protected]"
# Or copy in a file you already uploaded.
curl https://api.cruxy.ai/api/v1/vaults/$VAULT_ID/files/share \
-H "Authorization: Bearer $CRUXY_API_KEY" \
-H "Content-Type: application/json" \
-d "{ \"file_id\": \"$FILE_ID\" }"import { openAsBlob } from 'node:fs'
const vaultId = process.env.VAULT_ID
const auth = { Authorization: `Bearer ${process.env.CRUXY_API_KEY}` }
// Upload a file straight into the vault.
const form = new FormData()
form.append('file', await openAsBlob('handbook.pdf'), 'handbook.pdf')
const uploaded = await fetch(`https://api.cruxy.ai/api/v1/vaults/${vaultId}/files`, {
method: 'POST',
headers: auth,
body: form,
})
if (!uploaded.ok) throw new Error(`upload failed: ${uploaded.status}`)
const vaultFile = await uploaded.json()
console.log(vaultFile.id, vaultFile.retention_until, vaultFile.shared_with)
// List what the vault holds.
const listed = await fetch(`https://api.cruxy.ai/api/v1/vaults/${vaultId}/files`, {
headers: auth,
})
if (!listed.ok) throw new Error(`list failed: ${listed.status}`)
const { data, total } = await listed.json()
console.log(`${total} files`, data.map((f: { filename: string }) => f.filename))A vault file carries the fields of any file, plus vault_id, uploaded_by
(the user who uploaded or shared it, kept after they leave), shared_with
(how many members can read the vault), and retention_until. A vault file has
no expires_at: it is deleted at retention_until, 365 days from its last
use. An upload, a share, and a download each count as a use; reading metadata
does not.
Chat inside a vault
Send vault_id on POST /api/v1/chat to say which vault the chat is
happening inside. It changes two things for the turn:
- Memory. Which stored memories recall may draw on. With no vault, that is
your personal memory, your organization's, and every vault you can read
whose
memory_scopeisdefault. Inside avault_onlyvault, recall draws on that vault's memory alone, and its memory is withheld everywhere outside it. See Memory. - Rules. Which standing rules apply: the vault's own ruleset, merged with the organization's when the vault inherits them. See Standing rules.
A user message can also attach a file the vault holds, by naming its id in
file_ids like any other file. The gateway reads a vault file only while you
are a member who reads that vault and is not held.
curl https://api.cruxy.ai/api/v1/chat \
-H "Authorization: Bearer $CRUXY_API_KEY" \
-H "Content-Type: application/json" \
-H "Cruxy-Version: 2026-10-05" \
-d "{
\"model\": \"saga\",
\"stream\": false,
\"vault_id\": \"$VAULT_ID\",
\"messages\": [
{
\"role\": \"user\",
\"content\": \"What does the handbook say about on-call handover?\",
\"file_ids\": [\"$FILE_ID\"]
}
]
}"const vaultId = process.env.VAULT_ID
const vaultFileId = process.env.FILE_ID // a file the vault holds
const res = await fetch('https://api.cruxy.ai/api/v1/chat', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CRUXY_API_KEY}`,
'Content-Type': 'application/json',
'Cruxy-Version': '2026-10-05', // file_ids needs this pin or later
},
body: JSON.stringify({
model: 'saga',
stream: false,
vault_id: vaultId,
messages: [
{
role: 'user',
content: 'What does the handbook say about on-call handover?',
file_ids: [vaultFileId],
},
],
}),
})
if (!res.ok) throw new Error(`chat failed: ${res.status} ${await res.text()}`)
const completion = await res.json()
console.log(completion.message.content)
console.log(completion.cruxy.rules_applied) // the rules the vault added, or undefinedA vault_id you cannot read is not an error and is never reported: the turn
runs exactly as if you had sent none, so a chat request cannot be used to
discover whether a vault id is real. Sending a vault id grants no access you
do not already have.
mentioned_vault_ids is different from vault_id. It names up to three
vaults the turn references without being inside them, and adds their memory
to the turn's recall. It changes nothing about isolation and never makes a
vault writable.
Next steps
- Memory: what recall and capture do inside a vault.
- Standing rules: give a vault its own rules.
- Files: upload files and attach them to a chat turn.
- Conversations: hold a conversation inside a vault.