Vaults

Delete

Delete a vault.

DELETE /api/public/v1/vaults/{vault_id}

Example

curl -X DELETE https://api.nairi.ai/api/public/v1/vaults/VAULT_ID \
  -H "Authorization: Bearer $NAIRI_API_KEY"
await fetch(`https://api.nairi.ai/api/public/v1/vaults/${vaultId}`, {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.NAIRI_API_KEY}`,
  },
});
require "net/http"
require "uri"

uri = URI("https://api.nairi.ai/api/public/v1/vaults/#{vault_id}")
req = Net::HTTP::Delete.new(uri)
req["Authorization"] = "Bearer #{ENV['NAIRI_API_KEY']}"

Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
import os
import requests

requests.delete(
    f"https://api.nairi.ai/api/public/v1/vaults/{vault_id}",
    headers={"Authorization": f"Bearer {os.environ['NAIRI_API_KEY']}"},
)
package main

import (
	"net/http"
	"os"
)

func main() {
	vaultID := os.Getenv("VAULT_ID")
	req, _ := http.NewRequest("DELETE", "https://api.nairi.ai/api/public/v1/vaults/"+vaultID, nil)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("NAIRI_API_KEY"))
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
}

Deletion fails with 400 Bad Request if the vault is assigned to any agent, or if it still contains secrets. Unassign and empty the vault first.

Response: 204 No Content

Error responses

HTTPBodyWhen
400{"error":"cannot delete vault: still assigned to N agent(s)"}The vault is still attached to one or more agents.
400{"error":"cannot delete vault: vault still contains N secret(s)"}The vault still has secrets — delete them first.
404{"error":"vault not found"}No vault with that ID exists in the calling organization.

On this page