Skip to main content

Guide: create a task

Real flow to create a task in a profile and load its document.
1 min read

Use case: capture work in the profile inbox. This is the “hello world” of the work domain.

What you will build#

  1. Create a task with a title.
  2. (Optional) read the detail.
  3. Load / save the rich-text body through the document endpoint (uncached).

Prerequisites#

  • Better Auth session Bearer (Authentication)
  • A studioId where 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#

EndpointIncludes document body?
Task detailNo (empty shell / omitted on purpose)
GET …/tasks/.../:taskId/documentYes, always fresh

3. Save document (optimistic version)#

In the app, this goes through updateTaskDocumentAction without contaminating the detail cache.

From Next.js#

Common errors#

SymptomCauseFix
401Secret or sessionCheck headers
PLAN_LIMITMember or AI capUpgrade / contact the owner
Empty document when opening cached detailExpectedUse GET document
Version conflictConcurrent editRe-fetch document