openapi: 3.1.0
info:
title: Asana Allocations Goals API
description: The Asana Allocations API allows users to manage and allocate resources within their Asana project management system. An allocation object represents how much of a resource (e.g. person, team) is dedicated to a specific work object (e.g. project, portfolio) over a specific period of time. The effort value can be a percentage or number of hours.
version: '1.0'
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
servers:
- url: https://app.asana.com/api/1.0
description: Main endpoint.
security:
- personalAccessToken: []
- oauth2: []
tags:
- name: Goals
description: Manage goals in the goal-tracking system.
paths:
/goals:
parameters:
- $ref: '#/components/parameters/pretty'
get:
summary: Asana Get goals
description: Returns compact goal records.
operationId: getGoals
tags:
- Goals
parameters:
- name: workspace
in: query
required: false
schema:
type: string
- name: team
in: query
required: false
schema:
type: string
- name: project
in: query
required: false
schema:
type: string
- name: is_workspace_level
in: query
required: false
schema:
type: boolean
- name: time_periods
in: query
required: false
schema:
type: array
items:
type: string
- name: limit
in: query
schema:
type: integer
minimum: 1
maximum: 100
- name: offset
in: query
schema:
type: string
responses:
'200':
description: Successfully retrieved the requested goals.
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/GoalCompact'
'400':
description: Bad request.
'401':
description: Unauthorized.
'403':
description: Forbidden.
'500':
description: Internal server error.
post:
summary: Asana Create a goal
description: Creates a new goal in a workspace.
operationId: createGoal
tags:
- Goals
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/GoalRequest'
responses:
'201':
description: Successfully created a new goal.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/GoalResponse'
'400':
description: Bad request.
'401':
description: Unauthorized.
'403':
description: Forbidden.
'500':
description: Internal server error.
/goals/{goal_gid}:
parameters:
- $ref: '#/components/parameters/goal_path_gid'
- $ref: '#/components/parameters/pretty'
get:
summary: Asana Get a goal
description: Returns the complete goal record for a single goal.
operationId: getGoal
tags:
- Goals
parameters:
- name: goal_gid
in: path
required: true
schema:
type: string
example: '12345'
responses:
'200':
description: Successfully retrieved the record for a single goal.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/GoalResponse'
'400':
description: Bad request.
'401':
description: Unauthorized.
'403':
description: Forbidden.
'404':
description: Not found.
'500':
description: Internal server error.
put:
summary: Asana Update a goal
description: Updates an existing goal.
operationId: updateGoal
tags:
- Goals
parameters:
- name: goal_gid
in: path
required: true
schema:
type: string
example: '12345'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/GoalRequest'
responses:
'200':
description: Successfully updated the goal.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/GoalResponse'
'400':
description: Bad request.
'401':
description: Unauthorized.
'403':
description: Forbidden.
'404':
description: Not found.
'500':
description: Internal server error.
delete:
summary: Asana Delete a goal
description: Deletes a specific, existing goal.
operationId: deleteGoal
tags:
- Goals
parameters:
- name: goal_gid
in: path
required: true
schema:
type: string
example: '12345'
responses:
'200':
description: Successfully deleted the goal.
content:
application/json:
schema:
type: object
properties:
data:
type: object
'400':
description: Bad request.
'401':
description: Unauthorized.
'403':
description: Forbidden.
'404':
description: Not found.
'500':
description: Internal server error.
/goals/{goal_gid}/addFollowers:
parameters:
- $ref: '#/components/parameters/goal_path_gid'
- $ref: '#/components/parameters/pretty'
post:
summary: Asana Add a collaborator to a goal
description: Adds followers to a goal.
operationId: addFollowersForGoal
tags:
- Goals
parameters:
- name: goal_gid
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
followers:
type: array
items:
type: string
responses:
'200':
description: Successfully added followers to the goal.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/GoalResponse'
'400':
description: Bad request.
'401':
description: Unauthorized.
'403':
description: Forbidden.
'404':
description: Not found.
'500':
description: Internal server error.
/goals/{goal_gid}/removeFollowers:
parameters:
- $ref: '#/components/parameters/goal_path_gid'
- $ref: '#/components/parameters/pretty'
post:
summary: Asana Remove a collaborator from a goal
description: Removes followers from a goal.
operationId: removeFollowersForGoal
tags:
- Goals
parameters:
- name: goal_gid
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
followers:
type: array
items:
type: string
responses:
'200':
description: Successfully removed followers from the goal.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/GoalResponse'
'400':
description: Bad request.
'401':
description: Unauthorized.
'403':
description: Forbidden.
'404':
description: Not found.
'500':
description: Internal server error.
/goals/{goal_gid}/parentGoals:
parameters:
- $ref: '#/components/parameters/goal_path_gid'
- $ref: '#/components/parameters/pretty'
get:
summary: Asana Get parent goals from a goal
description: Returns a compact representation of all parent goals of a goal.
operationId: getParentGoalsForGoal
tags:
- Goals
parameters:
- name: goal_gid
in: path
required: true
schema:
type: string
responses:
'200':
description: Successfully retrieved the parent goals.
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/GoalCompact'
'400':
description: Bad request.
'401':
description: Unauthorized.
'403':
description: Forbidden.
'404':
description: Not found.
'500':
description: Internal server error.
/goals/{goal_gid}/setMetric:
parameters:
- $ref: '#/components/parameters/goal_path_gid'
- $ref: '#/components/parameters/pretty'
post:
summary: Asana Create a goal metric
description: Creates and adds a goal metric to a specified goal. Note that this replaces an existing goal metric if one already exists.
tags:
- Goals
operationId: createGoalMetric
parameters:
- name: opt_fields
in: query
description: This endpoint returns a compact 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:
- current_status_update
- current_status_update.resource_subtype
- current_status_update.title
- due_on
- followers
- followers.name
- html_notes
- is_workspace_level
- liked
- likes
- likes.user
- likes.user.name
- metric
- metric.can_manage
- metric.currency_code
- metric.current_display_value
- metric.current_number_value
- metric.initial_number_value
- metric.is_custom_weight
- metric.precision
- metric.progress_source
- metric.resource_subtype
- metric.target_number_value
- metric.unit
- name
- notes
- num_likes
- owner
- owner.name
- start_on
- status
- team
- team.name
- time_period
- time_period.display_name
- time_period.end_on
- time_period.period
- time_period.start_on
- workspace
- workspace.name
schema:
type: array
items:
type: string
enum:
- current_status_update
- current_status_update.resource_subtype
- current_status_update.title
- due_on
- followers
- followers.name
- html_notes
- is_workspace_level
- liked
- likes
- likes.user
- likes.user.name
- metric
- metric.can_manage
- metric.currency_code
- metric.current_display_value
- metric.current_number_value
- metric.initial_number_value
- metric.is_custom_weight
- metric.precision
- metric.progress_source
- metric.resource_subtype
- metric.target_number_value
- metric.unit
- name
- notes
- num_likes
- owner
- owner.name
- start_on
- status
- team
- team.name
- time_period
- time_period.display_name
- time_period.end_on
- time_period.period
- time_period.start_on
- workspace
- workspace.name
style: form
explode: false
requestBody:
description: The goal metric to create.
required: true
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/GoalMetricRequest'
responses:
200:
description: Successfully created a new goal metric.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/GoalResponse_2'
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
402:
$ref: '#/components/responses/PaymentRequired'
403:
$ref: '#/components/responses/Forbidden'
404:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/InternalServerError'
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\nJsonElement result = client.goals.createGoalMetric(goalGid)\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 = Asana.ApiClient.instance;\nlet token = client.authentications['token'];\ntoken.accessToken = '<YOUR_ACCESS_TOKEN>';\n\nlet goalsApiInstance = new Asana.GoalsApi();\nlet body = {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}}; // Object | The goal metric to create.\nlet goal_gid = \"12345\"; // String | Globally unique identifier for the goal.\nlet opts = { \n 'opt_fields': \"current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.is_custom_weight,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name\"\n};\ngoalsApiInstance.createGoalMetric(body, goal_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.goals.createGoalMetric(goalGid, {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\ngoals_api_instance = asana.GoalsApi(api_client)\nbody = {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}} # dict | The goal metric to create.\ngoal_gid = \"12345\" # str | Globally unique identifier for the goal.\nopts = {\n 'opt_fields': \"current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.is_custom_weight,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name\", # list[str] | This endpoint returns a compact 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 # Create a goal metric\n api_response = goals_api_instance.create_goal_metric(body, goal_gid, opts)\n pprint(api_response)\nexcept ApiException as e:\n print(\"Exception when calling GoalsApi->create_goal_metric: %s\\n\" % e)"
name: python-sdk-v5
- language: python
install: pip install asana==3.2.3
code: 'import asana
client = asana.Client.access_token(''PERSONAL_ACCESS_TOKEN'')
result = client.goals.create_goal_metric(goal_gid, {''field'': ''value'', ''field'': ''value''}, opt_pretty=True)'
name: python-sdk-v3
- language: php
install: composer require asana/asana
code: '<?php
require ''vendor/autoload.php'';
$client = Asana\Client::accessToken(''PERSONAL_ACCESS_TOKEN'');
$result = $client->goals->createGoalMetric($goal_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.goals.create_goal_metric(goal_gid: 'goal_gid', field: \"value\", field: \"value\", options: {pretty: true})"
/goals/{goal_gid}/setMetricCurrentValue:
parameters:
- $ref: '#/components/parameters/goal_path_gid'
- $ref: '#/components/parameters/pretty'
post:
summary: Asana Update a goal metric
description: 'Updates a goal''s existing metric''s `current_number_value` if one exists,
otherwise responds with a 400 status code.
Returns the complete updated goal metric record.'
tags:
- Goals
operationId: updateGoalMetric
parameters:
- name: opt_fields
in: query
description: This endpoint returns a compact 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:
- current_status_update
- current_status_update.resource_subtype
- current_status_update.title
- due_on
- followers
- followers.name
- html_notes
- is_workspace_level
- liked
- likes
- likes.user
- likes.user.name
- metric
- metric.can_manage
- metric.currency_code
- metric.current_display_value
- metric.current_number_value
- metric.initial_number_value
- metric.is_custom_weight
- metric.precision
- metric.progress_source
- metric.resource_subtype
- metric.target_number_value
- metric.unit
- name
- notes
- num_likes
- owner
- owner.name
- start_on
- status
- team
- team.name
- time_period
- time_period.display_name
- time_period.end_on
- time_period.period
- time_period.start_on
- workspace
- workspace.name
schema:
type: array
items:
type: string
enum:
- current_status_update
- current_status_update.resource_subtype
- current_status_update.title
- due_on
- followers
- followers.name
- html_notes
- is_workspace_level
- liked
- likes
- likes.user
- likes.user.name
- metric
- metric.can_manage
- metric.currency_code
- metric.current_display_value
- metric.current_number_value
- metric.initial_number_value
- metric.is_custom_weight
- metric.precision
- metric.progress_source
- metric.resource_subtype
- metric.target_number_value
- metric.unit
- name
- notes
- num_likes
- owner
- owner.name
- start_on
- status
- team
- team.name
- time_period
- time_period.display_name
- time_period.end_on
- time_period.period
- time_period.start_on
- workspace
- workspace.name
style: form
explode: false
requestBody:
description: The updated fields for the goal metric.
required: true
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/GoalMetricCurrentValueRequest'
responses:
200:
description: Successfully updated the goal metric.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/GoalResponse_2'
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
402:
$ref: '#/components/responses/PaymentRequired'
403:
$ref: '#/components/responses/Forbidden'
404:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/InternalServerError'
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\nJsonElement result = client.goals.updateGoalMetric(goalGid)\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 = Asana.ApiClient.instance;\nlet token = client.authentications['token'];\ntoken.accessToken = '<YOUR_ACCESS_TOKEN>';\n\nlet goalsApiInstance = new Asana.GoalsApi();\nlet body = {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}}; // Object | The updated fields for the goal metric.\nlet goal_gid = \"12345\"; // String | Globally unique identifier for the goal.\nlet opts = { \n 'opt_fields': \"current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.is_custom_weight,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name\"\n};\ngoalsApiInstance.updateGoalMetric(body, goal_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.goals.updateGoalMetric(goalGid, {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\ngoals_api_instance = asana.GoalsApi(api_client)\nbody = {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}} # dict | The updated fields for the goal metric.\ngoal_gid = \"12345\" # str | Globally unique identifier for the goal.\nopts = {\n 'opt_fields': \"current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.is_custom_weight,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name\", # list[str] | This endpoint returns a compact 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 # Update a goal metric\n api_response = goals_api_instance.update_goal_metric(body, goal_gid, opts)\n pprint(api_response)\nexcept ApiException as e:\n print(\"Exception when calling GoalsApi->update_goal_metric: %s\\n\" % e)"
name: python-sdk-v5
- language: python
install: pip install asana==3.2.3
code: 'import asana
client = asana.Client.access_token(''PERSONAL_ACCESS_TOKEN'')
result = client.goals.update_goal_metric(goal_gid, {''field'': ''value'', ''field'': ''value''}, opt_pretty=True)'
name: python-sdk-v3
- language: php
install: composer require asana/asana
code: '<?php
require ''vendor/autoload.php'';
$client = Asana\Client::accessToken(''PERSONAL_ACCESS_TOKEN'');
$result = $client->goals->updateGoalMetric($goal_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.goals.update_goal_metric(goal_gid: 'goal_gid', field: \"value\", field: \"value\", options: {pretty: true})"
components:
schemas:
GoalMetricCurrentValueRequest:
description: A generic Asana Resource, containing a globally unique identifier.
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
current_number_value:
description: '*Conditional*. This number is the current value of a goal metric of type number.'
type: number
example: 8.12
UserCompact:
description: A *user* object represents an account in Asana that can be given access to various workspaces, projects, and tasks.
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: user
x-insert-after: gid
name:
type: string
description: '*Read-only except when same user as requester*. The user’s name.'
example: Greg Sanchez
WorkspaceCompact:
description: A *workspace* is the highest-level organizational unit in Asana. All projects and tasks have an associated workspace.
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: workspace
x-insert-after: gid
name:
description: The name of the workspace.
type: string
example: My Company Workspace
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
GoalResponse:
type: object
properties:
gid:
type: string
readOnly: true
example: '12345'
resource_type:
type: string
readOnly: true
example: goal
name:
type: string
example: Grow web traffic by 30%
owner:
type: object
properties:
gid:
type: string
resource_type:
type: string
name:
type: string
notes:
type: string
html_notes:
type: string
due_on:
type: string
format: date
nullable: true
start_on:
type: string
format: date
nullable: true
status:
type: string
liked:
type: boolean
num_likes:
type: integer
# --- truncated at 32 KB (50 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/asana/refs/heads/main/openapi/asana-goals-api-openapi.yml