# Vault API Integration Guide

**Date:** July 16, 2026
**Status:** Generic wrapper complete, tested with Grist and NocoDB

---

## Generic API Wrapper (`vault_api.py`)

**Location:** `/home/jcbeasley/.openclaw/workspace/scripts/vault_api.py`

**Usage:**
```bash
python3 vault_api.py <METHOD> <BASE_URL> <API_PATH> <VAULT_PATH> <TOKEN_KEY> [header_type] [payload_file]
```

**Vault Path Structure:**
- Vault stores tokens under `kv/data/api/<category>/`
- Each category has multiple keys (e.g., `nocodb-token`, `qdrant-api-key`)
- You specify both the category path AND the token key

---

## ✅ Working Examples

### Grist
```bash
python3 vault_api.py GET "https://grist.beawit.net" \
  "/api/docs/wmBGUbgBveCdeY8fZ6T6eL/tables/Intune/records" \
  "api/integration" "grist" "Bearer"
```
**Status:** ✅ Works (63 records retrieved)

### NocoDB
```bash
python3 vault_api.py GET "http://192.168.25.5:8080" \
  "/api/v1/db/meta/projects" \
  "api/infrastructure" "nocodb-token" "xc-token"
```
**Status:** ✅ Works (7 projects retrieved)

---

## ⚠️ Needs Debugging

### Qdrant
```bash
python3 vault_api.py GET "http://192.168.19.17:6333" \
  "/collections" \
  "api/infrastructure" "qdrant-api-key" "api-key"
```
**Status:** ❌ 401 Unauthorized
**Issue:** Header format may need adjustment for Qdrant's specific auth

---

## Vault Structure Discovered

### `api/infrastructure` (IT Systems)
| Token Key | Service | Status |
|-----------|---------|--------|
| `gitea-token` | Gitea | Not tested |
| `metabase-api-key` | Metabase | Not tested |
| `metabase-password` | Metabase | Not tested |
| `metabase-url` | Metabase | Not tested |
| `metabase-username` | Metabase | Not tested |
| `nocodb-table-id` | NocoDB | Not tested |
| `nocodb-token` | NocoDB | ✅ Working |
| `nocodb-url` | NocoDB | Not tested |
| `odoo-api-key` | Odoo | Not tested |
| `odoo-url` | Odoo | Not tested |
| `qdrant-api-key` | Qdrant | ❌ Auth issue |
| `qdrant-url` | Qdrant | Not tested |
| `rustfs-access-key` | RustFS | Not tested |
| `rustfs-bucket` | RustFS | Not tested |
| `rustfs-endpoint` | RustFS | Not tested |
| `rustfs-secret-key` | RustFS | Not tested |

### `api/integration` (Integration Services)
| Token Key | Service | Status |
|-----------|---------|--------|
| `grist` | Grist | ✅ Working |
| `homeassistant-api-key` | Home Assistant | Not tested |
| `n8n-api-key` | n8n | Not tested |
| `tavily-api-key` | Tavily | Not tested |

### Other Categories
- `api/ai-ml` — DeepSeek, Groq, Ollama, OpenAI, SerpAPI
- `api/business` — Hunter, InvoiceNinja, Kimai
- `api/communication` — Telegram
- `api/media` — Freepik, JSON2Video, Pexels, YouTube
- `api/monitoring` — Uptime Kuma
- `api/search` — Firecrawl, SerpAPI

---

## Next Steps

1. **Fix Qdrant auth** — Debug header format (likely needs custom header)
2. **Test remaining services** — Metabase, Odoo, n8n, etc.
3. **Add service-specific wrappers** — Some services may need custom headers

Want me to fix Qdrant auth now, or test other services?
