Admin API

Permissions

const TOKEN = "hv_..."; // your API key
const headers = { Authorization: `Bearer ${TOKEN}` };

List permissions

GET /admin/permissions

Returns all available permission definitions and permission templates. When the Spaces feature flag is disabled, spaces-related permissions and template entries are excluded.

interface PermissionDef {
  key: string;
  name: string;
  description: string;
  category: string;
}

interface PermissionTemplate {
  key: string;
  label: string;
  permissions: string[];
}

interface PermissionsResponse {
  permissions: PermissionDef[];
  templates: PermissionTemplate[];
}

const response = await fetch("http://127.0.0.1:3000/admin/permissions", {
  headers,
});
const data: PermissionsResponse = await response.json();

Response: 200 OK

{
  "permissions": [
    {
      "key": "lexicons:create",
      "name": "Create Lexicons",
      "description": "Upload lexicon schemas",
      "category": "Lexicons"
    }
  ],
  "templates": [
    {
      "key": "viewer",
      "label": "Viewer",
      "permissions": ["lexicons:read", "records:read", "stats:read", "events:read"]
    }
  ]
}

Templates are predefined permission bundles used when creating or updating users. See the Permissions guide for the full list.

On this page