Add task to a section upon creation via API request

When you create a task currently, if you want to add it to a section, you need a second POST request. Is there a way to add a task to a section on creation, similarly to how you add it to a project? Sections have a globally unique GID, so it seems like it should be doable?


Yes! Set the Memberships property on the task.

There are some subtleties involved in terms of the exact syntax and the language you’re using; here’s some info:

That’s actually what I’m asking about avoiding. With the new Section implementation, the /sections/<section_gid>/addTask endpoint is exactly the same, however, I’d like to add the section when I post to the /tasks endpoint to create the task. We’re currently able to specify a project to add the task to, but what about a section?

The Memberships property includes specifying the section.


**Create-only.** Array of projects this task is associated with and the section it is in. At task creation time, this array can be used to add the task to specific sections. After task creation, these associations can be modified using theaddProjectandremoveProjectendpoints. Note that over time, more types of memberships may be added to this property.

1 Like

For clarity (and to link to this from another thread I’m about to respond to) this is what a request that both creates the task and sets the section memberships in the same request looks like:

POST /tasks
  "data": {
    "name": "My Task",
    "memberships": [
        "project": 123,
        "section": 456,
        "project": 789,
        "section": 1011,