Use case: capture work in the profile inbox. This is the “hello world” of the work domain.
What you will build#
- Create a task with a title.
- (Optional) read the detail.
- Load / save the rich-text body through the document endpoint (uncached).
Prerequisites#
- Better Auth session Bearer (Authentication)
- A
studioIdwhere the user is a member - Base:
http://localhost:8080/api
1. Create the task#
Conceptual response:
Task creates are not a customer-facing plan cap. Member and AI credits still return PLAN_LIMIT (members_per_profile, agent_credits_per_month). Abuse safeguards on content return CAPACITY_GUARD_REACHED with no limit metadata.
2. Detail vs document#
| Endpoint | Includes document body? |
|---|---|
| Task detail | No (empty shell / omitted on purpose) |
GET …/tasks/.../:taskId/document | Yes, always fresh |
3. Save document (optimistic version)#
In the app, this goes through updateTaskDocumentAction without contaminating the detail cache.
From Next.js#
Common errors#
| Symptom | Cause | Fix |
|---|---|---|
| 401 | Secret or session | Check headers |
| PLAN_LIMIT | Member or AI cap | Upgrade / contact the owner |
| Empty document when opening cached detail | Expected | Use GET document |
| Version conflict | Concurrent edit | Re-fetch document |
Related#
- Product: Tasks
- DB: Tasks tables
- OpenAPI: tag Tasks