Tasks: insert

Requires authorization

Creates a new task on the specified task list. Try it now or see an example.


HTTP request

POST https://www.googleapis.com/tasks/v1/lists/tasklist/tasks


Parameter name Value Description
Path parameters
tasklist string Task list identifier.
Optional query parameters
parent string Parent task identifier. If the task is created at the top level, this parameter is omitted. Optional.
previous string Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted. Optional.


This request requires authorization with the following scope (read more about authentication and authorization).


Request body

In the request body, supply a Tasks resource.


If successful, this method returns a Tasks resource in the response body.


Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).


Uses the Java client library.

Task task = new Task();
task.setTitle("New Task");
task.setNotes("Please complete me");
task.setDue(new DateTime(System.currentTimeMillis() + 3600000), 0);

Task result = service.tasks.insert("@default", task).execute();


Uses the PHP client library.

$task = new Task();
$task->setTitle('New Task');
$task->setNotes('Please complete me');
$task->setDue(new TaskDateTime('2010-10-15T12:00:00.000Z'));

$result = $service->insertTasks('@default', $task);
echo $result->getId();


Uses the Python client library.

task = {
  'title': 'New Task',
  'notes': 'Please complete me',
  'due': '2010-10-15T12:00:00.000Z'

result = service.tasks().insert(tasklist='@default', body=task).execute()
print result['id']


Uses the .NET client library.

Task task = new Task { Title = "New Task"};
task.Notes = "Please complete me";
task.Due = "2010-10-15T12:00:00.000Z";

Task result = service.Tasks.Insert(task, "@default").Fetch();

Try it!

Use the APIs Explorer below to call this method on live data and see the response. Alternatively, try the standalone Explorer.

Send feedback about...