Now available: project and task duplication!

Hello everyone, we have some new API endpoints to share with you that allow you to duplicate tasks and projects in Asana! :tada: Special thanks to @Sasha_S for driving this project and the implementation!

You can now make a call to POST /projects/{project_gid}/duplicate to kick off an asynchronous “job” that will make a copy of a project and all its tasks, just like it would when a user duplicates the project in the Asana UI. The response of this call will be a new “job” object detailing the state of the duplication and indicating the new project that was created as a result. Most projects will finish duplicating in a minute or so, but you can always follow up to get the current status using GET /jobs/{job_gid}.

Additionally, there are a number of optional parameters you can send in the request to affect the duplication:

  • team, optional — allows you to specify a team for the new project. By default, the new project is created in the same team as the project it was duplicated from.
  • include, list of strings, optional — allows you to specify which attributes of the project and its tasks are copied over to the new project. The full set of available attributes is:
    • "members"
    • "task_notes"
    • "task_assignee"
    • "task_subtasks"
    • "task_attachments"
    • "task_dates"
    • "task_dependencies"
    • "task_collaborators"
    • "task_tags"
    • "task_projects"
  • schedule_dates, object, optional — allows you to take advantage of the new automatic due-date shifting in Asana! This object must contain the following parameters:
    • One of due_on or start_on, date — the reference date by which to shift all other dates in the project.
    • should_skip_weekends, boolean — whether or not to have the shifting calculation exclude weekends when scheduling the new tasks.

(The same process applies to POST /tasks/{task_gid}/duplicate, though the set of attributes you can include in the duplication is different. Reference the docs for the full list.)

Bundled in with this is the ability to query for templates! Projects have a boolean is_template field on them that can be used to determine if it’s been marked as a template, and the field is writable to allow you to mark it as a template through the API. For organizations, you can fetch templates on a team-by-team basis by calling GET /teams/{team_gid}/projects?is_template=true, and for workspaces you can use GET /workspaces/{workspace_gid}/projects?is_template=true. (Note that custom templates are a premium feature in Asana.)

9 Likes

One small note: @Joe_Trollo correct me if this is wrong - if you’re querying projects and want to include the is_template field, you need to specifically ask for it via opt_fields.

Nope! is_template will be included by default on project objects (though your comment made me realize it isn’t, which is a mistake, so it will be included by default after my patch makes it to production).

1 Like

Hi @Joe_Trollo, what about the project/task duplication across workspaces? It sounds like the duplication is possible across teams which means the copy is possible to other organizations where the current user is a member. But workspaces (is_organization = false) do not have teams. So, is it possible to duplicate project/task from one workspace/organization to other workspaces?

Hi @Mahmudul_Hasan, sorry, but data in Asana cannot be shared or moved across workspaces, only within workspaces. Copying data across requires pulling it out of Asana and then putting it back into the other workspace.

My organization is new to Asana and I am new to the forums. We are excited about this feature. I am using Python to create a script to duplicate a template project using the API. Since the official Python does not appear to support this feature yet, I am just using the requests library. When I post to the endpoint using the project_gid it is returning a “Missing Input” error. If I submit the same request with both the project_gid and specifying the name, it is successful. It does not appear according to this post or the documentation that name is a required parameter. I am not sure if it is an issue with my script, or an oversight in the documentation, or an actual bug. Posting here in case it helps anyone.

Uh-oh - good catch, that’s an omission in the documentation. Name is definitely required, as you have to tell Asana what you want the name for the new project to be.

cc: @Joe_Trollo

Thanks for catching that! Yes, the docs are wrong and missing the name parameter which is required when duplicating objects. The docs will be updated soon with the fix.

Hi

I am trying to use the feaute for duplicate task via google app script.
It is working great but i can not figure it out how to add the dupliated task inside a specific project

Where can i say in which project do i want to add the duplicate task?
function duplicate(taskName) {
var newTask = {
name: taskName,
workspace: WORKSPACE_ID,
projects:“1106704858704663”,

include: [
"notes",
"assignee",
"subtasks"

]

Hi @Damian_Swarynski and welcome to the forum!

I don’t think you can specify a different project for the duplicate’s location that’s different from the source. I haven’t tried task duplication (I only do project duplication), but as I understand it, all you can do is include projects as a parameter in your include fields and that will place the duplicate in the same project(s) as the source.

To get the duplicate in a different project or projects, I think you’ll have to do that yourself; that is, after the duplicate is created and the API returns its ID to you, you can use that ID to then set the appropriate project(s) on that task.

@Joe_Trollo @Ross_Grambo, do I have that right, or am I missing something?

1 Like

@Phil_Seeman is correct. You’ll either have to duplicate the task, and then set the project in a second request, or don’t use the duplicate functionality and create a task with the desired notes, assignee, subtasks, and project.

1 Like

This is a great feature. Thanks for implementing it.

The name property is still not documented in the right place. For anyone looking to use this feature right now, you’ll need to specify the ‘name’ at the top level in your params (same level as project_gid)

Do we always get a GID for the projects, even though the creation is not done yet?

Yep!

1 Like

Do tasks also have the is_template field or only projects?

@Clare_Specht, I think is_template is only for projects.

Larry

Clare, just to make sure you’re aware, with the advent of true project templates as a separate object, is_template is deprecated and will likely be removed from Asana soon.

2 Likes

Thanks! I ended up just duplicating an existing task since I needed the recurring task feature, but great to have on my radar!