Skip to main content

Creating tasks

This endpoint creates a new task.

HTTP Request

POST https://api.lunatask.app/v1/tasks

Body Parameters

ParameterDescription
area_idThe Area ID of the list where the task should be created (UUID, can be found in our apps in the area settings)
goal_idThe ID of the goal where the task should be created (optional, can be found in our apps in the goal's settings)
nameThe name of the task (optional, but impractical if empty)
noteThe note attached to task (optional, formatted in Markdown)
statusThe status of the task (optional, see possible values)
motivationThe motivation value of the task (optional, see possible values)
eisenhowerThe quadrant on Eisenhower matrix (optional, see possible values)
estimateThe estimate of the task (optional, in minutes)
priorityPriority of the task (optional, see possible values)
scheduled_onISO-8601 formatted date the task is scheduled on (optional)
completed_atISO-8601 formatted time when the task was completed (optional)
sourceIdentification of external system where the task is coming from (optional, e.g. "github")
source_idThe ID of the record in the external system (optional, e.g. "123")

source/source_id attributes are useful for later lookup of previously created tasks when updating without a need to remember task IDs. The API does not enforce uniqueness of source/source_id.

When creating a task, given there's already an existing not completed task in the same area with the same source/source_id, the endpoint will return 204 No Content without creating a duplicate.

Example in Ruby

require 'rest-client'

access_token = 'xxx'

payload = {
name: 'My task',
area_id: '11b37775-5a34-41bb-b109-f0e5a6084799',
source: 'github',
source_id: '123'
}

RestClient.post('https://api.lunatask.app/v1/tasks', payload.to_json, { Authorization: "bearer #{access_token}", "Content-Type": 'application/json' })

Response

The above command returns JSON structured like this:

{
"task": {
"id": "066b5835-184f-4fd9-be60-7d735aa94708",
"area_id": "11b37775-5a34-41bb-b109-f0e5a6084799",
"goal_id": null,
"status": "later",
"previous_status": null,
"estimate": null,
"priority": 0,
"progress": null,
"motivation": "unknown",
"eisenhower": 0,
"sources": [
{
"source": "github",
"source_id": "123"
}
],
"scheduled_on": null,
"completed_at": null,
"created_at": "2021-01-10T10:39:25Z",
"updated_at": "2021-01-10T10:39:25Z",
}
}