You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: public/.well-known/ai.txt
+28-10Lines changed: 28 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -15,12 +15,14 @@ There are two auth methods:
15
15
1. API Key (for programmatic access):
16
16
Header: Authorization: Bearer ul_<key>
17
17
Keys have scopes: read, write, admin.
18
-
Create keys at https://underlay.org/settings/keys.
18
+
Keys can optionally be scoped to specific collections via metadata.
19
+
Create keys at https://underlay.org/settings/keys (personal) or /:owner/settings/keys (organization).
20
+
Keys are managed via better-auth's apiKey plugin at /api/auth/api-key/*.
19
21
20
22
2. Session cookie (for browser use):
21
-
Users sign in via KF Auth SSO (OIDC) at https://underlay.org/login.
22
-
Accounts are created automatically on first sign-in.
23
-
GET /api/accounts/me returns the current user (works with either auth method).
23
+
Users sign in via KF Auth SSO (OAuth2/PKCE) at https://underlay.org/login.
24
+
Accounts are created automatically on first sign-in, along with a default organization.
25
+
GET /api/accounts/me returns the current user and their organization memberships.
24
26
25
27
All GET requests are public — no auth required to read public data.
26
28
All write requests (POST, PATCH, PUT, DELETE) require authentication.
@@ -47,7 +49,8 @@ To get the higher limit, authenticate with an API key (recommended for any autom
47
49
48
50
## Core Concepts
49
51
50
-
- Collection: a named, versioned body of data owned by an account. Identified by :owner/:slug.
52
+
- Organization: an entity that owns collections. Every user gets a default organization on signup. Identified by :slug. Managed via better-auth's organization plugin at /api/auth/organization/*.
53
+
- Collection: a named, versioned body of data owned by an organization. Identified by :owner/:slug.
51
54
- Version: an immutable snapshot containing a JSON Schema, records, and file references. Sequential integer numbers, auto-derived semver.
52
55
- Record: a flat JSON object with { id, type, data }. Records reference other records by id and files by hash.
53
56
- File: a binary blob stored by SHA-256 hash, referenced in record data as {"$file": "sha256:<hex>"}.
@@ -342,12 +345,24 @@ When schemas are returned via the collection schemas endpoint, known labels are
342
345
343
346
---
344
347
348
+
## Organization Management
349
+
350
+
Organizations are managed via better-auth's organization plugin at /api/auth/organization/*.
351
+
Every user gets a default organization on signup. Users can create additional organizations.
352
+
353
+
POST /api/auth/organization/create → create org {"name", "slug"}
354
+
GET /api/auth/organization/list → list user's organizations
355
+
PATCH /api/auth/organization/update → update org
356
+
DELETE /api/auth/organization/delete → delete org
357
+
358
+
Member management (invite, remove, update roles) is also under /api/auth/organization/*.
359
+
345
360
## Collection Management
346
361
347
362
POST /api/accounts/:owner/collections → create collection {"slug", "name", "description", "public"}
0 commit comments