---
title: "Create task"
method: POST
path: "/api/tasks"
tags: ["tasks"]
---

# Create task

`POST /api/tasks`

## Request

- Base URL: `https://beta.getsales.io/unibox/v1`
- URL: `https://beta.getsales.io/unibox/v1/api/tasks`
- Auth: HTTP bearer and API key in header `Team-SID`

Open one manual work item for a human. With conversation_sid the thread records a task_created pill, person_sid is denormed from its primary link, and the thread turns to needs_you when the task is due today, earlier, or undated; without it the task is standalone and shows on no inbox surface yet. An agent caller puts the context bundle in body. No dedup: every call inserts a row. NOT for the agent's own next move, which is a plan step, and not for automated sequence steps.

Contract:
- MCP tool `create_task`, registry package `mcp.unibox/tasks`, mount `unibox.inbox`.
- Operation `create`, response envelope `create`.
- Flags: none.

## Request body

- CreateTaskRequest: Request body of `create_task`.
  - `title` string, required: One line stating the work, 1..255 chars. This is what the human reads in the Tasks view.
  - `body` string, nullable: Free text detail. An agent caller puts the context bundle here: reason, the qualification facts, the trigger - enough to act without re-reading the thread.
  - `conversation_sid` string, nullable: Thread to anchor the task to (ub_cv_…). Omit for a standalone task, which renders on no inbox surface yet.
  - `due_at` string, nullable: ISO 8601 UTC deadline; omit for undated. Due today or earlier (and undated too) surfaces the thread as needs_you right away.
  - `expires_at` string, nullable: ISO 8601 UTC, after now (422 otherwise): still open then, the sweep cancels the task and it reads as expired. Omit for a month ahead (the default, as for every task the product opens); null for a task that never expires.
  - `assignee_user_sid` string, nullable: User to own the work (us_mb_…, 18 chars). No server-side default: omit it and the task is unassigned.

## Response `200`

`create` success envelope.

- CreateTaskResponse
  - `success` true, required
  - `operation` 'create', required
  - `item` object, required
    - `sid` string, required: Task sid (ub_tk_…).
    - `team_sid` string, required: Owning team (ts_tm_…, external - gs.service.id).
    - `title` string, required: One line stating the work, 1..255 chars.
    - `state` 'open' | 'done' | 'canceled', required: open = on the queue; done = completed (completed_at stamped); canceled = discarded. There is no delete.
    - `created_by` object, required: Actor that opened the task. actor_type user = a person, agent = the AI SDR (escalation or a plan step), system = the workflow bridge.
      - `actor_type` 'user' | 'support' | 'api_key' | 'system' | 'agent', required
      - `actor_sid` string, nullable, required
      - `team_sid` string, required
      - `actor_name` string, nullable: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
      - `oauth_client_sid` string, nullable: The acting OAuth client (id_oc_*); null off the OAuth path.
      - `reason` string, nullable: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
      - `permissions` object, required: Internal audit context: the grant set the actor held at write time. Not a contract.
      - `cluster_id` integer, nullable: Internal audit context: the cluster that served the write.
      - `trace_id` string, nullable: Internal audit context: the trace id of the request that wrote the row.
    - `conversation_sid` string, nullable, required: The thread this task hangs on (ub_cv_…); null = standalone, which no inbox surface lists yet.
    - `person_sid` string, nullable, required: The playtables person the thread was linked to AT CREATION (cr_pp_…) - a denorm, never backfilled by later linking; null when the thread had no primary link.
    - `body` string, nullable, required: Free text. On agent-created rows this is the context bundle: why a human is needed, plus the facts to act without re-reading the thread.
    - `due_at` string, nullable, required: ISO 8601 UTC deadline; null = undated. Once it passes, the due sweep (every 5 minutes) flips the owning thread to needs_you: the "Task due" cue.
    - `assignee_user_sid` string, nullable, required: User expected to do the work (us_mb_…, external - gs.service.id); null = unassigned. A label, not a lock.
    - `completed_at` string, nullable, required: ISO 8601 UTC; stamped on open -> done and cleared on reopen. Null while open, and on a canceled task.
    - `workflow_task_sid` string, nullable, required: The playtables manual_task / manual_router node this co-pilot task stands for (wf_tk_…), set only by the internal bridge; null on tasks people and the agent open. Closing such a task reports the outcome back to playtables.
    - `options` object[], nullable, required: The arms a manual_router node offers (1..9, authored order); null on every other task. Non-null means this task completes WITH a pick.
      - `id` integer, required: Arm id, unique inside this task; echoed back as chosen_option_id on completion.
      - `label` string, required: What the arm says to the human (1..255 chars) - the router branch, in authored order; on a play's question the plain English fallback of the choice.
      - `key` string, nullable: A play's question only: the choice the option stands for (remove | keep | move about a journey the play paused, add for a person in none). Absent on a router's arm.
    - `chosen_option_id` integer, nullable, required: The picked arm, set with the open -> done transition of a task that carries options; null otherwise, and cleared on reopen.
    - `expires_at` string, nullable, required: ISO 8601 UTC; a task still open at this instant is canceled by the sweep (every 5 minutes) and keeps the instant, which is how an expired task reads (canceled WITH expires_at). A close by a person clears it; null = it never expires. A task the product opens itself (the AI SDR's, a hand-over's, a workflow node's) takes a month by default; a live visit alert takes its site's live_alert_task_minutes.
    - `source_ref` string, nullable, required: What produced a system task, <source>:<its sid>: escalation:ub_cv_... the AI SDR's hand-off, website_live:sg_ws_... a live visit alert. null on a person's task. Read-only.
    - `kind` 'manual' | 'play_draft' | 'play_question', required: manual = a person's, the agent's or a workflow node's work item (every task until 2026-10-14); play_draft = a play's draft (a congratulation, a comment, a person entering a workflow) whose words wait in draft, Send approves them as edited and Skip (canceled) drops them; play_question = a play's question about a journey (remove | keep | move) or a person in none (add), answered with a chosen option. Set by the bridge; read-only.
    - `draft` string, nullable, required: A play's draft: the words the person sends, as edited before Send (update draft, then state=done, or both at once); null on every other task.
    - `play_ref` object, nullable, required: A play's task: the play, its table and the workflow the act names or the person picked; null on every other task.
      - `play_sid` string, required: The play (pt_pl_..., external - playtables).
      - `play_name` string, required: Display denorm, frozen when the task opened.
      - `playtable_sid` string, nullable, required: The table the play lives in (pt_tb_...), the way into its playbook; null when unknown.
      - `workflow_sid` string, nullable, required: The workflow the act names (a person entering it, a move's destination) when the play named one, or the one the person picked on a question whose choice needs one (move, add); null until then.
    - `created_at` string, required: ISO 8601 UTC.
    - `updated_at` string, required: ISO 8601 UTC; bumped by every edit and state move.
    - `deleted_at` string, nullable, required: ISO 8601 UTC; null = live. No writer in v1 (canceled is the discard), so this stays null.
  - `already_exists` boolean, required
  - `meta` object, required
    - `trace_id` string, required: UUID v7; same 128-bit value as the X-Trace-Id header.
    - `span_id` string, required: 16 hex chars, root span of this request.
    - `timestamp` string, required: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
    - `duration_ms` integer, required: Server-side wall clock.
    - `team_sid` string, nullable: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
    - `actor_type` string, nullable: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.

## Other responses

- `4XX`: MCP error envelope. `error.code` is one of validation_failed, nothing_to_update, not_found, relation_not_found, invalid_transition, limit_exceeded, payment_required, duplicate_rejected, conflict, delete_blocked, unauthorized, forbidden, rate_limited, not_implemented.
- `5XX`: MCP error envelope with `error.code` internal_error or service_unavailable.

---

[API](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox.md) - [All operations](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox/llms.txt) - [OpenAPI document](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox/revisions/8f1bc317897f?raw)
