@@ -306,6 +306,53 @@ file editor uses. Allowlisted filenames: `SOUL.md`, `IDENTITY.md`,
306306| ` agents files ls\|put\|get <name> ` | Read / write the agent's system files |
307307| ` agents rm <name> ` | Delete the agent record and its system files |
308308
309+ ### Manage API keys from the CLI (` fastclaw apikey … ` )
310+
311+ Issue and manage programmatic credentials for external integrations.
312+
313+ #### Key types
314+
315+ | type | Scope | Use case |
316+ | ------| -------| ----------|
317+ | ` admin ` | Full platform access, all agents | Admin automation, CI/CD |
318+ | ` user ` | Owner's agents; supports ` X-Fastclaw-End-User ` for app_user provisioning | SaaS proxy layer, multi-tenant apps |
319+ | ` agent ` | Explicit agent list only; cannot create agents | Bots, single-purpose integrations |
320+
321+ #### Commands
322+
323+ ``` bash
324+ # Create a key (token shown once — save immediately)
325+ fastclaw apikey create --name " my-key" --type user [--owner < user-id> ]
326+
327+ # List keys for a user (defaults to first super_admin)
328+ fastclaw apikey list [--owner < user-id> ]
329+
330+ # Delete a key
331+ fastclaw apikey delete --id < apikey-id>
332+
333+ # Rotate a key (old token invalidated, new token shown once)
334+ fastclaw apikey rotate --id < apikey-id>
335+ ```
336+
337+ ** Flags:**
338+ - ` --name ` (required): human-readable key name
339+ - ` --type ` (default ` user ` ): ` admin ` , ` user ` , or ` agent `
340+ - ` --owner ` (optional): owner user ID; defaults to first super_admin
341+
342+ #### Multi-tenant app_user flow
343+
344+ A ` type=user ` key combined with the ` X-Fastclaw-End-User ` header enables
345+ per-end-user data isolation without pre-registering users in FastClaw:
346+
347+ ```
348+ Authorization: Bearer <user-key-token>
349+ X-Fastclaw-End-User: <your-app-user-id>
350+ ```
351+
352+ FastClaw lazily mints a stable internal user for each unique
353+ ` (api_key_id, external_id) ` pair. Sessions, memory, and files are fully
354+ isolated per end-user.
355+
309356### Docker
310357``` bash
311358cd deploy/docker && ./start.sh
0 commit comments