# Cannot create task with memberships via API

**URL:** <https://forum.asana.com/t/cannot-create-task-with-memberships-via-api/66797>\
**Category:** API & Developers\
**Tags:** tasks\
**Created:** [19 November 2019 18:12 UTC](https://forum.asana.com/t/cannot-create-task-with-memberships-via-api/66797 "2019-11-19T18:12:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dmitrii](https://luna1.co/8d76cd.png) [@Dmitrii](https://forum.asana.com/u/Dmitrii)\
**Post date:** [19 November 2019 18:12 UTC](https://forum.asana.com/t/cannot-create-task-with-memberships-via-api/66797/1 "2019-11-19T18:12:23Z")

</div>

Hey, I’m trying to create a task using node asana API.

Everything works great if I’m specifying only `projects: projectId`, but I need also specify the section, so my code is “memberships”: [  
{“project”: 12345, “section”: 09876}  
]

And I always getting this error: Error: Invalid Request

---

<div class="post-metadata">

**Author:** ![Frederic\_Malenfant](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/frederic_malenfant/32/8358_2.png) [@Frederic\_Malenfant](https://forum.asana.com/u/Frederic_Malenfant)\
**Post date:** [19 November 2019 18:26 UTC](https://forum.asana.com/t/cannot-create-task-with-memberships-via-api/66797/2 "2019-11-19T18:26:20Z")

</div>

> [@Dmitrii](#):
>
> create a task using node asan

I think you must do 2 requests, first create your task in the project, then add task to the section.  
You don’t set the section of the task, you add the task to the section, as described there:

> **[Build an app with Asana](https://developers.asana.com/docs)**
>
> Learn the basics of Asana's developer platform

---

<div class="post-metadata">

**Author:** ![Dmitrii](https://luna1.co/8d76cd.png) [@Dmitrii](https://forum.asana.com/u/Dmitrii)\
**Post date:** [19 November 2019 19:05 UTC](https://forum.asana.com/t/cannot-create-task-with-memberships-via-api/66797/3 "2019-11-19T19:05:34Z")

</div>

According to this threads it’s possible to set the section on creation.  
[https://forum.asana.com/t/how-create-task-with-membership-via-api/10481/2https://forum.asana.com/t/add-task-to-a-section-upon-creation-via-api-request/51957/5](https://forum.asana.com/t/how-create-task-with-membership-via-api/10481/2https://forum.asana.com/t/add-task-to-a-section-upon-creation-via-api-request/51957/5)

Also as I understand from here [Build an app with Asana](https://developers.asana.com/docs/#create-a-task) , I can specify section on creation.

---

<div class="post-metadata">

**Author:** ![Frederic\_Malenfant](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/frederic_malenfant/32/8358_2.png) [@Frederic\_Malenfant](https://forum.asana.com/u/Frederic_Malenfant)\
**Post date:** [19 November 2019 19:19 UTC](https://forum.asana.com/t/cannot-create-task-with-memberships-via-api/66797/4 "2019-11-19T19:19:35Z")

</div>

I just tried it in our app to see how we do this 😃 and I found that we also pass the “projects” parameter. So, the post looks like:

{“data”:{“name”:“14h19”,“projects”:“123456”,“memberships”:[{“project”:“123456”,“section”:“456789”}]}}

But, when I tried without the “projects” parameter, I got a 400 bad request response, but in the response info, I got informations about what is going wrong:

“message=You should specify one of workspace, parent, projects”

So, you should look at the “body” of non-200 responses, sometimes they give informations about why it doesn’t work.

---

<div class="post-metadata">

**Author:** ![Dmitrii](https://luna1.co/8d76cd.png) [@Dmitrii](https://forum.asana.com/u/Dmitrii)\
**Post date:** [20 November 2019 02:53 UTC](https://forum.asana.com/t/cannot-create-task-with-memberships-via-api/66797/5 "2019-11-20T02:53:19Z")

</div>

Wow Frederic, thanks a lot, it works, you really helped me.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/system/32/276370_2.png) [@system](https://forum.asana.com/u/system)\
**Post date:** [30 May 2025 18:57 UTC](https://forum.asana.com/t/cannot-create-task-with-memberships-via-api/66797/6 "2025-05-30T18:57:50Z")

</div>


