> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.athenaintel.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.athenaintel.com/_mcp/server.

# Create a plan of tasks

POST https://api.athenaintel.com/api/v0/tasks/plans
Content-Type: application/json

Create up to 15 tasks in one call, with which of them wait on which: each item is a new task's fields, an optional key (its own name in the plan) and needs (other items' keys, or tasks that already exist, by T-number or asset id). The plan is checked whole before anything is created: a bad field, a key used twice, a loop, a task in needs the caller cannot open, or anything creating one of the tasks alone would refuse, refuses the plan and names the item. Tasks are then created one at a time, each with what it waits on, and a plan cannot be undone as a whole: one that stops part way answers partly_created with the tasks that exist. Send an idempotency key (in the body, or as the Idempotency-Key header) so that a retry within 24 hours creates only what is missing and answers the same tasks.

Reference: https://docs.athenaintel.com/api-reference/tasks/create-plan

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Headers

- `Idempotency-Key` (string, optional, nullable) — Optional caller-chosen key that makes the plan safe to retry (1 to 64 letters, digits, - or _); the same as idempotency_key in the body.

### Body (application/json)

This endpoint expects a CreateTaskPlanRequestIn.

- `tasks` (list of TaskPlanItemIn, required) — The tasks to create, 1 to 15. Give each one another needs a key, and say what each waits on in needs.
- `workspace_id` (string, required) — The workspace to create them in; the caller must be a member.
- `idempotency_key` (string, optional, nullable) — Your own name for this plan (1 to 64 letters, digits, - or _), also taken as the Idempotency-Key header. Sending the same key and the same tasks again within 24 hours creates nothing twice and answers the same tasks, so always send one and reuse it when a call fails or stops part way.
- `parent_folder_id` (string, optional, nullable) — A folder or project to put every task of the plan in; needs edit access there.

## Response

### 200

The plan's tasks: created, answered again for a repeated key, or partly_created with what exists and why it stopped.

- `count` (integer, required) — How many of the plan's tasks exist.
- `created_now` (integer, required) — How many of them this call created.
- `result` (enum, required) — created: every task of the plan exists. partly_created: the plan stopped part way, and nothing it created was undone.
  - Allowed values: `created`, `partly_created`
- `stopped` (string, required, nullable) — With partly_created: which item was not created, why, and how to finish the plan.
- `tasks` (list of TaskPlanTaskOut, required) — Every item, in the order sent.

## Errors

### 400 Bad Request Error

The plan cannot be created as sent: its shape, a field, a key already used for a different plan, or two different idempotency keys. Nothing was created.

- `any`

### 401 Unauthorized Error

The API key or token is missing or not valid.

- `any`

### 403 Forbidden Error

The caller is not a member of the workspace named, may not create tasks, or may not give a task that assignee, folder or parent task. Nothing was created.

- `any`

### 404 Not Found Error

A task named in needs, or a parent task, is not one the caller can open. Nothing was created.

- `any`

### 409 Conflict Error

A plan with this idempotency key is being created right now: call again in a moment with the same key.

- `any`

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 503 Service Unavailable Error

Tasks are not ready on this deployment yet, or the retry guard of a plan sent with an idempotency key cannot be reached. Nothing was created by this call.

- `any`

## Types

### TaskPlanItemIn

One task of a plan: a new task's fields, a key and what it waits on. A field this model does not name is refused, so a misspelt ``needs`` never creates a task that waits on nothing.

- `title` (string, required) — What to do, in a short line (at most 500 characters).
- `assignee_ref` (string, optional, nullable) — Who it is for: user_… for a person, agent_asset_… for an agent, or me. Left out, the task is the caller's own; null or the word nobody, nobody's, for whoever claims it. The assignee must already be able to open it.
- `description` (string, optional, nullable) — Details, in markdown.
- `due_date` (string, optional, nullable) — YYYY-MM-DD: a calendar day, with no time zone.
- `due_time` (string, optional, nullable) — HH:MM on a 24-hour clock; needs due_date and due_time_zone.
- `due_time_zone` (string, optional, nullable) — The IANA time zone of due_time, such as America/New_York.
- `key` (string, optional, nullable) — Your own short name for this task, unique in the plan (lowercase letters, digits, - or _), so other items can name it in needs.
- `labels` (list of string, optional, nullable) — Label names (a plan's labels carry no color).
- `needs` (list of string, optional) — What must be done before this task can start: other items' keys, or tasks that already exist (T-12 or an asset id). Left out: it is ready at once.
- `parent_task_id` (string, optional, nullable) — A task to make it a sub-task of: one of the same workspace the caller can open and change.
- `priority` (enum, optional, nullable) — How much it matters; left out, none.
  - Allowed values: `none`, `low`, `medium`, `high`, `urgent`

### TaskPlanTaskOut

One item of a plan, as the plan left it.

- `created_now` (boolean, required) — Whether this call created it. False: an earlier call with the same idempotency key did, or it was not created.
- `id` (string, required, nullable) — The asset id of the task it was created as; null when it was not.
- `item` (integer, required) — Its place in the plan as sent, from 1.
- `key` (string, required, nullable) — The key it was sent with, if any.
- `task` (TaskOut, required, nullable) — The task, read as the caller (no links and a null can_edit, as in a list); null when it was not created, or was created by an earlier call and the caller can no longer open it.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `ctx` (ValidationErrorCtx, optional)
- `input` (any, optional)

### TaskOut

An assignable to-do: due on a calendar day, at a time in due_time_zone.

- `assignee` (TaskAssigneeOut, required, nullable) — Who it is for, or null for nobody.
- `blocked_by` (list of string, required) — The ids of the tasks that must be done before this one: those the caller can open.
- `can_edit` (boolean, required, nullable) — Whether the caller may change it; null in a list.
- `claim` (TaskClaimOut, required, nullable) — Who is working on it now; null when nobody is, and once the lease ran out.
- `completed_at` (datetime, required, nullable) — When it was marked done.
- `completed_by_ref` (string, required, nullable) — Who marked it done.
- `completion_note` (string, required, nullable) — What the work produced, left when it was marked done.
- `completion_reason` (enum, required, nullable) — Why it is done (completed or not_planned); null while open.
  - Allowed values: `completed`, `not_planned`
- `created_at` (datetime, required, nullable)
- `created_by` (string, required, nullable) — The user who created it.
- `description` (string, required, nullable) — Markdown.
- `due_date` (string, required, nullable) — YYYY-MM-DD, or null.
- `due_time` (string, required, nullable) — HH:MM (24-hour), or null.
- `due_time_zone` (string, required, nullable) — The IANA time zone of due_time.
- `external_refs` (list of TaskExternalRefOut, required) — The items kept elsewhere it is linked to (a pull request, an issue, a thread), each with what its system last said.
- `hidden_blockers` (integer, required) — How many more tasks it waits on that the caller can't open.
- `hold` (TaskHoldOut, required, nullable) — Why it waits on a person; null when it doesn't. A held task is not ready and can't be claimed until the hold is lifted.
- `id` (string, required) — The task's asset id.
- `is_archived` (boolean, required) — Whether it is in the trash.
- `is_blocked` (boolean, required) — Whether a task it waits on is still open, counting the ones the caller can't open.
- `is_ready` (boolean, required) — Whether it can be worked on now: open, not in the trash, nobody working on it, not held for a person and waiting on no open task. It says nothing of who may take it: a task assigned to someone is theirs alone to claim.
- `labels` (list of TaskLabelOut, required)
- `links` (list of TaskLinkOut, required) — The records it is about, read as the caller. Always empty in a list.
- `number` (integer, required, nullable) — Its number in its workspace (1, 2, 3, …), shown as T-\<n>; null for a task written before tasks were numbered.
- `parent` (TaskParentOut, required, nullable) — The task it is a sub-task of, read through that task's own gate; null when it is no sub-task.
- `priority` (enum, required)
  - Allowed values: `none`, `low`, `medium`, `high`, `urgent`
- `status` (enum, required)
  - Allowed values: `open`, `done`
- `subtask_progress` (TaskSubtaskProgressOut, required) — How many of its sub-tasks the caller can open are done, of how many.
- `title` (string, required)
- `updated_at` (datetime, required, nullable)
- `workspace_id` (string, required)

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

### TaskAssigneeOut

Who a task is assigned to: a person or an agent.

- `display_name` (string, required, nullable) — Their name, when the caller may see it (an agent's only when they can open it).
- `kind` (enum, required) — person or agent.
  - Allowed values: `person`, `agent`
- `ref` (string, required) — user_… for a person, agent_asset_… for an agent.

### TaskClaimOut

Who is working on a task now, and until when. A claim is live only while the task is open and its lease has not run out; after that the task reads as nobody's, at once.

- `claimed_by` (TaskAssigneeOut, required) — Who holds it: a person, or an agent acting as itself.
- `expires_at` (datetime, required) — When the lease runs out unless its holder renews it.
- `is_yours` (boolean, required) — Whether the claim is the caller's own to renew or give back: held by the caller and, when the request names a worker, made by that worker (or with no worker named). The worker that made a claim is never shown.

### TaskExternalRefOut

An item kept elsewhere that a task is linked to. A pull request, an issue, a thread. What its system last said of it is null until that system has spoken.

- `checks_failed` (integer, required, nullable) — How many of its checks failed.
- `checks_passed` (integer, required, nullable) — How many of its checks passed.
- `id` (string, required) — The link's own id.
- `label` (string, required) — A short name for the item, such as acme/app#12.
- `lifecycle` (string, required, nullable) — Where the item stands there: open, draft, merged or closed.
- `provider` (string, required) — The system that keeps the item, such as github.
- `relation` (string, required) — tracks, mirrors or conversation.
- `review_verdict` (string, required, nullable) — Its reviewers' overall verdict, when it has reviews.
- `updated_at` (datetime, required, nullable) — When the link or what its system said of it last changed.
- `url` (string, required) — The item's address.

### TaskHoldOut

Why a task waits on a person: it is open, not ready, and nobody can claim it.

- `held_at` (datetime, required) — When it was held.
- `held_by` (TaskAssigneeOut, required, nullable) — Who held it (a person or an agent).
- `kind` (string, required) — What sort of wait it is, in one short word: needs_input, awaiting_approval, failed (a worker gave it up), or the holder's own.
- `reason` (string, required) — What the task waits for, in one line.

### TaskLabelOut

A label on a task: its name, color and who applied it.

- `applied_at` (string, required) — When it was applied (ISO 8601).
- `applied_by_ref` (string, required) — Principal ref of who applied it.
- `color` (string, required, nullable) — #RRGGBB, or null.
- `name` (string, required)

### TaskLinkOut

A record a task is about, read as the caller.

- `detail` (string, required, nullable) — Its asset or object type, read as the caller.
- `id` (string, required, nullable) — The asset or object id; null when unreadable.
- `readable` (boolean, required) — Whether the caller can open it. One they can't shows its kind only: no id, URL or title.
- `referenced` (string, required) — asset, ontology_object or external_url.
- `title` (string, required, nullable) — Its title, read as the caller.
- `url` (string, required, nullable) — The web page's URL; null when unreadable.

### TaskParentOut

The task a sub-task belongs to, read through its own gate.

- `id` (string, required, nullable) — Its asset id; null when the caller can't open it.
- `number` (integer, required, nullable) — Its number (T-\<n>); null when the caller can't open it.
- `readable` (boolean, required) — Whether the caller can open it.
- `status` (enum, required, nullable) — open or done; null when the caller can't open it.
  - Allowed values: `open`, `done`
- `title` (string, required, nullable) — Its title; null when the caller can't open it.

### TaskSubtaskProgressOut

How far along a task's sub-tasks are, among those the caller can open.

- `done` (integer, required) — How many of them are done.
- `total` (integer, required) — How many there are.

## Examples

**Request**

```json
{
  "tasks": [
    {
      "title": "Draft the deck",
      "key": "draft"
    },
    {
      "title": "Review the deck",
      "assignee_ref": "nobody",
      "key": "review",
      "needs": [
        "draft"
      ]
    }
  ],
  "workspace_id": "ws_abc123-def456",
  "idempotency_key": "mayfield-raise-1"
}
```

**Response**

```json
{
  "count": 1,
  "created_now": 1,
  "result": "created",
  "stopped": "string",
  "tasks": [
    {
      "created_now": true,
      "id": "string",
      "item": 1,
      "key": "string",
      "task": {
        "assignee": {
          "display_name": "Ada Lovelace",
          "kind": "person",
          "ref": "user_123"
        },
        "blocked_by": [],
        "can_edit": true,
        "claim": {
          "claimed_by": {
            "display_name": "Ada Lovelace",
            "kind": "person",
            "ref": "user_123"
          },
          "expires_at": "2026-11-11T15:30:00+00:00",
          "is_yours": true
        },
        "completed_at": "2024-01-15T09:30:00Z",
        "completed_by_ref": "string",
        "completion_note": "string",
        "completion_reason": "completed",
        "created_at": "2026-11-11T15:00:00+00:00",
        "created_by": "user_123",
        "description": "string",
        "due_date": "2026-11-13",
        "due_time": "15:00",
        "due_time_zone": "America/New_York",
        "external_refs": [],
        "hidden_blockers": 0,
        "hold": {
          "held_at": "2024-01-15T09:30:00Z",
          "held_by": {
            "display_name": "string",
            "kind": "person",
            "ref": "string"
          },
          "kind": "string",
          "reason": "string"
        },
        "id": "asset_7c1e5b2a-4f3d-4e8a-9b6c-1d2e3f4a5b6c",
        "is_archived": false,
        "is_blocked": false,
        "is_ready": false,
        "labels": [
          {
            "applied_at": "2026-11-11T15:00:00+00:00",
            "applied_by_ref": "user_123",
            "color": "string",
            "name": "Investor"
          }
        ],
        "links": [
          {
            "detail": "string",
            "id": "string",
            "readable": true,
            "referenced": "external_url",
            "title": "example.com",
            "url": "https://example.com"
          }
        ],
        "number": 12,
        "parent": {
          "id": "string",
          "number": 1,
          "readable": true,
          "status": "open",
          "title": "string"
        },
        "priority": "high",
        "status": "open",
        "subtask_progress": {
          "done": 1,
          "total": 3
        },
        "title": "Send the deck to Mayfield",
        "updated_at": "2026-11-11T15:00:00+00:00",
        "workspace_id": "ws_abc123-def456"
      }
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.athenaintel.com/api/v0/tasks/plans"

payload = {
    "tasks": [
        {
            "title": "Draft the deck",
            "key": "draft"
        },
        {
            "title": "Review the deck",
            "assignee_ref": "nobody",
            "key": "review",
            "needs": ["draft"]
        }
    ],
    "workspace_id": "ws_abc123-def456",
    "idempotency_key": "mayfield-raise-1"
}
headers = {
    "X-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.athenaintel.com/api/v0/tasks/plans';
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"tasks":[{"title":"Draft the deck","key":"draft"},{"title":"Review the deck","assignee_ref":"nobody","key":"review","needs":["draft"]}],"workspace_id":"ws_abc123-def456","idempotency_key":"mayfield-raise-1"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.athenaintel.com/api/v0/tasks/plans"

	payload := strings.NewReader("{\n  \"tasks\": [\n    {\n      \"title\": \"Draft the deck\",\n      \"key\": \"draft\"\n    },\n    {\n      \"title\": \"Review the deck\",\n      \"assignee_ref\": \"nobody\",\n      \"key\": \"review\",\n      \"needs\": [\n        \"draft\"\n      ]\n    }\n  ],\n  \"workspace_id\": \"ws_abc123-def456\",\n  \"idempotency_key\": \"mayfield-raise-1\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.athenaintel.com/api/v0/tasks/plans")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"tasks\": [\n    {\n      \"title\": \"Draft the deck\",\n      \"key\": \"draft\"\n    },\n    {\n      \"title\": \"Review the deck\",\n      \"assignee_ref\": \"nobody\",\n      \"key\": \"review\",\n      \"needs\": [\n        \"draft\"\n      ]\n    }\n  ],\n  \"workspace_id\": \"ws_abc123-def456\",\n  \"idempotency_key\": \"mayfield-raise-1\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.athenaintel.com/api/v0/tasks/plans")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"tasks\": [\n    {\n      \"title\": \"Draft the deck\",\n      \"key\": \"draft\"\n    },\n    {\n      \"title\": \"Review the deck\",\n      \"assignee_ref\": \"nobody\",\n      \"key\": \"review\",\n      \"needs\": [\n        \"draft\"\n      ]\n    }\n  ],\n  \"workspace_id\": \"ws_abc123-def456\",\n  \"idempotency_key\": \"mayfield-raise-1\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.athenaintel.com/api/v0/tasks/plans', [
  'body' => '{
  "tasks": [
    {
      "title": "Draft the deck",
      "key": "draft"
    },
    {
      "title": "Review the deck",
      "assignee_ref": "nobody",
      "key": "review",
      "needs": [
        "draft"
      ]
    }
  ],
  "workspace_id": "ws_abc123-def456",
  "idempotency_key": "mayfield-raise-1"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.athenaintel.com/api/v0/tasks/plans");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"tasks\": [\n    {\n      \"title\": \"Draft the deck\",\n      \"key\": \"draft\"\n    },\n    {\n      \"title\": \"Review the deck\",\n      \"assignee_ref\": \"nobody\",\n      \"key\": \"review\",\n      \"needs\": [\n        \"draft\"\n      ]\n    }\n  ],\n  \"workspace_id\": \"ws_abc123-def456\",\n  \"idempotency_key\": \"mayfield-raise-1\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "tasks": [
    [
      "title": "Draft the deck",
      "key": "draft"
    ],
    [
      "title": "Review the deck",
      "assignee_ref": "nobody",
      "key": "review",
      "needs": ["draft"]
    ]
  ],
  "workspace_id": "ws_abc123-def456",
  "idempotency_key": "mayfield-raise-1"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.athenaintel.com/api/v0/tasks/plans")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```