Custom Fields

Custom Fields store the metadata that is used in order to add user-specified information to tasks in Asana. Be sure to reference the Custom Fields developer documentation for more information about how custom fields relate to various resources in Asana.

Users in Asana can lock custom fields, which will make them read-only when accessed by other users. Attempting to edit a locked custom field will return HTTP error code 403 Forbidden.

Custom Fields have the following fields:
Field Description
id 1234 Read-only. Globally unique ID of the custom field. Note: This field is under active migration to the gid field—please see our blog post for more information.
gid "1234" Read-only. Globally unique ID of the custom field.
resource_type "custom_field" Read-only. The resource type of this resource. The value for this resource is always custom_field.
resource_subtype "text" "number" "enum" Create-only. The type of custom field. Must be one of the given values.
name 'Priority' The name of the custom field.
description 'Development team priority' The description of the custom field.
type 'text' 'enum' 'number' Create-only. Deprecated: new integrations should prefer the resource_subtype field. The type of the custom field. Must be one of the given values.
enum_options [ { id: 789, gid: "789", name: 'Low', enabled: 'true', color: 'blue' }, ... ] Read-only. Only relevant for custom fields of type ‘enum’. This array specifies the possible values which an enum custom field can adopt. To modify the enum options, refer to working with enum options.
precision 2 Only relevant for custom fields of type ‘Number’. This field dictates the number of places after the decimal to round to, i.e. 0 is integer values, 1 rounds to the nearest tenth, and so on. Must be between 0 and 6, inclusive.

TYPE-SPECIFIC CUSTOM FIELD INFORMATION Since custom fields can be defined for one of a number of types, and these types have different data and behaviors, there are fields that are relevant to a particular type. For instance, as noted above, enum_options is only relevant for the enum type and defines the set of choices that the enum could represent. The examples below show some of these type-specific custom field definitions.

Get the metadata for a custom field of type ‘text’

# Request
curl -H "Authorization: Bearer <personal_access_token>" \
https://app.asana.com/api/1.0/custom_fields/124578

# Response
HTTP/1.1 200
{
  "data": [
    {
      "id": 134679,
      "gid": "134679",
      "name": "Owner",
      "resource_type": "custom_field",
      "resource_subtype": "text",
      "description": "Person responsible for task",
      "type": "text"
    }
  ]
}

Get the metadata for a custom field of type ‘number’

# Request
curl -H "Authorization: Bearer <personal_access_token>" \
https://app.asana.com/api/1.0/custom_fields/124578

# Response
HTTP/1.1 200
{
  "data": [
    {
      "id": 938271,
      "gid": "938271",
      "resource_type": "custom_field",
      "resource_subtype": "number",
      "name": "Price",
      "description": "In US Dollars",
      "type": "number",
      "precision": 2
    }
  ]
}

Get the metadata for a custom field when that field is of type ‘enum’.

# Request
curl -H "Authorization: Bearer <personal_access_token>" \
https://app.asana.com/api/1.0/custom_fields/124578

# Response
HTTP/1.1 200
{
  "data": [
    {
      "id": 124578,
      "gid": "124578",
      "resource_type": "custom_field",
      "resource_subtype": "enum",
      "name": "Priority",
      "description": "Development team priority",
      "enum_options": [
        {
          "id": 789,
          "gid": "789",
          "name": "Low",
          "enabled": true,
          "color": "blue",
          "resource_type": "enum_option"
        },
        {
          "id": 208,
          "gid": "208",
          "name": "Medium",
          "enabled": false,
          "color": "yellow",
          "resource_type": "enum_option"
        },
        {
          "id": 439,
          "gid": "439",
          "name": "High",
          "enabled": true,
          "color": "red",
          "resource_type": "enum_option"
        }
      ]
    }
  ]
}

GET A CUSTOM FIELD

GET    /custom_fields/{custom_field_gid}

Returns the complete definition of a custom field’s metadata.

Parameter Description
custom_field_gid "124578" Required: Globally unique identifier for the custom field.

QUERY FOR CUSTOM FIELDS

GET    /workspaces/{workspace_gid}/custom_fields

Returns a list of the compact representation of all of the custom fields in a workspace.

Parameter Description
workspace_gid "1331" Required: The workspace or organization to find custom field definitions in.
# Request
curl -H "Authorization: Bearer <personal_access_token>" \
https://app.asana.com/api/1.0/workspaces/14916/custom_fields

# Response
HTTP/1.1 200
{
  "data": [
    {
      "id": 124578,
      "gid": "124578",
      "resource_type": "custom_field",
      "resource_subtype": "enum",
      "name": "Priority",
      "type": "enum"
    },
    {
      "id": 134679,
      "gid": "134679",
      "resource_type": "custom_field",
      "resource_subtype": "enum",
      "name": "Owner",
      "type": "text"
    },
    "~..."
  ]
}

CREATE A CUSTOM FIELD

POST    /custom_fields

Creates a new custom field in a workspace. Every custom field is required to be created in a specific workspace, and this workspace cannot be changed once set.

A custom field’s name must be unique within a workspace and not conflict with names of existing task properties such as ‘Due Date’ or ‘Assignee’. A custom field’s type must be one of ‘text’, ‘enum’, or ‘number’.

Returns the full record of the newly created custom field.

Parameter Description
workspace "1331" Required: The workspace to create a custom field in.
resource_subtype 'text' 'enum' 'number' Required: The type of the custom field. Must be one of the given values.
type 'text' 'enum' 'number' Deprecated. New integrations should prefer the resource_subtype parameter.
name 'Priority' Required: The name of the custom field.
description 'Development team priority' The description of the custom field.
precision 2 The number of decimal places for the numerical values. Required if the custom field is of type ‘number’.
enum_options [ { name: 'Low', color: 'blue' }, { name: 'Medium', color: 'yellow' }, { name: 'High', color: 'red' } ] The discrete values the custom field can assume. Required if the custom field is of type ‘enum’.

Create a custom field of type ‘text’

# Request
curl -H "Authorization: Bearer <personal_access_token>" \
https://app.asana.com/api/1.0/custom_fields \
--data-urlencode "name=Owner" \
--data-urlencode "resource_subtype=text" \
--data-urlencode "description=Person responsible for task" \
--data-urlencode "workspace=14916"

# Response
HTTP/1.1 201
{
  "data": [
    {
      "id": 134679,
      "gid": "134679",
      "resource_type": "custom_field",
      "resource_subtype": "text",
      "type": "text",
      "name": "Owner",
      "description": "Person responsible for task"
    }
  ]
}

Create a custom field of type ‘number’

# Request
curl -H "Authorization: Bearer <personal_access_token>" \
https://app.asana.com/api/1.0/custom_fields \
--data-urlencode "name=Price" \
--data-urlencode "description=In US Dollars" \
--data-urlencode "resource_subtype=number" \
--data-urlencode "precision=2" \
--data-urlencode "workspace=14916"

# Response
HTTP/1.1 201
{
  "data": [
    {
      "id": 938271,
      "gid": "938271",
      "resource_type": "custom_field",
      "resource_subtype": "number",
      "type": "number",
      "name": "Price",
      "description": "In US Dollars",
      "precision": 2
    }
  ]
}

Create a custom field of type ‘enum’

# Request
curl -H "Authorization: Bearer <personal_access_token>" \
https://app.asana.com/api/1.0/custom_fields \
--data-urlencode "name=Priority" \
--data-urlencode "resource_type=custom_field" \
--data-urlencode "resource_subtype=enum" \
--data-urlencode "description=Development team priority" \
--data-urlencode "workspace=14916" \
--data-urlencode "enum_options[0].name=Low" \
--data-urlencode "enum_options[0].color=blue" \
--data-urlencode "enum_options[1].name=Medium" \
--data-urlencode "enum_options[1].color=yellow" \
--data-urlencode "enum_options[2].name=High" \
--data-urlencode "enum_options[2].color=red"

# Response
HTTP/1.1 201
{
  "data": [
    {
      "id": 124578,
      "gid": "124578",
      "name": "Priority",
      "description": "Development team priority",
      "resource_type": "custom_field",
      "resource_subtype": "enum",
      "type": "enum",
      "enum_options": [
        {
          "id": 789,
          "gid": "789",
          "name": "Low",
          "enabled": true,
          "color": "blue",
          "resource_type": "enum_option"
        },
        {
          "id": 790,
          "gid": "790",
          "name": "Medium",
          "enabled": true,
          "color": "yellow",
          "resource_type": "enum_option"
        },
        {
          "id": 791,
          "gid": "791",
          "name": "High",
          "enabled": true,
          "color": "red",
          "resource_type": "enum_option"
        }
      ]
    }
  ]
}

UPDATE A CUSTOM FIELD

PUT    /custom_fields/{custom_field_gid}

A specific, existing custom field can be updated by making a PUT request on the URL for that custom field. Only the fields provided in the data block will be updated; any unspecified fields will remain unchanged

When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the custom field.

An enum custom field’s enum_options cannot be updated with this endpoint. Instead see “Work With Enum Options” for information on how to update enum_options.

Locked custom fields can only be updated by the user who locked the field.

Returns the complete updated custom field record.

Parameter Description
custom_field_gid "124578" Required: Globally unique identifier for the custom field.

DELETE A CUSTOM FIELD

DELETE    /custom_fields/{custom_field_gid}

A specific, existing custom field can be deleted by making a DELETE request on the URL for that custom field.

Locked custom fields can only be deleted by the user who locked the field.

Returns an empty data record.

Parameter Description
custom_field_gid "124578" Required: Globally unique identifier for the custom field.

WORKING WITH CUSTOM FIELD ENUM OPTIONS Enum options are the possible values which an enum custom field can adopt. An enum custom field must contain at least 1 enum option but no more than 50.

You can add enum options to a custom field by using the POST /custom_fields/custom-field-id/enum_options endpoint.

It is not possible to remove or delete an enum option. Instead, enum options can be disabled by updating the enabled field to false with the PUT /enum_options/enum_option-id endpoint. Other attributes can be updated similarly.

On creation of an enum option, enabled is always set to true, meaning the enum option is a selectable value for the custom field. Setting enabled=false is equivalent to “trashing” the enum option in the Asana web app within the “Edit Fields” dialog. The enum option will no longer be selectable but, if the enum option value was previously set within a task, the task will retain the value.

Enum options are an ordered list and by default new enum options are inserted at the end. Ordering in relation to existing enum options can be specified on creation by using insert_before or insert_after to reference an existing enum option. Only one of insert_before and insert_after can be provided when creating a new enum option.

An enum options list can be reordered with the POST /custom_fields/custom-field-id/enum_options/insert endpoint.

ADD A NEW ENUM OPTION

POST    /custom_fields/{custom_field_gid}/enum_options

Creates an enum option and adds it to this custom field’s list of enum options. A custom field can have at most 50 enum options (including disabled options). By default new enum options are inserted at the end of a custom field’s list.

Locked custom fields can only have enum options added by the user who locked the field.

Returns the full record of the newly created enum option.

Parameter Description
custom_field_gid "124578" Required: Globally unique identifier for the custom field.
name 'High' 'Low' Required: The name of the enum option.
color 'red' 'blue' The color of the enum option. Defaults to ‘none’.
insert_before "12345" An existing enum option within this custom field before which the new enum option should be inserted. Cannot be provided together with after_enum_option.
insert_after "12345" An existing enum option within this custom field after which the new enum option should be inserted. Cannot be provided together with before_enum_option.

UPDATE AN EXISTING ENUM OPTION

PUT    /enum_options/{enum_option_gid}

Updates an existing enum option. Enum custom fields require at least one enabled enum option.

Locked custom fields can only be updated by the user who locked the field.

Returns the full record of the updated enum option.

Parameter Description
enum_option_gid "97285" Required: Globally unique identifier for the enum option.
name 'High' 'Low' Required: The name of the enum option.
color 'red' 'blue' The color of the enum option. Defaults to ‘none’.
enabled false Whether or not the enum option is a selectable value for the custom field.

REORDER ENUM OPTIONS

POST    /custom_fields/{custom_field_gid}/enum_options/insert

Moves a particular enum option to be either before or after another specified enum option in the custom field.

Locked custom fields can only be reordered by the user who locked the field.

Parameter Description
custom_field_gid "124578" Required: Globally unique identifier for the custom field.
enum_option "97285" Required: The ID of the enum option to relocate.
name 'High' 'Low' Required: The name of the enum option.
color 'red' 'blue' The color of the enum option. Defaults to ‘none’.
before_enum_option "12345" An existing enum option within this custom field before which the new enum option should be inserted. Cannot be provided together with after_enum_option.
after_enum_option "12345" An existing enum option within this custom field after which the new enum option should be inserted. Cannot be provided together with before_enum_option.