Appearance
Instantiate a project from a project template
API ReferenceRequired scope: projects:write
Creates and returns a job that will asynchronously handle the project instantiation.
To form this request, it is recommended to first make a request to get a project template. Then, from the response, copy the gid from the object in the requested_dates array. This gid should be used in requested_dates to instantiate a project.
Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the is_organization parameter.
OpenAPI definition
json
{
"openapi": "3.0.0",
"info": {
"description": "This is the interface for interacting with the Asana Platform. Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml).",
"x-public-description": "This is the interface for interacting with the Asana Platform. Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml).",
"title": "Asana",
"termsOfService": "https://asana.com/terms",
"contact": {
"name": "Asana Support",
"url": "https://asana.com/support"
},
"license": {
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0"
},
"version": "1.0",
"x-docs-schema-whitelist": [
"AsanaResource",
"AsanaNamedResource",
"AuditLogEvent",
"AttachmentResponse",
"AttachmentCompact",
"BatchResponse",
"CustomFieldSettingResponse",
"CustomFieldSettingCompact",
"CustomTypeResponse",
"CustomTypeBase",
"CustomTypeCompact",
"CustomTypeStatusOptionResponse",
"CustomTypeStatusOptionBase",
"CustomTypeStatusOptionCompact",
"CustomFieldResponse",
"CustomFieldCompact",
"CustomFieldMembershipCompact",
"CustomFieldMembershipResponse",
"EnumOption",
"EventResponse",
"ErrorResponse",
"GoalResponse",
"GoalCompact",
"GoalMembershipCompact",
"GoalMembershipBase",
"GoalMembershipResponse",
"GoalRelationshipResponse",
"GoalRelationshipCompact",
"GraphExportResponse",
"GraphExportCompact",
"JobResponse",
"JobCompact",
"OrganizationExportResponse",
"OrganizationExportCompact",
"PortfolioMembershipResponse",
"PortfolioMembershipCompact",
"PortfolioResponse",
"PortfolioCompact",
"ProjectBriefResponse",
"ProjectBriefCompact",
"ProjectMembershipCompactResponse",
"ProjectMembershipNormalResponse",
"ProjectMembershipCompact",
"ProjectResponse",
"ProjectCompact",
"ProjectStatusResponse",
"ProjectStatusCompact",
"ProjectTemplateCompact",
"ProjectTemplateResponse",
"RuleTriggerResponse",
"ResourceExportResponse",
"ResourceExportCompact",
"ResourceExportCompact",
"RbacRoleResponse",
"RbacRoleCompact",
"SectionResponse",
"SectionCompact",
"StatusUpdateResponse",
"StatusUpdateCompact",
"StoryResponse",
"StoryCompact",
"TagResponse",
"TagCompact",
"TaskResponse",
"TaskCompact",
"TaskCountResponse",
"TeamMembershipResponse",
"TeamMembershipCompact",
"TeamResponse",
"TeamCompact",
"TimePeriodResponse",
"TimePeriodCompact",
"TimeTrackingCategoryResponse",
"TimeTrackingCategoryCompact",
"UserTaskListResponse",
"UserTaskListCompact",
"UserResponse",
"UserCompact",
"WebhookFilter",
"WebhookResponse",
"WebhookCompact",
"WorkspaceMembershipResponse",
"WorkspaceMembershipCompact",
"WorkspaceResponse",
"WorkspaceCompact"
]
},
"servers": [
{
"url": "https://app.asana.com/api/1.0",
"description": "Main endpoint."
}
],
"security": [
{
"personalAccessToken": []
},
{
"oauth2": []
}
],
"x-readme": {
"proxy-enabled": false
},
"tags": [
{
"name": "Project templates",
"description": "A project template is an object that allows new projects to be created\nwith a predefined setup, which may include tasks, sections, rules, etc.\nIt simplifies the process of running a workflow that involves a similar\nset of work every time.\n\n\nProject templates in organizations are shared with a single team. Currently, the\nteam of a project template cannot be changed via the API."
}
],
"components": {
"parameters": {
"pretty": {
"name": "opt_pretty",
"in": "query",
"description": "Provides “pretty” output.\nProvides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.",
"required": false,
"allowEmptyValue": true,
"schema": {
"type": "boolean"
},
"style": "form",
"example": true
},
"project_template_path_gid": {
"name": "project_template_gid",
"in": "path",
"description": "Globally unique identifier for the project template.",
"required": true,
"schema": {
"type": "string"
},
"example": "1331",
"x-env-variable": "project_template"
}
},
"responses": {
"BadRequest": {
"description": "This usually occurs because of a missing or malformed parameter. Check the documentation and the syntax of your request and try again.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"Unauthorized": {
"description": "A valid authentication token was not provided with the request, so the API could not associate a user with the request.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"Forbidden": {
"description": "The authentication and request syntax was valid but the server is refusing to complete the request. This can happen if you try to read or write to objects or properties that the user does not have access to.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"NotFound": {
"description": "Either the request method and path supplied do not specify a known action in the API, or the object specified by the request does not exist.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"InternalServerError": {
"description": "There was a problem on Asana’s end. In the event of a server error the response body should contain an error phrase. These phrases can be used by Asana support to quickly look up the incident that caused the server error. Some errors are due to server load, and will not supply an error phrase.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
},
"schemas": {
"Error": {
"type": "object",
"properties": {
"message": {
"type": "string",
"readOnly": true,
"description": "Message providing more detail about the error that occurred, if available.",
"example": "project: Missing input"
},
"help": {
"type": "string",
"readOnly": true,
"description": "Additional information directing developers to resources on how to address and fix the problem, if available.",
"example": "For more information on API status codes and how to handle them, read the docs on errors: https://asana.github.io/developer-docs/#errors'"
},
"phrase": {
"type": "string",
"readOnly": true,
"description": "*500 errors only*. A unique error phrase which can be used when contacting developer support to help identify the exact occurrence of the problem in Asana's logs.",
"example": "6 sad squid snuggle softly"
}
}
},
"ErrorResponse": {
"description": "Sadly, sometimes requests to the API are not successful. Failures can\noccur for a wide range of reasons. In all cases, the API should return\nan HTTP Status Code that indicates the nature of the failure,\nwith a response body in JSON format containing additional information.\n\n\nIn the event of a server error the response body will contain an error\nphrase. These phrases are automatically generated using the\nnode-asana-phrase\nlibrary and can be used by\nAsana support to quickly look up the incident that caused the server\nerror.",
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"JobCompact": {
"description": "A *job* is an object representing a process that handles asynchronous work.",
"type": "object",
"properties": {
"gid": {
"description": "Globally unique identifier of the resource, as a string.",
"type": "string",
"readOnly": true,
"example": "12345",
"x-insert-after": false
},
"resource_type": {
"description": "The base type of this resource.",
"type": "string",
"readOnly": true,
"example": "job",
"x-insert-after": "gid"
},
"resource_subtype": {
"description": "The subtype of this resource. Different subtypes retain many of the same fields and behavior, but may render differently in Asana or represent resources with different semantic meaning.",
"type": "string",
"readOnly": true,
"example": "duplicate_task"
},
"status": {
"description": "The current status of this job.",
"type": "string",
"enum": [
"not_started",
"in_progress",
"succeeded",
"failed"
],
"readOnly": true,
"example": "in_progress"
},
"new_portfolio": {
"$ref": "#/components/schemas/PortfolioCompact"
},
"new_project": {
"$ref": "#/components/schemas/ProjectCompact"
},
"new_task": {
"allOf": [
{
"$ref": "#/components/schemas/TaskCompact"
},
{
"type": "object",
"nullable": true
}
]
},
"new_project_template": {
"$ref": "#/components/schemas/ProjectTemplateCompact"
},
"new_graph_export": {
"$ref": "#/components/schemas/GraphExportCompact"
},
"new_resource_export": {
"$ref": "#/components/schemas/ResourceExportCompact"
}
}
},
"PortfolioCompact": {
"description": "A *portfolio* gives a high-level overview of the status of multiple initiatives in Asana. Portfolios provide a dashboard overview of the state of multiple projects, including a progress report and the most recent [project status](/reference/project-statuses/project-statuses) update.\nPortfolios have some restrictions on size. Each portfolio has a max of 1500 items and, like projects, a max of 20 custom fields.",
"type": "object",
"properties": {
"gid": {
"description": "Globally unique identifier of the resource, as a string.",
"type": "string",
"readOnly": true,
"example": "12345",
"x-insert-after": false
},
"resource_type": {
"description": "The base type of this resource.",
"type": "string",
"readOnly": true,
"example": "portfolio",
"x-insert-after": "gid"
},
"name": {
"description": "The name of the portfolio.",
"type": "string",
"example": "Bug Portfolio"
}
}
},
"ProjectCompact": {
"description": "A *project* represents a prioritized list of tasks in Asana or a board with columns of tasks represented as cards. It exists in a single workspace or organization and is accessible to a subset of users in that workspace or organization, depending on its permissions.",
"type": "object",
"properties": {
"gid": {
"description": "Globally unique identifier of the resource, as a string.",
"type": "string",
"readOnly": true,
"example": "12345",
"x-insert-after": false
},
"resource_type": {
"description": "The base type of this resource.",
"type": "string",
"readOnly": true,
"example": "project",
"x-insert-after": "gid"
},
"name": {
"description": "Name of the project. This is generally a short sentence fragment that fits on a line in the UI for maximum readability. However, it can be longer.",
"type": "string",
"example": "Stuff to buy"
}
}
},
"ProjectTemplateCompact": {
"description": "A *project template* is an object that allows new projects to be created with a predefined setup, which may include tasks, sections, Rules, etc. It simplifies the process of running a workflow that involves a similar set of work every time.",
"type": "object",
"properties": {
"gid": {
"description": "Globally unique identifier of the resource, as a string.",
"type": "string",
"readOnly": true,
"example": "12345",
"x-insert-after": false
},
"resource_type": {
"description": "The base type of this resource.",
"type": "string",
"readOnly": true,
"example": "project_template",
"x-insert-after": "gid"
},
"name": {
"description": "Name of the project template.",
"type": "string",
"example": "Packing list"
}
}
},
"ProjectTemplateInstantiateProjectRequest": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"description": "The name of the new project.",
"type": "string",
"example": "New Project Name"
},
"team": {
"description": "*Optional*. Sets the team of the new project. If the project template exists in an _organization_, you may specify a value for `team`. If no value is provided then it defaults to the same team as the project template.",
"type": "string",
"example": "12345"
},
"public": {
"description": "*Deprecated:* new integrations use `privacy_setting` instead.",
"deprecated": true,
"type": "boolean",
"example": true
},
"privacy_setting": {
"description": "The privacy setting of the project. *Note: Administrators in your organization may restrict the values of `privacy_setting`.* The value `private_to_team` is deprecated. Use `POST /memberships` to share a project with a team after creation.",
"type": "string",
"enum": [
"public_to_workspace",
"private_to_team",
"private"
],
"example": "public_to_workspace"
},
"is_strict": {
"description": "*Optional*. If set to `true`, the endpoint returns an \"Unprocessable Entity\" error if you fail to provide a calendar date value for any date variable. If set to `false`, a default date is used for each unfulfilled date variable (e.g., the current date is used as the Start Date of a project).",
"type": "boolean",
"example": true
},
"requested_dates": {
"description": "*Conditional*. Array of mappings of date variables to calendar dates. This property is required in the instantiation request if the project template includes dates (e.g., a start date on a task).",
"type": "array",
"items": {
"$ref": "#/components/schemas/DateVariableRequest"
}
},
"requested_roles": {
"description": "Array of mappings of template roles to users.",
"type": "array",
"items": {
"$ref": "#/components/schemas/RequestedRoleRequest"
}
}
}
},
"DateVariableRequest": {
"type": "object",
"properties": {
"gid": {
"description": "Globally unique identifier of the date field in the project template. A value of `1` refers to the project start date, while `2` refers to the project due date.",
"type": "string",
"example": "1"
},
"value": {
"description": "The date with which the date variable should be replaced when instantiating a project. This takes a date with `YYYY-MM-DD` format.",
"type": "string",
"nullable": true,
"format": "date-time",
"example": "2022-01-01"
}
}
},
"RequestedRoleRequest": {
"type": "object",
"properties": {
"gid": {
"description": "Globally unique identifier of the template role in the project template.",
"type": "string",
"example": "1"
},
"value": {
"description": "A string identifying a user that should be assigned to the template role. This can either be the string \"me\", an email, or the gid of a user.",
"type": "string",
"example": "123"
}
}
},
"ResourceExportCompact": {
"description": "A *resource_export* object represents a request to bulk export objects for one or more resources.",
"type": "object",
"properties": {
"gid": {
"description": "Globally unique identifier of the resource, as a string.",
"type": "string",
"readOnly": true,
"example": "12345",
"x-insert-after": false
},
"resource_type": {
"description": "The base type of this resource.",
"type": "string",
"readOnly": true,
"example": "export_request",
"x-insert-after": "gid"
},
"created_at": {
"description": "The time at which the resource export object was created.",
"type": "string",
"format": "date-time",
"readOnly": true,
"example": "2012-02-22T02:06:58.147Z"
},
"download_url": {
"description": "Download this URL to retrieve the full export\nin JSON Lines format. It will be compressed in a gzip (.gz) container.\n\n*Note: May be null if the export is still in progress or failed.*",
"type": "string",
"format": "uri",
"readOnly": true,
"nullable": true,
"example": "https://asana-export-us-east-1.s3.us-east-1.amazonaws.com/2563645399633793/object_export/7588024658887731/download/ object_export_2563645399633793_7588024658887731_2023018-201726.jsonl.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256& X-Amz-Credential=xxxxxxxx&X-Amz-Date=xxxxxxxx&X-Amz-Expires=300&X-Amz-Security-Token=xxxxxxxx& X-Amz-Signature=xxxxxxxx&X-Amz-SignedHeaders=host"
},
"completed_at": {
"description": "The time at which this resource was completed. This will be null if the export is still in progress.",
"type": "string",
"format": "date-time",
"readOnly": true,
"example": "2012-02-22T03:06:58.147Z"
}
}
},
"GraphExportCompact": {
"description": "A *graph_export* object represents a request to export the data starting from a parent object",
"type": "object",
"properties": {
"gid": {
"description": "Globally unique identifier of the resource, as a string.",
"type": "string",
"readOnly": true,
"example": "12345",
"x-insert-after": false
},
"resource_type": {
"description": "The base type of this resource.",
"type": "string",
"readOnly": true,
"example": "graph_export",
"x-insert-after": "gid"
},
"created_at": {
"description": "The time at which this resource was created.",
"type": "string",
"format": "date-time",
"readOnly": true,
"example": "2012-02-22T02:06:58.147Z"
},
"download_url": {
"description": "Download this URL to retrieve the full export\nin JSON format. It will be compressed in a gzip (.gz) container.\n\n*Note: May be null if the export is still in progress or\nfailed. If present, this URL may only be valid for 1 hour from\nthe time of retrieval. You should avoid persisting this URL\nsomewhere and rather refresh on demand to ensure you do not keep\nstale URLs.*",
"type": "string",
"format": "uri",
"readOnly": true,
"nullable": true,
"example": "https://asana-export-us-east-1.s3.us-east-1.amazonaws.com/2563645399633793/domain_export/7588024658887731/download/ domain_export_2563645399633793_7588024658887731_2023018-201726.json.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256& X-Amz-Content-Sha256=xxxxxxxx&X-Amz-Date=xxxxxxxx&X-Amz-Expires=300&X-Amz-Security-Token=xxxxxxxx& X-Amz-Signature=xxxxxxxx&X-Amz-SignedHeaders=host&x-id=GetObject#_=_"
},
"completed_at": {
"description": "The time at which this resource was completed.",
"type": "string",
"format": "date-time",
"readOnly": true,
"example": "2012-02-22T03:06:58.147Z"
}
}
},
"TaskCompact": {
"description": "<p><strong}>Full object requires scope: </strong>tasks:read</p>\n\nThe *task* is the basic object around which many operations in Asana are centered.",
"type": "object",
"properties": {
"gid": {
"description": "Globally unique identifier of the resource, as a string.",
"type": "string",
"readOnly": true,
"example": "12345",
"x-insert-after": false
},
"resource_type": {
"description": "The base type of this resource.",
"type": "string",
"readOnly": true,
"example": "task",
"x-insert-after": "gid"
},
"name": {
"description": "The name of the task.",
"type": "string",
"example": "Bug Task"
},
"resource_subtype": {
"type": "string",
"description": "The subtype of this resource. Different subtypes retain many of the same fields and behavior, but may render differently in Asana or represent resources with different semantic meaning.\nThe resource_subtype `milestone` represent a single moment in time. This means tasks with this subtype cannot have a start_date.",
"enum": [
"default_task",
"milestone",
"approval",
"custom"
],
"example": "default_task"
},
"created_by": {
"type": "object",
"readOnly": true,
"description": "[Opt In](/guides/platform/inputoutput-options). A *user* object represents an account in Asana that can be given access to various workspaces, projects, and tasks.",
"properties": {
"gid": {
"description": "Globally unique identifier of the resource.",
"type": "string",
"example": "1111"
},
"resource_type": {
"description": "The type of resource.",
"type": "string",
"example": "user"
}
}
}
}
}
},
"securitySchemes": {
"personalAccessToken": {
"type": "http",
"description": "A personal access token allows access to the api for the user who created it. This should be kept a secret and be treated like a password.",
"scheme": "bearer"
},
"oauth2": {
"type": "oauth2",
"description": "We require that applications designed to access the Asana API on behalf of multiple users implement OAuth 2.0.\nAsana supports the Authorization Code Grant flow.",
"flows": {
"authorizationCode": {
"authorizationUrl": "https://app.asana.com/-/oauth_authorize",
"tokenUrl": "https://app.asana.com/-/oauth_token",
"refreshUrl": "https://app.asana.com/-/oauth_token",
"scopes": {
"default": "Provides access to all endpoints documented in our API reference. If no scopes are requested, this scope is assumed by default.",
"openid": "Provides access to OpenID Connect ID tokens and the OpenID Connect user info endpoint.",
"email": "Provides access to the user’s email through the OpenID Connect user info endpoint.",
"profile": "Provides access to the user’s name and profile photo through the OpenID Connect user info endpoint.",
"attachments:read": "View access to attachments",
"attachments:write": "Create and modify access to attachments",
"attachments:delete": "Delete access to attachments",
"custom_fields:read": "View access to custom fields",
"custom_fields:write": "Create and modify access to custom fields",
"goals:read": "View access to goals",
"jobs:read": "View access to jobs",
"ooo_entries:read": "View access to OOO entries",
"ooo_entries:write": "Create and modify access to OOO entries",
"ooo_entries:delete": "Delete access to OOO entries",
"tasks:read": "View access to tasks",
"tasks:write": "Create and modify access to tasks",
"tasks:delete": "Delete access to tasks",
"task_custom_types:read": "View access to task custom types",
"task_templates:read": "View access to task templates",
"team_memberships:read": "View access to team memberships",
"portfolios:read": "View access to portfolios",
"portfolios:write": "Create and modify access to portfolios",
"project_templates:read": "View access to project templates",
"project_portfolio_settings:read": "View access to project portfolio settings",
"project_portfolio_settings:write": "Create and modify access to project portfolio settings",
"projects:delete": "Delete access to projects",
"projects:read": "View access to projects",
"projects:write": "Create and modify access to projects",
"roles:read": "View access to roles",
"roles:write": "Create and modify access to roles",
"roles:delete": "Delete access to roles",
"users:read": "View access to users",
"teams:read": "View access to teams",
"time_tracking_categories:read": "View access to time tracking categories",
"time_tracking_categories:write": "Create and modify access to time tracking categories",
"time_tracking_categories:delete": "Delete access to time tracking categories",
"time_tracking_entries:read": "View access to time tracking entries",
"timesheet_approval_statuses:read": "View access to timesheet approval statuses",
"timesheet_approval_statuses:write": "Create and modify access to timesheet approval statuses",
"stories:read": "View access to stories",
"stories:write": "Create and modify access to stories",
"tags:read": "View access to tags",
"tags:write": "Create and modify access to tags",
"webhooks:read": "View access to webhooks",
"webhooks:write": "Create and modify access to webhooks",
"webhooks:delete": "Delete access to webhooks",
"workspaces:read": "View access to workspaces"
}
}
}
}
}
},
"paths": {
"/project_templates/{project_template_gid}/instantiateProject": {
"parameters": [
{
"$ref": "#/components/parameters/project_template_path_gid"
},
{
"$ref": "#/components/parameters/pretty"
}
],
"post": {
"summary": "Instantiate a project from a project template",
"description": "<b>Required scope: </b>projects:write\n\nCreates and returns a job that will asynchronously handle the project instantiation.\n\nTo form this request, it is recommended to first make a request to [get a project template](/reference/project-templates/getprojecttemplate). Then, from the response, copy the `gid` from the object in the `requested_dates` array. This `gid` should be used in `requested_dates` to instantiate a project.\n\n_Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the [is_organization](/reference/workspaces/workspaces) parameter._",
"tags": [
"Project templates"
],
"operationId": "instantiateProject",
"parameters": [
{
"name": "opt_fields",
"in": "query",
"description": "This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.",
"required": false,
"example": [
"new_graph_export",
"new_graph_export.completed_at",
"new_graph_export.created_at",
"new_graph_export.download_url",
"new_portfolio",
"new_portfolio.name",
"new_project",
"new_project.name",
"new_project_template",
"new_project_template.name",
"new_resource_export",
"new_resource_export.completed_at",
"new_resource_export.created_at",
"new_resource_export.download_url",
"new_task",
"new_task.created_by",
"new_task.name",
"new_task.resource_subtype",
"resource_subtype",
"status"
],
"schema": {
"type": "array",
"items": {
"type": "string",
"enum": [
"new_graph_export",
"new_graph_export.completed_at",
"new_graph_export.created_at",
"new_graph_export.download_url",
"new_portfolio",
"new_portfolio.name",
"new_project",
"new_project.name",
"new_project_template",
"new_project_template.name",
"new_resource_export",
"new_resource_export.completed_at",
"new_resource_export.created_at",
"new_resource_export.download_url",
"new_task",
"new_task.created_by",
"new_task.name",
"new_task.resource_subtype",
"resource_subtype",
"status"
]
}
},
"style": "form",
"explode": false
}
],
"requestBody": {
"description": "Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/ProjectTemplateInstantiateProjectRequest"
}
}
}
}
}
},
"responses": {
"201": {
"description": "Successfully created the job to handle project instantiation.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/JobCompact"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
}
},
"security": [
{
"personalAccessToken": []
},
{
"oauth2": [
"projects:write"
]
}
],
"x-readme": {
"code-samples": [
{
"language": "java",
"install": "<dependency><groupId>com.asana</groupId><artifactId>asana</artifactId><version>1.0.0</version></dependency>",
"code": "import com.asana.Client;\n\nClient client = Client.accessToken(\"PERSONAL_ACCESS_TOKEN\");\n\nJob result = client.projecttemplates.instantiateProject(projectTemplateGid)\n .data(\"field\", \"value\")\n .data(\"field\", \"value\")\n .option(\"pretty\", true)\n .execute();"
},
{
"language": "node",
"install": "npm install asana",
"code": "const Asana = require('asana');\n\nlet client = new Asana.ApiClient();\nclient.authentications.token.accessToken = '<YOUR_ACCESS_TOKEN>';\n\nlet projectTemplatesApiInstance = new Asana.ProjectTemplatesApi(client);\nlet project_template_gid = \"1331\"; // String | Globally unique identifier for the project template.\nlet opts = { \n 'body': {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}}, \n 'opt_fields': \"new_graph_export,new_graph_export.completed_at,new_graph_export.created_at,new_graph_export.download_url,new_portfolio,new_portfolio.name,new_project,new_project.name,new_project_template,new_project_template.name,new_resource_export,new_resource_export.completed_at,new_resource_export.created_at,new_resource_export.download_url,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status\"\n};\nprojectTemplatesApiInstance.instantiateProject(project_template_gid, opts).then((result) => {\n console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));\n}, (error) => {\n console.error(error.response.body);\n});",
"name": "node-sdk-v3"
},
{
"language": "node",
"install": "npm install asana@1.0.5",
"code": "const asana = require('asana');\n\nconst client = asana.Client.create().useAccessToken('PERSONAL_ACCESS_TOKEN');\n\nclient.projecttemplates.instantiateProject(projectTemplateGid, {field: \"value\", field: \"value\", pretty: true})\n .then((result) => {\n console.log(result);\n });",
"name": "node-sdk-v1"
},
{
"language": "python",
"install": "pip install asana",
"code": "import asana\nfrom asana.rest import ApiException\nfrom pprint import pprint\n\nconfiguration = asana.Configuration()\nconfiguration.access_token = '<YOUR_ACCESS_TOKEN>'\napi_client = asana.ApiClient(configuration)\n\n# create an instance of the API class\nproject_templates_api_instance = asana.ProjectTemplatesApi(api_client)\nproject_template_gid = \"1331\" # str | Globally unique identifier for the project template.\nopts = {\n 'body': {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}}, # dict | Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables.\n 'opt_fields': \"new_graph_export,new_graph_export.completed_at,new_graph_export.created_at,new_graph_export.download_url,new_portfolio,new_portfolio.name,new_project,new_project.name,new_project_template,new_project_template.name,new_resource_export,new_resource_export.completed_at,new_resource_export.created_at,new_resource_export.download_url,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status\", # list[str] | This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.\n}\n\ntry:\n # Instantiate a project from a project template\n api_response = project_templates_api_instance.instantiate_project(project_template_gid, opts)\n pprint(api_response)\nexcept ApiException as e:\n print(\"Exception when calling ProjectTemplatesApi->instantiate_project: %s\\n\" % e)",
"name": "python-sdk-v5"
},
{
"language": "python",
"install": "pip install asana==3.2.3",
"code": "import asana\n\nclient = asana.Client.access_token('PERSONAL_ACCESS_TOKEN')\n\nresult = client.project_templates.instantiate_project(project_template_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True)",
"name": "python-sdk-v3"
},
{
"language": "php",
"install": "composer require asana/asana",
"code": "<?php\nrequire 'vendor/autoload.php';\n\n$client = Asana\\Client::accessToken('PERSONAL_ACCESS_TOKEN');\n\n$result = $client->projecttemplates->instantiateProject($project_template_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true'))"
},
{
"language": "ruby",
"install": "gem install asana",
"code": "require 'asana'\n\nclient = Asana::Client.new do |c|\n c.authentication :access_token, 'PERSONAL_ACCESS_TOKEN'\nend\n\nresult = client.project_templates.instantiate_project(project_template_gid: 'project_template_gid', field: \"value\", field: \"value\", options: {pretty: true})"
}
]
}
}
}
}
}