# Tasks API

> Durable units of work. A task can run for days, wait on other people and resume when they reply.

Part of the AGNT API reference. AGNT (https://agnt.ai) is the developer platform behind OpenAssistant (https://openassistant.us). Docs index: https://agnt.ai/llms.txt. Web page: https://agnt.ai/reference/api/tasks

Base URL: `https://api.agnt.ai`. Auth: `Authorization: Bearer ak_live_...`.

## GET /tasks

List tasks

Returns the user's tasks, newest first.

Acts as one user: send `X-User-Email`.

**Query parameters**

- `page` (integer)
- `perPage` (integer)
- `status` (string): Comma-separated statuses
- `q` (string): Search titles, descriptions and recent messages.
- `type` (enum): task (the default for created tasks) or reminder One of: `task`, `reminder`.
- `assistant` (string): Only tasks for this assistant id
- `approvalGate` (string): For example pending_user_approval for tasks the assistant proposed
- `ownerEmail` (string): With an account key and no X-User-Email: only tasks whose owner email contains this text. Acting as a user: tasks of someone who has delegated to that user (403 without an active delegation).

**Responses**

- `200`: Tasks
  - `ok` (boolean)
  - `tasks` (object[])
    - `id` (string): Task id
    - `type` (string): task for work, reminder for a reminder
    - `title` (string)
    - `description` (string | null)
    - `status` (enum): pending: waiting for a run; POST /tasks/{taskId}/process starts one. scheduled: waits for scheduledFor. executing: a run is in progress. awaiting_user_input / awaiting_non_user_response: waiting on the user or on someone else, with a follow-up time set. alarm_set: will wake itself at a set time. subtasks_running: waiting on its own background work. message_received / conversation: a message thread with no open work. on_hold / paused: stopped until resumed. completed: finished by the assistant. done_user_marked: marked done by the user. error, abandoned, failed_access (could not get access it needed), deferred_access (waiting for access), credits_blocked (out of credits), handled_by_other (another assistant took the thread), archived. One of: `pending`, `scheduled`, `executing`, `awaiting_user_input`, `awaiting_non_user_response`, `alarm_set`, `subtasks_running`, `message_received`, `conversation`, `on_hold`, `paused`, `completed`, `done_user_marked`, `error`, `abandoned`, `failed_access`, `deferred_access`, `credits_blocked`, `handled_by_other`, `archived`.
    - `summary` (string | null): What the assistant has done, written by the assistant once there is something to report
    - `error` (string | null): Details of the failure when status is error
    - `owner` (string | null): Owner's email
    - `assistant` (object): The assistant working the task
      - `id` (string)
      - `type` (enum) One of: `user`, `assistant`, `contact`.
      - `email` (string)
      - `firstName` (string | null)
      - `lastName` (string | null)
      - `avatar` (string | null)
    - `onBehalfOf` (string | null): Whose data and calendar the task acts on (an email)
    - `followers` (object[]): People following the task
      - `id` (string)
      - `type` (enum) One of: `user`, `assistant`, `contact`.
      - `email` (string)
      - `firstName` (string | null)
      - `lastName` (string | null)
      - `avatar` (string | null)
    - `waitingOnContacts` (object[]): The contacts the task is waiting to hear from, while status is awaiting_non_user_response
      - `id` (string)
      - `type` (enum) One of: `user`, `assistant`, `contact`.
      - `email` (string)
      - `firstName` (string | null)
      - `lastName` (string | null)
      - `avatar` (string | null)
    - `skills` (string[])
    - `plan` (object[]): Checklist the assistant keeps for the task
      - `text` (string)
      - `status` (enum) One of: `pending`, `done`, `skipped`, `blocked`.
      - `note` (string)
    - `readyForReview` (boolean): True when the work is finished and waiting for the user to look
    - `scheduledFor` (string | null): When a scheduled task starts
    - `scheduledHeadline` (string | null): One line, for the user, on what the scheduled run will do
    - `deadline` (string | null): The user's due time for the outcome
    - `alarm` (object | null): The time the task wakes itself to follow up or report back. Set by the assistant; null when none is set.
      - `wakeAt` (string): When the task wakes
      - `headline` (string | null): One sentence, for the user, on why the alarm is set and what happens when it fires. Show this, not the alarm itself; null means show nothing.
      - `status` (enum): set until it fires; fired or cancelled after One of: `set`, `fired`, `cancelled`.
    - `pendingCart` (object | null): Outbound actions staged on this task and waiting on approval (a cart); null when nothing is staged. Read and approve it through the Approvals endpoints.
      - `status` (enum): pending_approval: waiting for a person. time_boxed: will go out at timeBoxedExpiresAt unless someone stops it. executing: going out now. One of: `open`, `submitted`, `pending_approval`, `time_boxed`, `approved`, `executing`, `executed`, `cancelled`, `rejected`, `failed`.
      - `label` (string): Short summary of what is staged
      - `timeBoxedExpiresAt` (string | null): For time_boxed: when the window closes
      - `timeBoxedExpiry` (enum): For time_boxed: what happens when the window closes One of: `execute`, `cancel`, `null`.
      - `dispatches` (object[]): Each staged action
        - `type` (string): The kind of action, such as send_message or send_email
        - `description` (string)
        - `platform` (string): Channel, such as email, sms or slack
        - `to` (string[])
        - `subject` (string)
        - `body` (string)
        - `status` (string)
        - `resolvedApprovalMode` (enum): The autonomy mode that applied to this action One of: `auto`, `time-boxed`, `manual`, `null`.
    - `handledBy` (object | null): When status is handled_by_other: which of the user's assistants took the thread instead
      - `assistantId` (string)
      - `assistantName` (string | null)
      - `decidingTaskId` (string | null): That assistant's task for the same thread, when it exists
      - `decidedAt` (string | null)
    - `executedAt` (string | null): First run
    - `completedAt` (string | null): When the task finished
    - `modelTier` (enum) One of: `low`, `medium`, `high`, `ultra`.
    - `effort` (enum): Reasoning effort: how much thinking the assistant applies on each run, independent of modelTier. low, medium, high, xhigh (extra high) or max. One of: `low`, `medium`, `high`, `xhigh`, `max`.
    - `createdBy` (enum): agent when the assistant proposed the task One of: `user`, `agent`.
    - `approvalGate` (enum): For tasks the assistant proposed: whether the user has approved it to run One of: `pending_user_approval`, `approved`, `declined`.
    - `approvalOverride` (object): Autonomy setting for this task only. mode null means the task follows the user's settings.
      - `mode` (enum) One of: `auto`, `time-boxed`, `manual`, `null`.
      - `timeBoxedWindowMin` (number | null): For time-boxed: minutes before a staged action proceeds
      - `undoDelaySec` (number | null): Seconds a sent action is held so it can still be undone
    - `chatId` (string | null): The chat the task came from, if any
    - `parentTaskId` (string | null): The task this one was split from, if any
    - `origin` (object | null)
      - `platform` (string | null): Channel the task came from, such as chat, email or sms
    - `createdAt` (string)
    - `updatedAt` (string)
  - `page` (integer)
  - `perPage` (integer)
  - `total` (integer)

```bash
curl 'https://api.agnt.ai/tasks' \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "ok": true,
  "tasks": [
    {
      "id": "6660c4a1f2e3b7d8a9c01234",
      "type": "type",
      "title": "Send Brightline the contract renewal",
      "description": "Draft it, get Maria to sign off, send it."
    }
  ],
  "page": 1,
  "perPage": 20
}
```

## POST /tasks

Create a task

Creates a task for the user. To start it, run the task. A task with `status: "scheduled"` and a future `scheduledFor` starts on its own at that time. The assistant must be one the user has.

Acts as one user: send `X-User-Email`.

**Request body** (JSON)

- `title` (string, required): Short name for the task
- `assistant` (string, required): Id of an assistant the user has
- `description` (string): What the user wants done, in their words
- `status` (enum): pending (the default) waits for POST /tasks/{taskId}/process; scheduled starts on its own at scheduledFor One of: `pending`, `scheduled`.
- `scheduledFor` (string): With status scheduled and a time in the future, the task runs at this time. A past time is stored but schedules no run.
- `modelTier` (enum): Defaults to the organization's task tier, then the account's, then medium. One of: `low`, `medium`, `high`, `ultra`.
- `effort` (enum): Reasoning effort: how much thinking the assistant applies on each run, independent of modelTier. low, medium, high, xhigh (extra high) or max. Defaults like modelTier. One of: `low`, `medium`, `high`, `xhigh`, `max`.
- `onBehalfOf` (string): Whose data and calendar the task acts on: the user's own email (the default) or the email of someone who has delegated to the user.
- `followers` (string[]): Email addresses of people following the task
- `skills` (string[]): Skill names the task should use
- `notificationScope` (enum): activity_only keeps the task's updates on its own timeline One of: `default`, `activity_only`.
- `generateTitle` (boolean): Treat title as a placeholder and generate a title from the description

**Responses**

- `201`: Created task
  - `ok` (enum, required) One of: `true`.
  - `task` (object, required)
    - `id` (string): Task id
    - `type` (string): task for work, reminder for a reminder
    - `title` (string)
    - `description` (string | null)
    - `status` (enum): pending: waiting for a run; POST /tasks/{taskId}/process starts one. scheduled: waits for scheduledFor. executing: a run is in progress. awaiting_user_input / awaiting_non_user_response: waiting on the user or on someone else, with a follow-up time set. alarm_set: will wake itself at a set time. subtasks_running: waiting on its own background work. message_received / conversation: a message thread with no open work. on_hold / paused: stopped until resumed. completed: finished by the assistant. done_user_marked: marked done by the user. error, abandoned, failed_access (could not get access it needed), deferred_access (waiting for access), credits_blocked (out of credits), handled_by_other (another assistant took the thread), archived. One of: `pending`, `scheduled`, `executing`, `awaiting_user_input`, `awaiting_non_user_response`, `alarm_set`, `subtasks_running`, `message_received`, `conversation`, `on_hold`, `paused`, `completed`, `done_user_marked`, `error`, `abandoned`, `failed_access`, `deferred_access`, `credits_blocked`, `handled_by_other`, `archived`.
    - `summary` (string | null): What the assistant has done, written by the assistant once there is something to report
    - `error` (string | null): Details of the failure when status is error
    - `owner` (string | null): Owner's email
    - `assistant` (object): The assistant working the task
      - `id` (string)
      - `type` (enum) One of: `user`, `assistant`, `contact`.
      - `email` (string)
      - `firstName` (string | null)
      - `lastName` (string | null)
      - `avatar` (string | null)
    - `onBehalfOf` (string | null): Whose data and calendar the task acts on (an email)
    - `followers` (object[]): People following the task
      - `id` (string)
      - `type` (enum) One of: `user`, `assistant`, `contact`.
      - `email` (string)
      - `firstName` (string | null)
      - `lastName` (string | null)
      - `avatar` (string | null)
    - `waitingOnContacts` (object[]): The contacts the task is waiting to hear from, while status is awaiting_non_user_response
      - `id` (string)
      - `type` (enum) One of: `user`, `assistant`, `contact`.
      - `email` (string)
      - `firstName` (string | null)
      - `lastName` (string | null)
      - `avatar` (string | null)
    - `skills` (string[])
    - `plan` (object[]): Checklist the assistant keeps for the task
      - `text` (string)
      - `status` (enum) One of: `pending`, `done`, `skipped`, `blocked`.
      - `note` (string)
    - `readyForReview` (boolean): True when the work is finished and waiting for the user to look
    - `scheduledFor` (string | null): When a scheduled task starts
    - `scheduledHeadline` (string | null): One line, for the user, on what the scheduled run will do
    - `deadline` (string | null): The user's due time for the outcome
    - `alarm` (object | null): The time the task wakes itself to follow up or report back. Set by the assistant; null when none is set.
      - `wakeAt` (string): When the task wakes
      - `headline` (string | null): One sentence, for the user, on why the alarm is set and what happens when it fires. Show this, not the alarm itself; null means show nothing.
      - `status` (enum): set until it fires; fired or cancelled after One of: `set`, `fired`, `cancelled`.
    - `pendingCart` (object | null): Outbound actions staged on this task and waiting on approval (a cart); null when nothing is staged. Read and approve it through the Approvals endpoints.
      - `status` (enum): pending_approval: waiting for a person. time_boxed: will go out at timeBoxedExpiresAt unless someone stops it. executing: going out now. One of: `open`, `submitted`, `pending_approval`, `time_boxed`, `approved`, `executing`, `executed`, `cancelled`, `rejected`, `failed`.
      - `label` (string): Short summary of what is staged
      - `timeBoxedExpiresAt` (string | null): For time_boxed: when the window closes
      - `timeBoxedExpiry` (enum): For time_boxed: what happens when the window closes One of: `execute`, `cancel`, `null`.
      - `dispatches` (object[]): Each staged action
        - `type` (string): The kind of action, such as send_message or send_email
        - `description` (string)
        - `platform` (string): Channel, such as email, sms or slack
        - `to` (string[])
        - `subject` (string)
        - `body` (string)
        - `status` (string)
        - `resolvedApprovalMode` (enum): The autonomy mode that applied to this action One of: `auto`, `time-boxed`, `manual`, `null`.
    - `handledBy` (object | null): When status is handled_by_other: which of the user's assistants took the thread instead
      - `assistantId` (string)
      - `assistantName` (string | null)
      - `decidingTaskId` (string | null): That assistant's task for the same thread, when it exists
      - `decidedAt` (string | null)
    - `executedAt` (string | null): First run
    - `completedAt` (string | null): When the task finished
    - `modelTier` (enum) One of: `low`, `medium`, `high`, `ultra`.
    - `effort` (enum): Reasoning effort: how much thinking the assistant applies on each run, independent of modelTier. low, medium, high, xhigh (extra high) or max. One of: `low`, `medium`, `high`, `xhigh`, `max`.
    - `createdBy` (enum): agent when the assistant proposed the task One of: `user`, `agent`.
    - `approvalGate` (enum): For tasks the assistant proposed: whether the user has approved it to run One of: `pending_user_approval`, `approved`, `declined`.
    - `approvalOverride` (object): Autonomy setting for this task only. mode null means the task follows the user's settings.
      - `mode` (enum) One of: `auto`, `time-boxed`, `manual`, `null`.
      - `timeBoxedWindowMin` (number | null): For time-boxed: minutes before a staged action proceeds
      - `undoDelaySec` (number | null): Seconds a sent action is held so it can still be undone
    - `chatId` (string | null): The chat the task came from, if any
    - `parentTaskId` (string | null): The task this one was split from, if any
    - `origin` (object | null)
      - `platform` (string | null): Channel the task came from, such as chat, email or sms
    - `createdAt` (string)
    - `updatedAt` (string)
- `400`: Missing title or assistant
- `401`: No user on the call: send X-User-Email with an account key, or use a user-scoped key
  - `status` (integer)
  - `error_code` (string)
  - `error` (string)
- `403`: Assistant not available to this user
- `423`: KILL_SWITCH_ENGAGED: the account is frozen
  - `status` (integer)
  - `error_code` (string)
  - `error` (string)

```bash
curl 'https://api.agnt.ai/tasks' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Renew the Brightline Freight service contract",
  "assistant": "6702b1e8f9a0b1c2d3e4f5a6"
}'
```

Example response:

```json
{
  "ok": true,
  "task": {
    "id": "6660c4a1f2e3b7d8a9c01234",
    "type": "type",
    "title": "Send Brightline the contract renewal",
    "description": "Draft it, get Maria to sign off, send it."
  }
}
```

## GET /tasks/{taskId}

Retrieve a task

Retrieves a task with its recent activity. To read the full history, list the task's activities.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `taskId` (string, required)

**Responses**

- `200`: Task
  - `ok` (enum, required) One of: `true`.
  - `task` (object, required)
    - `id` (string): Task id
    - `type` (string): task for work, reminder for a reminder
    - `title` (string)
    - `description` (string | null)
    - `status` (enum): pending: waiting for a run; POST /tasks/{taskId}/process starts one. scheduled: waits for scheduledFor. executing: a run is in progress. awaiting_user_input / awaiting_non_user_response: waiting on the user or on someone else, with a follow-up time set. alarm_set: will wake itself at a set time. subtasks_running: waiting on its own background work. message_received / conversation: a message thread with no open work. on_hold / paused: stopped until resumed. completed: finished by the assistant. done_user_marked: marked done by the user. error, abandoned, failed_access (could not get access it needed), deferred_access (waiting for access), credits_blocked (out of credits), handled_by_other (another assistant took the thread), archived. One of: `pending`, `scheduled`, `executing`, `awaiting_user_input`, `awaiting_non_user_response`, `alarm_set`, `subtasks_running`, `message_received`, `conversation`, `on_hold`, `paused`, `completed`, `done_user_marked`, `error`, `abandoned`, `failed_access`, `deferred_access`, `credits_blocked`, `handled_by_other`, `archived`.
    - `summary` (string | null): What the assistant has done, written by the assistant once there is something to report
    - `error` (string | null): Details of the failure when status is error
    - `owner` (string | null): Owner's email
    - `assistant` (object): The assistant working the task
      - `id` (string)
      - `type` (enum) One of: `user`, `assistant`, `contact`.
      - `email` (string)
      - `firstName` (string | null)
      - `lastName` (string | null)
      - `avatar` (string | null)
    - `onBehalfOf` (string | null): Whose data and calendar the task acts on (an email)
    - `followers` (object[]): People following the task
      - `id` (string)
      - `type` (enum) One of: `user`, `assistant`, `contact`.
      - `email` (string)
      - `firstName` (string | null)
      - `lastName` (string | null)
      - `avatar` (string | null)
    - `waitingOnContacts` (object[]): The contacts the task is waiting to hear from, while status is awaiting_non_user_response
      - `id` (string)
      - `type` (enum) One of: `user`, `assistant`, `contact`.
      - `email` (string)
      - `firstName` (string | null)
      - `lastName` (string | null)
      - `avatar` (string | null)
    - `skills` (string[])
    - `plan` (object[]): Checklist the assistant keeps for the task
      - `text` (string)
      - `status` (enum) One of: `pending`, `done`, `skipped`, `blocked`.
      - `note` (string)
    - `readyForReview` (boolean): True when the work is finished and waiting for the user to look
    - `scheduledFor` (string | null): When a scheduled task starts
    - `scheduledHeadline` (string | null): One line, for the user, on what the scheduled run will do
    - `deadline` (string | null): The user's due time for the outcome
    - `alarm` (object | null): The time the task wakes itself to follow up or report back. Set by the assistant; null when none is set.
      - `wakeAt` (string): When the task wakes
      - `headline` (string | null): One sentence, for the user, on why the alarm is set and what happens when it fires. Show this, not the alarm itself; null means show nothing.
      - `status` (enum): set until it fires; fired or cancelled after One of: `set`, `fired`, `cancelled`.
    - `pendingCart` (object | null): Outbound actions staged on this task and waiting on approval (a cart); null when nothing is staged. Read and approve it through the Approvals endpoints.
      - `status` (enum): pending_approval: waiting for a person. time_boxed: will go out at timeBoxedExpiresAt unless someone stops it. executing: going out now. One of: `open`, `submitted`, `pending_approval`, `time_boxed`, `approved`, `executing`, `executed`, `cancelled`, `rejected`, `failed`.
      - `label` (string): Short summary of what is staged
      - `timeBoxedExpiresAt` (string | null): For time_boxed: when the window closes
      - `timeBoxedExpiry` (enum): For time_boxed: what happens when the window closes One of: `execute`, `cancel`, `null`.
      - `dispatches` (object[]): Each staged action
        - `type` (string): The kind of action, such as send_message or send_email
        - `description` (string)
        - `platform` (string): Channel, such as email, sms or slack
        - `to` (string[])
        - `subject` (string)
        - `body` (string)
        - `status` (string)
        - `resolvedApprovalMode` (enum): The autonomy mode that applied to this action One of: `auto`, `time-boxed`, `manual`, `null`.
    - `handledBy` (object | null): When status is handled_by_other: which of the user's assistants took the thread instead
      - `assistantId` (string)
      - `assistantName` (string | null)
      - `decidingTaskId` (string | null): That assistant's task for the same thread, when it exists
      - `decidedAt` (string | null)
    - `executedAt` (string | null): First run
    - `completedAt` (string | null): When the task finished
    - `modelTier` (enum) One of: `low`, `medium`, `high`, `ultra`.
    - `effort` (enum): Reasoning effort: how much thinking the assistant applies on each run, independent of modelTier. low, medium, high, xhigh (extra high) or max. One of: `low`, `medium`, `high`, `xhigh`, `max`.
    - `createdBy` (enum): agent when the assistant proposed the task One of: `user`, `agent`.
    - `approvalGate` (enum): For tasks the assistant proposed: whether the user has approved it to run One of: `pending_user_approval`, `approved`, `declined`.
    - `approvalOverride` (object): Autonomy setting for this task only. mode null means the task follows the user's settings.
      - `mode` (enum) One of: `auto`, `time-boxed`, `manual`, `null`.
      - `timeBoxedWindowMin` (number | null): For time-boxed: minutes before a staged action proceeds
      - `undoDelaySec` (number | null): Seconds a sent action is held so it can still be undone
    - `chatId` (string | null): The chat the task came from, if any
    - `parentTaskId` (string | null): The task this one was split from, if any
    - `origin` (object | null)
      - `platform` (string | null): Channel the task came from, such as chat, email or sms
    - `createdAt` (string)
    - `updatedAt` (string)
    - `effectiveApprovalMode` (enum): The autonomy mode that applies to messages on this task right now, after the task override, the user's settings and any admin locks. Returned by GET and PUT on a single task. One of: `auto`, `time-boxed`, `manual`, `denied`, `null`.
    - `approvalLocks` (object[]): Autonomy rows an admin has locked, which the task override cannot loosen. Shown to the task's owner only; absent for anyone else.
      - `resource` (string): The kind of outbound action
      - `mode` (enum) One of: `auto`, `time-boxed`, `manual`, `denied`.
      - `scope` (enum): Which level locked it One of: `org`, `team`, `account`.
    - `activities` (object[]): The most recent activity. For the full history, page through GET /tasks/{taskId}/activities.
      - `id` (string)
      - `type` (string): Such as message or status_change
      - `createdAt` (string)
      - `message` (object)
        - `role` (string): user, assistant or another participant
        - `content` (string)
        - `platform` (string)
- `404`: Task not found

```bash
curl 'https://api.agnt.ai/tasks/<taskId>' \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "ok": true,
  "task": {
    "id": "6660c4a1f2e3b7d8a9c01234",
    "type": "type",
    "title": "Send Brightline the contract renewal",
    "description": "Draft it, get Maria to sign off, send it."
  }
}
```

## PUT /tasks/{taskId}

Update a task

Updates a task the user owns. Only the fields you send change.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `taskId` (string, required)

**Request body** (JSON)

- `title` (string)
- `description` (string)
- `assistant` (string): Move the task to another assistant the user has
- `status` (enum): pending to run again, scheduled to wait for scheduledFor, paused or on_hold to stop, archived to file it away. Other statuses are set by the platform; to finish a task use mark-done. One of: `pending`, `scheduled`, `paused`, `on_hold`, `archived`.
- `scheduledFor` (string | null): When a scheduled task should run
- `followers` (string[]): Email addresses; replaces the list
- `skills` (string[]): Skill names; replaces the list
- `approvalOverride` (object | null): Autonomy for this task only. null clears it so the task follows the user's settings.
  - `mode` (enum) One of: `auto`, `time-boxed`, `manual`, `null`.
  - `timeBoxedWindowMin` (number | null): Minutes, for time-boxed
- `modelTier` (enum): Can be changed only before the task's first run; after that a different value returns 400. One of: `low`, `medium`, `high`, `ultra`.

**Responses**

- `200`: Updated task
  - Same fields as the `200` response of `GET /tasks/{taskId}`.
- `400`: Invalid change, such as completing a task whose actions are waiting for approval, or changing modelTier after the first run
- `403`: Not the task's owner. Without X-User-Email there is no owner, so this always applies.
  - `status` (integer)
  - `error_code` (string)
  - `error` (string)
- `404`: Task not found

```bash
curl 'https://api.agnt.ai/tasks/<taskId>' \
  -X PUT \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{
  "status": "paused"
}'
```

Example response:

```json
{
  "ok": true,
  "task": {
    "id": "6660c4a1f2e3b7d8a9c01234",
    "type": "type",
    "title": "Send Brightline the contract renewal",
    "description": "Draft it, get Maria to sign off, send it."
  }
}
```

## DELETE /tasks/{taskId}

Delete a task

Permanently deletes a task with its activity, subtasks and run history. The owner, an account or organization admin, or an account key can delete it.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `taskId` (string, required)

**Responses**

- `200`: Deleted
  - `ok` (enum, required) One of: `true`.
  - `task` (object, required)
    - `id` (string, required)
    - `deleted` (boolean)
    - `message` (string)

```bash
curl 'https://api.agnt.ai/tasks/<taskId>' \
  -X DELETE \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "ok": true,
  "task": {
    "id": "6660c4a1f2e3b7d8a9c01234"
  }
}
```

## POST /tasks/{taskId}/process

Run a task

Starts a run of the task. Pass `message` to add the user's reply to the task before the run starts.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `taskId` (string, required)

**Request body** (JSON)

- `message` (string): A new message from the user, saved to the task before it runs
- `files` (object[]): Attachments: files already in the user's drive. Files the user cannot read are dropped.
  - `fileId` (string, required): Drive file id (24 hex characters)
  - `filename` (string)
  - `mimeType` (string)

**Responses**

- `200`: Processing
  - `ok` (enum, required) One of: `true`.
  - `process` (object, required)
    - `success` (boolean, required)
    - `taskId` (string, required)
    - `executionId` (string)
    - `message` (string)
- `403`: The user can see the task but may not run it
  - `status` (integer)
  - `error_code` (string)
  - `error` (string)
- `404`: Task not found, or not visible to this user
  - `status` (integer)
  - `error_code` (string)
  - `error` (string)
- `423`: KILL_SWITCH_ENGAGED: the account is frozen
  - `status` (integer)
  - `error_code` (string)
  - `error` (string)

```bash
curl 'https://api.agnt.ai/tasks/<taskId>/process' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{
  "message": "Brightline agreed to a 3% increase. Update the draft to match."
}'
```

Example response:

```json
{
  "ok": true,
  "process": {
    "success": true,
    "taskId": "6660c4a1f2e3b7d8a9c01234"
  }
}
```

## POST /tasks/{taskId}/stop

Stop a task

Stops the current run and sets the status to `on_hold`. The task stays open; run it again to resume. Only the owner can stop a task.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `taskId` (string, required)

**Responses**

- `200`: Task
  - Same fields as the `201` response of `POST /tasks`.
- `403`: Not the task owner
- `404`: Task not found
- `409`: task_not_pauseable: the task is already finished

```bash
curl 'https://api.agnt.ai/tasks/<taskId>/stop' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "ok": true,
  "task": {
    "id": "6660c4a1f2e3b7d8a9c01234",
    "type": "type",
    "title": "Send Brightline the contract renewal",
    "description": "Draft it, get Maria to sign off, send it."
  }
}
```

## POST /tasks/{taskId}/mark-done

Mark a task done

Stops the assistant and sets the status to `done_user_marked`.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `taskId` (string, required)

**Responses**

- `200`: Task
  - Same fields as the `201` response of `POST /tasks`.
- `403`: Not the task's owner. Without X-User-Email there is no owner, so this always applies.
  - `status` (integer)
  - `error_code` (string)
  - `error` (string)
- `404`: Task not found

```bash
curl 'https://api.agnt.ai/tasks/<taskId>/mark-done' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "ok": true,
  "task": {
    "id": "6660c4a1f2e3b7d8a9c01234",
    "type": "type",
    "title": "Send Brightline the contract renewal",
    "description": "Draft it, get Maria to sign off, send it."
  }
}
```

## POST /tasks/{taskId}/feedback

Leave feedback on a task

Records the user's thumbs up (`like`) or down (`dislike`) on the task. `null` clears it. Only people following the task can leave feedback.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `taskId` (string, required)

**Request body** (JSON)

- `status` (enum, required) One of: `like`, `dislike`, `null`.

**Responses**

- `200`: Feedback
  - `ok` (enum, required) One of: `true`.
  - `feedback` (object, required)
    - `success` (boolean, required)
    - `taskId` (string, required)
    - `status` (string | null, required)
    - `message` (string, required)

```bash
curl 'https://api.agnt.ai/tasks/<taskId>/feedback' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{
  "status": "like"
}'
```

Example response:

```json
{
  "ok": true,
  "feedback": {
    "success": true,
    "taskId": "6660c4a1f2e3b7d8a9c01234",
    "status": "status",
    "message": "Prefers morning meetings."
  }
}
```

## GET /tasks/{taskId}/activities

List a task's activities

Returns the task's timeline of messages, status changes and other events, newest first, up to 100 per page (default 50). While `hasMore` is `true`, pass the returned `cursor` as `before` to get older entries.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `taskId` (string, required)

**Query parameters**

- `limit` (integer)
- `before` (string): The cursor from the previous page, passed back unchanged to get older entries. You can also pass an ISO 8601 timestamp.

**Responses**

- `200`
  - `ok` (enum, required) One of: `true`.
  - `activities` (object[], required)
    - `id` (string, required)
    - `task` (string | null)
    - `type` (string, required)
    - `visibility` (string)
    - `delivery` (object): Delivery state of an outbound assistant message. Read-only.
      - `state` (enum): staged: waiting in an approval (cart) and not sent yet. held: held back and not sent. provider_accepted: sent; the delivery service accepted it. unknown: AGNT has no confirmed delivery record, so do not assume it was or was not delivered. Other values describe messages that stayed inside AGNT, such as a reply shown only in the hosted app or a report between the assistant's own runs. One of: `staged`, `held`, `provider_accepted`, `unknown`.
      - `taskId` (string): Task that sent it
      - `cartId` (string): Approval it went through, if any
    - `createdAt` (string, required)
    - `updatedAt` (string)
    - `message` (object)
      - `role` (enum, required) One of: `user`, `assistant`, `peer`.
      - `content` (string)
      - `platform` (string)
      - `metadata` (object)
      - `delivery` (object): Delivery state of an outbound assistant message. Read-only.
        - `state` (enum): staged: waiting in an approval (cart) and not sent yet. held: held back and not sent. provider_accepted: sent; the delivery service accepted it. unknown: AGNT has no confirmed delivery record, so do not assume it was or was not delivered. Other values describe messages that stayed inside AGNT, such as a reply shown only in the hosted app or a report between the assistant's own runs. One of: `staged`, `held`, `provider_accepted`, `unknown`.
        - `taskId` (string): Task that sent it
        - `cartId` (string): Approval it went through, if any
  - `hasMore` (boolean, required)
  - `cursor` (string | null, required): Opaque cursor; pass it back as `before` to get the next page. null on the last page.
- `400`: limit or before is invalid
  - `status` (integer)
  - `error_code` (string)
  - `error` (string)
- `404`: Task not found in the caller's account and user scope
  - `status` (integer, required)
  - `error_code` (string)
  - `error` (string, required)

```bash
curl 'https://api.agnt.ai/tasks/<taskId>/activities' \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "ok": true,
  "activities": [
    {
      "id": "6660c4a1f2e3b7d8a9c01234",
      "type": "type",
      "createdAt": "2026-10-15T14:30:00Z"
    }
  ],
  "hasMore": false,
  "cursor": "eyJ0IjoiMjAyNi0xMC0xNSJ9"
}
```

## GET /tasks/{taskId}/usage

Retrieve a task's usage

Returns the tokens the task used, per run and in total, and the credits charged for each run.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `taskId` (string, required)

**Responses**

- `200`: Usage
  - `total` (object)
    - `inputTokens` (number)
    - `outputTokens` (number)
    - `cacheReadTokens` (number)
    - `cacheCreationTokens` (number)
    - `totalTokens` (number)
    - `runs` (integer)
    - `turns` (integer)
  - `rows` (object[]): One row per run and model, oldest first
    - `runId` (string | null)
    - `seq` (integer)
    - `modelTier` (string | null)
    - `inputTokens` (number)
    - `outputTokens` (number)
    - `cacheReadTokens` (number)
    - `cacheCreationTokens` (number)
    - `totalTokens` (number)
    - `turns` (integer)
    - `startedAt` (string | null)
  - `credits` (object): Credits charged, one entry per run
    - `total` (number)
    - `runs` (object[])
      - `chargedCredits` (number)
      - `isBillable` (boolean)
      - `createdAt` (string)
- `404`: Task not found

```bash
curl 'https://api.agnt.ai/tasks/<taskId>/usage' \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "total": {
    "inputTokens": 1840,
    "outputTokens": 1840,
    "cacheReadTokens": 1840,
    "cacheCreationTokens": 1840
  },
  "rows": [
    {
      "runId": "6660c4a1f2e3b7d8a9c01234",
      "seq": 1,
      "modelTier": "modeltier",
      "inputTokens": 1840
    }
  ],
  "credits": {
    "total": 42,
    "runs": [
      {
        "chargedCredits": 5,
        "isBillable": true,
        "createdAt": "2026-10-15T14:30:00Z"
      }
    ]
  }
}
```

## POST /tasks/{taskId}/approve

Approve a proposed task

Approves a task the assistant created and is holding for the user. The task starts, or waits for its scheduled time. Call it as a user who owns, follows or works on the task.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `taskId` (string, required)

**Request body** (JSON)

- `reason` (string): Optional note recorded with the approval

**Responses**

- `200`: Approved task
  - Same fields as the `201` response of `POST /tasks`.
- `403`: Not called as an end user: an account key without X-User-Email, or a certificate token
- `404`: Task not found or not visible to this user
- `409`: Task is not waiting for approval

```bash
curl 'https://api.agnt.ai/tasks/<taskId>/approve' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "Approved by Jane"
}'
```

Example response:

```json
{
  "ok": true,
  "task": {
    "id": "6660c4a1f2e3b7d8a9c01234",
    "type": "type",
    "title": "Send Brightline the contract renewal",
    "description": "Draft it, get Maria to sign off, send it."
  }
}
```

## POST /tasks/{taskId}/decline

Decline a proposed task

Declines a task the assistant is holding for the user. The proposed work is not done; the decline and optional `reason` go into the task's conversation, and the assistant follows up.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `taskId` (string, required)

**Request body** (JSON)

- `reason` (string): Optional reason, shared with the assistant

**Responses**

- `200`: Declined task
  - Same fields as the `201` response of `POST /tasks`.
- `403`: Not called as an end user
- `404`: Task not found or not visible to this user
- `409`: Task is not waiting for approval

```bash
curl 'https://api.agnt.ai/tasks/<taskId>/decline' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "Approved by Jane"
}'
```

Example response:

```json
{
  "ok": true,
  "task": {
    "id": "6660c4a1f2e3b7d8a9c01234",
    "type": "type",
    "title": "Send Brightline the contract renewal",
    "description": "Draft it, get Maria to sign off, send it."
  }
}
```

## POST /tasks/approve-batch

Approve proposed tasks in bulk

Approves up to 100 proposed tasks in one call. Each task is handled on its own; tasks that cannot be approved are listed in `failed`.

Acts as one user: send `X-User-Email`.

**Request body** (JSON)

- `taskIds` (string[], required): 1 to 100 task ids

**Responses**

- `200`: Per-task results
  - `ok` (boolean, required)
  - `batch` (object, required)
    - `approved` (string[])
    - `failed` (object[])
      - `taskId` (string)
      - `error` (string)
- `400`: taskIds missing, empty or over 100
- `403`: Not called as an end user

```bash
curl 'https://api.agnt.ai/tasks/approve-batch' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{
  "taskIds": [
    "6660c4a1f2e3b7d8a9c01234"
  ]
}'
```

Example response:

```json
{
  "ok": true,
  "batch": {
    "approved": [
      "approved"
    ],
    "failed": [
      {
        "taskId": "6660c4a1f2e3b7d8a9c01234",
        "error": "error"
      }
    ]
  }
}
```

## POST /tasks/{taskId}/mark-not-done

Reopen a task

Reopens a completed task, or one the user marked done. The status returns to `pending`, and the assistant asks the user how to proceed. Only the task owner can reopen it.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `taskId` (string, required)

**Responses**

- `200`: Reopened task
  - Same fields as the `201` response of `POST /tasks`.
- `400`: Task is not done
- `403`: Not the task's owner. Without X-User-Email there is no owner, so this always applies.
  - `status` (integer)
  - `error_code` (string)
  - `error` (string)
- `404`: Task not found

```bash
curl 'https://api.agnt.ai/tasks/<taskId>/mark-not-done' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "ok": true,
  "task": {
    "id": "6660c4a1f2e3b7d8a9c01234",
    "type": "type",
    "title": "Send Brightline the contract renewal",
    "description": "Draft it, get Maria to sign off, send it."
  }
}
```
