---
title: "Search tasks"
method: POST
path: "/api/tasks/search"
tags: ["tasks"]
---

# Search tasks

`POST /api/tasks/search`

## Request

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

Read the human work queue: the manual tasks (ub_tk_) that threads spawn and that users write for themselves. state.eq open plus assignee_user_sid.eq is one person's plate, in the default due_at asc order; conversation_sid.eq is one thread's cards; due_at.lte now over open rows is the overdue set. page_size 0 returns counts only (total_count, overdue_count and the state axis). NOT the machine lane: automated step attempts are playtables workflow tasks (search_workflow_tasks).

Contract:
- MCP tool `search_tasks`, registry package `mcp.unibox/tasks`, mount `unibox.inbox`.
- Operation `search`, response envelope `search`.
- Flags: read only.

## Request body

- SearchTasksRequest: Request body of `search_tasks`.
  - `filter` object: Field filters, ANDed: {field: {eq | ne | in | nin | gte | lte | gt | lt | is_null}}; q inside it is free text. Omit for every row.
    - `sid` object: Task sid(s), ub_tk_ prefix - also the point lookup (there is no get tool).
      - `eq` string: Task sid (ub_tk_…).
      - `in` string[]
    - `conversation_sid` object: Owning thread(s); is_null true = standalone tasks.
      - `eq` string: Conversation sid (ub_cv_…) - the thread the task hangs on.
      - `in` string[]
      - `is_null` boolean
    - `person_sid` object: Tasks about one playtables person, off the creation-time denorm.
      - `eq` string: Person sid (cr_pp_…, external - playtables).
      - `in` string[]
      - `is_null` boolean
    - `state` object: open | done | canceled. The Tasks view scope is open.
      - `eq` 'open' | 'done' | 'canceled'
      - `in` string[]
    - `assignee_user_sid` object: Owner of the work ("my tasks"); is_null true = unassigned.
      - `eq` string: User sid (us_mb_…, external - gs.service.id).
      - `in` string[]
      - `is_null` boolean
    - `due_at` object: ISO 8601 bounds; lte now over open rows = the overdue set, is_null true = undated.
      - `gte` string
      - `lte` string
      - `is_null` boolean
    - `created_at` object: ISO 8601 range; combine bounds in one object.
      - `gte` string
      - `lte` string
      - `gt` string
      - `lt` string
    - `deleted_at` object: Default scope is { is_null: true } (live rows); stating it at all lifts the soft-delete scope.
      - `is_null` boolean
  - `include` string[]: Relations to attach to every item; omit for the bare rows.
  - `sort` object: One column and its direction; omit for the default order.
    - `field` 'due_at' | 'created_at', required: The column to order by.
    - `direction` 'asc' | 'desc': asc or desc; default desc.
  - `page_size` integer: 0..500, default 50; 0 = counts only, 1 = the first row.
  - `cursor` string, nullable: pagination.next_cursor of the previous page.

## Response `200`

`search` success envelope.

- SearchTasksResponse
  - `success` true, required
  - `operation` 'search', required
  - `items` object[], 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.
    - `included` object, required
      - `conversation` object: Owning thread row (ConversationDomain - entities/conversations.md); null when the task has no thread.
  - `pagination` object, required
    - `next_cursor` string, nullable, required
    - `has_more` boolean, required
    - `total_count` integer, nullable, required
  - `applied_filters` object, required
  - `includes` string[], 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.
  - `counts` object
    - `total_count` integer, required: Tasks matching the filter (full filter scope, not the page).
    - `overdue_count` integer, required: Of those, the open rows whose due_at is already past.
    - `groups` object, required
      - `state` union, required: Task distribution across the three states; an absent key = zero.
        - object
          - `open` integer
          - `done` integer
          - `canceled` integer
        - unknown[]
          - unknown

## 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)
