v0.3.0 Latest

REST API and webhooks

/api/v1 with API keys in X-Auth-Token and an OpenAPI spec, company scoping, PSA lookups, deep links, signed webhooks.

Base: /api/v1. JSON. Auth: X-Auth-Token: <api_key>, the same header for the REST API and MCP (/api/mcp). Authorization: Bearer <api_key>, a bare Authorization: <api_key>, and X-API-Key: <api_key> are accepted too, so integrations set up on v0.1.0 keep working. The spec is generated from the same Zod schemas the endpoints validate with and served at /api/v1/openapi.json. Cursor pagination: ?limit=50&cursor=..., response carries next_cursor.

Keys are created under Admin → API keys with scopes read, write, admin, reactions, and with either every company or a named set. The value is shown once.

curl -H "X-Auth-Token: $TROVE_KEY" https://trove-kb.example.com/api/v1/companies

X-Auth-Token is the header the docs lead with because an organization’s custom MCP connector can only send headers from a fixed list, and Authorization is not on it. When a request carries several, X-Auth-Token wins, then Authorization, then X-API-Key: a proxy or host may add an Authorization header of its own, and that should not shadow the key.

Resources

GET    /companies                  ?q=&external_system=&external_id=
POST   /companies
GET    /companies/:id
PATCH  /companies/:id
GET    /companies/:id/locations
GET    /companies/:id/documents    ?doc_type=&location_id=
GET    /companies/:id/export       JSON or Markdown

POST   /locations
GET    /locations/:id
PATCH  /locations/:id

GET    /doc-types                  (includes template fields)
GET    /doc-types/:id

GET    /documents/:id              (resolved values + raw IDs)
POST   /documents                  { company_id, doc_type_id, location_id?, title, field_values }
PATCH  /documents/:id              (partial field_values merge)
GET    /documents/:id/revisions

GET    /option-lists/:id/items
POST   /option-lists/:id/items

GET    /search                     ?q=&company_id=&doc_type=
GET    /users
POST   /users                      { email, name, role?, all_companies? }

field_values is keyed by field UUID, exactly as stored. Responses return resolved values (option labels, linked document titles, rendered markdown) alongside the raw ids.

Network field values

The network field types are normalized when they are written, and come back in that form in value. See Field types for what each one holds.

TypeStored asAlso accepted on write
ip"10.0.0.5/24""10.0.0.5" (saved as /32, or /128 for IPv6); a dotted mask, "10.0.0.5 255.255.255.0"
ip_list["8.8.8.8/32", "1.1.1.1/32"], in orderOne string, split on commas, spaces, and new lines; each entry as ip takes it
network"10.0.0.0/24"A prefix is required; host bits are cleared
ip_range"192.168.1.100-192.168.1.199"
macIn the field’s format (mac_format on the field, else the instance’s)Any common spelling. resolved shows it in the format in force now
vlanA number from 1 to 4094
hostnameLowercase
port"443/tcp", "53/tcp+udp", or "8443" with no protocolA number, "tcp 443", or a service name such as "https"
port_range"5060-5080/udp"A range of one port is stored as that port
port_list["80/tcp", "443/tcp", "5060-5080/udp"], in orderOne string, split on commas, semicolons, new lines, and spaces, keeping a protocol with its number
asnA number from 1 to 4294967294"AS13335" and asdot "1.10". resolved is "AS13335"

Company scope

A key is created with either every company or a named set. Everything is filtered by it: lists omit what the key may not see, and a single record it may not see answers 404 not_found, the same answer a missing id gets, so a key cannot be used to find out which companies exist. POST /companies with a restricted key answers 403 forbidden, since the key could not see what it created.

PSA integration

A ticket in any PSA needs to show that client’s docs:

PUT    /external-refs              { entity, entity_id, system, external_id }  (upsert)
GET    /lookup                     ?system=halopsa&entity=company&external_id=123
                                   -> the company plus its locations and documents summary

Deep links a PSA can embed without the API: /go/{system}/company/{external_id} redirects to the matching company page.

Vault

Requires the secrets:reveal scope, off by default.

GET    /vault/items                ?company_id=&q=      (metadata only, scoped to the mapped collection)
POST   /vault/items/:item_id/reveal   { document_id, field_id }  -> { password }  (audited, no-store)
POST   /vault/items/:item_id/totp     { document_id, field_id }  -> { code, period_remaining }

Secrets never appear in document, revision, search, export, or webhook payloads.

Knowledge base

See Knowledge base for the /kb/* routes: collections, search, articles with runbook steps, upsert and archive under an external id, grants, and favorites and votes for a named reader.

GET    /kb/articles/:id/original   the document an imported article was made from (PDF inline, others as a file); 404 if none

/original serves the file with its own content type, ETag and If-None-Match, under the same read rules as the article. It is there for an integration that needs the PDF itself, server-side, when the public site’s copy sits behind a sign-in such as Cloudflare Access that an API client cannot pass.

Webhooks

Created under Admin → Notifications. Events:

  • company.created, company.updated
  • location.created, location.updated
  • document.created, document.updated, document.archived
  • field.promoted
  • document.due
  • domain.changed, domain.expiring (see Domain checks)
  • kb.article.upserted, kb.article.archived ({ collection_id, article_id, external_id, kind })

Payload:

{ "event": "document.updated", "occurred_at": "...", "data": { "...": "resolved document" } }

Headers: X-Trove-Event, X-Trove-Delivery, X-Trove-Signature: sha256=<hmac> over the raw body with the signing secret shown once when the webhook was made. Retries with exponential backoff, up to 8 attempts, from a worker in the app container. On a Workers deployment a Cron Trigger calls /api/internal/webhooks with CRON_SECRET for the same pass.

Security baseline

  • Argon2id for local passwords
  • API keys: random 32 bytes, shown once, stored as SHA-256, looked up by prefix
  • Server-side HTML sanitization for rich text
  • CSRF protection on session routes, rate limiting on auth and the API