Appearance
Create a custom field ​
API ReferenceRequired scope: custom_fields:write
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, multi_enum, number, date, or people.
Returns the full record of the newly created custom field.
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": "Custom fields",
"description": "_Note: Custom fields are a premium feature. Integrations which work with custom fields need to handle an assortment of use cases for free and premium users in context of free and premium organizations. For a detailed examination of which data users will have access in different circumstances, review the section below on access control._\n\nIn the Asana application, tasks, projects, and portfolios can hold user-specified [custom fields which provide extra information (e.g., a \"priority\" property with an associated value, or a number representing the time required to complete a task). This lets a user define the type of information that each item within a project or portfolio can contain in addition to the built-in fields that Asana provides.\n`display_value` is a read-only field that will always be a string. For apps that use custom fields, this is a great way to safely display/export the value of a custom field, regardless of its type. We suggest apps use this field in order to future-proof for changes to custom fields.\n\n#### Characteristics of custom fields\n\n* There is metadata that defines the custom field. This metadata can be shared across an entire workspace, or be specific to a project or portfolio.\n* Creating a custom field setting on a project or portfolio means each direct child will have the custom field. This is conceptually akin to adding columns in a database or a spreadsheet: every task (row) in the project (table) can contain information for that field, including \"blank\" values (i.e., `null` data). For portfolio custom fields, every project (row) in the portfolio (table) will contain information for the custom field.\n* Custom field settings only go one child deep. This means that a custom field setting on a portfolio will give each project the custom field, but not each task within those projects.\n* Tasks have custom field _values_ assigned to them.\n\n#### Types of custom fields\n\nIntegrations using custom fields need to be aware of the seven basic types that a custom field can adopt. These types are:\n\n* `text` - an arbitrary, relatively short string of text\n* `number` - a number with a defined level of precision\n* `enum` - a selection of a single option from a defined list of options (i.e., mutually exclusive selections)\n* `multi_enum` - a selection of one or more options from a defined list of options (i.e., mutually inclusive selections)\n* `date` - a reference date with an optional time value\n* `people` - a list of active contributors (i.e., where their relationship to the work is defined in the custom field title)\n* `reference` - a reference to another Asana object (task, project, portfolio, goal, etc.)\n#### Example use case\n\nConsider an organization that has defined a custom field for \"Priority\". This field is of `enum` type and can have user-defined values of `Low`, `Medium`, or `High`. This is the field metadata, and it is visible within, and shared across, the entire organization.\n\nA project is then created in the organization, called \"Bugs\", and the \"Priority\" custom field is associated with that project. This will allow all tasks within the \"Bugs\" project to have an associated \"Priority\".\n\nA new task is created within \"Bugs\". This task, then, has a field named \"Priority\" which can take on the custom field value of one of `[null]`, `Low`, `Medium`, and `High`.\n\n#### Custom fields in the API\n\nThese custom fields are accessible via the API through a number of endpoints at the top level (e.g. `/custom_fields` and `/custom_field_settings`) and through requests on workspaces, portfolios, projects, and tasks resources. The API also provides a way to fetch both the metadata and data which define each particular custom field, so that a client application may render proper UI to display or edit the values.\n\nText fields are currently limited to 1024 characters. On tasks, their custom field value will have a `text_value` property to represent this field.\n\nNumber fields can have an arbitrary `precision` associated with them; for example, a precision of `2` would round its value to the second (hundredths) place (e.g., `1.2345` would round to `1.23`). On tasks, the custom field value will have a `number_value` property to represent this field.\n\n#### Enum fields\n\nEnum fields represent a selection from a list of options. On the metadata, they will contain all of the options in an array. Each option has 4 properties:\n\n* `gid` - the GID of this enum option. Note that this is the GID of the individual _option_. The custom field itself has a separate `gid`.\n* `name` - the name of the option (e.g., \"Choice #1\")\n* `enabled` - whether this field is enabled. Disabled fields are not available to choose from when disabled, and are visually hidden in the Asana application, but they remain in the metadata for custom field values which were set to the option before the option was disabled.\n* `color` - a color associated with this choice.\n\nOn the task's custom field value, the enum will have an `enum_value` property which will be the same as one of the choices from the list defined in the custom field metadata.\n\n#### Reference custom fields\n\nA `reference` custom field stores a list of references to other Asana objects.\n\nThe `input_restrictions` field on the custom field definition specifies which object types are allowed as values. Possible values include: `task`, `project`, `portfolio`, and `goal`. `input_restrictions` cannot be an empty array, it must have at least one object type.\n\n#### Querying an organization for its custom fields\n\nFor custom fields shared across the workspace or organization, the workspace [can be queried](/reference/custom-fields/getcustomfieldsforworkspace) for its list of defined custom fields. Like other collection queries, the fields will be returned as a compact record; slightly different from most other compact records is the fact that the compact record for custom fields includes `type` as well as `gid` and `name`.\n\n#### Accessing custom field definitions\n\nThe [custom fields](/reference/custom-fields/getcustomfield) reference describes how the metadata which defines a custom field is accessed. A GET request with a `gid` can be issued on the `/custom_fields` endpoint to fetch the full definition of a single custom field given its `gid` from (for instance) listing all custom fields on a workspace, or getting the `gid` from a custom field settings object or a task.\n\n#### Associating custom fields with a project or portfolio\n\nA mapping between a custom field and a project or portfolio is handled with a [custom field settings](/reference/custom-fields/custom-field-settings) object. This object contains a reference for each of the custom fields and the project or portfolio, as well as additional information about the status of that particular custom field (e.g., `is_important`, which defines whether or not the custom field will appear in the list/grid on the Asana application).\n\n#### Accessing custom field values on tasks or projects\n\nThe [tasks](/reference/tasks/gettask) reference has information on how custom fields look on tasks. custom fields will return as an array on the property `custom_fields`, and each entry will contain, side-by-side, the compact representation of the custom field metadata and a `{typename}_value` property that stores the value set for the custom field.\n\nOf particular note is that the top-level `gid` of each entry in the `custom_fields` array is the `gid` of the custom field metadata, as it is the compact representation of this metadata. This can be used to refer to the full metadata by making a request to the `/custom_fields/{custom_fields_id}` endpoint as described above.\n\nCustom fields can be set just as in the Asana-defined fields on a task via `POST` or `PUT` requests. You can see an example in the [update a task](/reference/tasks/updatetask) endpoint.\n\nCustom fields on projects follow this same pattern.\n\n#### Warning: Program defensively with regards to custom field definitions\n\nAsana application users have the ability to change the definitions of custom field metadata. This means that as you write scripts or applications to work with them, it is possible for the definitions to change at any time, which may cause an application using them to break or malfunction if it makes assumptions about the metadata for a particular custom field. When using custom fields, it is a good idea to program *defensively*, meaning you your application should double-check that the custom field metadata are what it expects.\n\nStoring the state of the custom field metadata for too long if you dynamically create a model for it can cause your model to become out of sync with the model stored in Asana. For example, if you encounter an `enum` value on a task that does not match any option in your metadata model, your metadata model has become out of date with the custom field metadata.\n\n#### Enabled and disabled values\n\nWhen information that is contained in a custom field value loses a logical association with its metadata definition, the value becomes disabled. This can happen in a couple of simple ways, for example, if you remove the custom field metadata from a project, or move a task with a custom field to a different project which does not have the custom field metadata associated with it. The value remains on the task, and the custom field metadata can still be found and examined, but as the context in which the custom field makes sense is gone, the custom field cannot change its value; it can only be cleared.\n\n_Note: Tasks that are associated with multiple projects do not become disabled, so long as at least one of the projects is still associated with the custom field metadata. In other words, tasks with multiple projects will retain logically associated to the set of custom field metadata represented by all of their projects._\n\nMoving the task back under a project with that custom field applied to it or applying the custom field metadata to the current project will return the custom field value to an enabled state. In this scenario, the custom field will be re-enabled and editable again.\n\nIn the Asana application, disabled fields are grayed out and not allowed to change, other than to be discarded. In the API, we return a property `enabled: false` to inform the external application that the value has been disabled.\n\nNote that the API enforces the same operations on disabled custom field values as hold in the Asana application: they may not have their values changed, since the lack of context for the values of a custom field in general doesn't provide enough information to know what new values should be. Setting the custom field value to `null` will clear and remove the custom field value from the task.\n\n#### Custom field access control\n\nCustom fields are a complex feature of the Asana platform, and their access in the Asana application and in the API vary based on the status of the user and project. When building your application, it is best to be defensive and not assume the given user will have read or write access to a custom field, and fail gracefully when this occurs."
}
],
"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
}
},
"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": {
"AsanaNamedResource": {
"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"
},
"name": {
"description": "The name of the object.",
"type": "string",
"example": "Bug Task"
}
}
},
"CustomFieldBase": {
"allOf": [
{
"$ref": "#/components/schemas/CustomFieldCompact"
},
{
"type": "object",
"properties": {
"description": {
"description": "[Opt In](/guides/platform/inputoutput-options). The description of the custom field.",
"type": "string",
"example": "Development team priority"
},
"enum_options": {
"description": "*Conditional*. Only relevant for custom fields of type `enum` or `multi_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](/reference/custom-fields/createenumoptionforcustomfield).",
"type": "array",
"items": {
"$ref": "#/components/schemas/EnumOption"
}
},
"precision": {
"description": "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.\nFor percentage format, this may be unintuitive, as a value of 0.25 has a precision of 0, while a value of 0.251 has a precision of 1. This is due to 0.25 being displayed as 25%.\nThe identifier format will always have a precision of 0.",
"type": "integer",
"example": 2
},
"format": {
"description": "The format of this custom field.",
"type": "string",
"enum": [
"currency",
"identifier",
"percentage",
"custom",
"duration",
"none"
],
"example": "custom"
},
"currency_code": {
"description": "ISO 4217 currency code to format this custom field. This will be null if the `format` is not `currency`.",
"type": "string",
"nullable": true,
"example": "EUR"
},
"custom_label": {
"description": "This is the string that appears next to the custom field value. This will be null if the `format` is not `custom`.",
"type": "string",
"nullable": true,
"example": "gold pieces"
},
"custom_label_position": {
"description": "Only relevant for custom fields with `custom` format. This depicts where to place the custom label. This will be null if the `format` is not `custom`.",
"type": "string",
"nullable": true,
"enum": [
"prefix",
"suffix",
null
],
"example": "suffix"
},
"is_global_to_workspace": {
"description": "This flag describes whether this custom field is available to every container in the workspace. Before project-specific custom fields, this field was always true.",
"type": "boolean",
"example": true,
"readOnly": true
},
"has_notifications_enabled": {
"description": "*Conditional*. This flag describes whether a follower of a task with this field should receive inbox notifications from changes to this field.",
"type": "boolean",
"example": true
},
"asana_created_field": {
"description": "*Conditional*. A unique identifier to associate this field with the template source of truth.",
"type": "string",
"readOnly": true,
"nullable": true,
"enum": [
"a_v_requirements",
"account_name",
"actionable",
"align_shipping_link",
"align_status",
"allotted_time",
"appointment",
"approval_stage",
"approved",
"article_series",
"board_committee",
"browser",
"campaign_audience",
"campaign_project_status",
"campaign_regions",
"channel_primary",
"client_topic_type",
"complete_by",
"contact",
"contact_email_address",
"content_channels",
"content_channels_needed",
"content_stage",
"content_type",
"contract",
"contract_status",
"cost",
"creation_stage",
"creative_channel",
"creative_needed",
"creative_needs",
"data_sensitivity",
"deal_size",
"delivery_appt",
"delivery_appt_date",
"department",
"department_responsible",
"design_request_needed",
"design_request_type",
"discussion_category",
"do_this_task",
"editorial_content_status",
"editorial_content_tag",
"editorial_content_type",
"effort",
"effort_level",
"est_completion_date",
"estimated_time",
"estimated_value",
"expected_cost",
"external_steps_needed",
"favorite_idea",
"feedback_type",
"financial",
"funding_amount",
"grant_application_process",
"hiring_candidate_status",
"idea_status",
"ids_link",
"ids_patient_link",
"implementation_stage",
"insurance",
"interview_area",
"interview_question_score",
"itero_scan_link",
"job_s_applied_to",
"lab",
"launch_status",
"lead_status",
"localization_language",
"localization_market_team",
"localization_status",
"meeting_minutes",
"meeting_needed",
"minutes",
"mrr",
"must_localize",
"name_of_foundation",
"need_to_follow_up",
"next_appointment",
"next_steps_sales",
"num_people",
"number_of_user_reports",
"office_location",
"onboarding_activity",
"owner",
"participants_needed",
"patient_date_of_birth",
"patient_email",
"patient_phone",
"patient_status",
"phone_number",
"planning_category",
"point_of_contact",
"position",
"post_format",
"prescription",
"priority",
"priority_level",
"product",
"product_stage",
"progress",
"project_size",
"project_status",
"proposed_budget",
"publish_status",
"reason_for_scan",
"referral",
"request_type",
"research_status",
"responsible_department",
"responsible_team",
"risk_assessment_status",
"room_name",
"sales_counterpart",
"sentiment",
"shipping_link",
"social_channels",
"stage",
"status",
"status_design",
"status_of_initiative",
"system_setup",
"task_progress",
"team",
"team_marketing",
"team_responsible",
"time_it_takes_to_complete_tasks",
"timeframe",
"treatment_type",
"type_work_requests_it",
"use_agency",
"user_name",
"vendor_category",
"vendor_type",
"word_count",
null
],
"example": "priority"
}
}
}
]
},
"CustomFieldCompact": {
"description": "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](/reference/custom-fields/custom-fields) developer documentation for more information about how custom fields relate to various resources in Asana.\n\nUsers 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`.",
"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": "custom_field",
"x-insert-after": "gid"
},
"name": {
"description": "The name of the custom field.",
"type": "string",
"example": "Status"
},
"type": {
"description": "*Deprecated: new integrations should prefer the resource_subtype field.* The type of the custom field. Must be one of the given values.\n",
"type": "string",
"readOnly": true,
"enum": [
"text",
"enum",
"multi_enum",
"number",
"date",
"people"
]
},
"enum_options": {
"description": "*Conditional*. Only relevant for custom fields of type `enum` or `multi_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](/reference/custom-fields/createenumoptionforcustomfield).",
"type": "array",
"items": {
"$ref": "#/components/schemas/EnumOption"
}
},
"enabled": {
"description": "*Conditional*. This field applies only to [custom field values](/guides/platform/custom-fields-guide#/accessing-custom-field-values-on-tasks-or-projects) and is not available for [custom field definitions](/guides/platform/custom-fields-guide#/accessing-custom-field-definitions).\nDetermines if the custom field is enabled or not. For more details, see the [Custom Fields documentation](/guides/platform/custom-fields-guide#/enabled-and-disabled-values).",
"type": "boolean",
"readOnly": true,
"example": true
},
"representation_type": {
"description": "This field tells the type of the custom field.",
"type": "string",
"example": "number",
"readOnly": true,
"enum": [
"text",
"enum",
"multi_enum",
"number",
"date",
"people",
"formula",
"custom_id"
]
},
"id_prefix": {
"description": "This field is the unique custom ID string for the custom field.",
"type": "string",
"nullable": true,
"example": "ID"
},
"input_restrictions": {
"description": "*Conditional*. Only relevant for custom fields of type `reference`. This array of strings reflects the allowed types of objects that can be written to a `reference` custom field value.",
"type": "array",
"items": {
"type": "string"
},
"example": "task"
},
"is_formula_field": {
"description": "*Conditional*. This flag describes whether a custom field is a formula custom field.",
"type": "boolean",
"example": false
},
"date_value": {
"description": "*Conditional*. Only relevant for custom fields of type `date`. This object reflects the chosen date (and optionally, time) value of a `date` custom field. If no date is selected, the value of `date_value` will be `null`.",
"type": "object",
"nullable": true,
"properties": {
"date": {
"type": "string",
"description": "A string representing the date in YYYY-MM-DD format.",
"example": "2024-08-23"
},
"date_time": {
"type": "string",
"description": "A string representing the date in ISO 8601 format. If no time value is selected, the value of `date-time` will be `null`.",
"example": "2024-08-23T22:00:00.000Z"
}
}
},
"enum_value": {
"allOf": [
{
"$ref": "#/components/schemas/EnumOption"
},
{
"type": "object",
"nullable": true,
"description": "*Conditional*. Only relevant for custom fields of type `enum`. This object is the chosen value of an `enum` custom field."
}
]
},
"multi_enum_values": {
"description": "*Conditional*. Only relevant for custom fields of type `multi_enum`. This object is the chosen values of a `multi_enum` custom field.",
"type": "array",
"items": {
"$ref": "#/components/schemas/EnumOption"
}
},
"number_value": {
"description": "*Conditional*. This number is the value of a `number` custom field.",
"type": "number",
"nullable": true,
"example": 5.2
},
"text_value": {
"description": "*Conditional*. This string is the value of a `text` custom field.",
"type": "string",
"nullable": true,
"example": "Some Value"
},
"display_value": {
"description": "A string representation for the value of the custom field. Integrations that don't require the underlying type should use this field to read values. Using this field will future-proof an app against new custom field types.",
"type": "string",
"readOnly": true,
"example": "blue",
"nullable": true
}
}
},
"CustomFieldRequest": {
"allOf": [
{
"$ref": "#/components/schemas/CustomFieldBase"
},
{
"type": "object",
"required": [
"workspace"
],
"properties": {
"workspace": {
"type": "string",
"description": "*Create-Only* The workspace to create a custom field in.",
"example": "1331"
},
"owned_by_app": {
"type": "boolean",
"description": "*Allow-listed*. Instructs the API that this Custom Field is app-owned. This parameter is allow-listed to specific apps at this point in time. For apps that are not allow-listed, providing this parameter will result in a `403 Forbidden`."
},
"people_value": {
"description": "*Conditional*. Only relevant for custom fields of type `people`. This array of user GIDs, emails, or the string \"me\", reflects the users to be written to a `people` custom field. Note that *write* operations will replace existing users (if any) in the custom field with the users specified in this array.",
"type": "array",
"items": {
"type": "string",
"description": "A string identifying a user. This can either be the string \"me\", an email, or the gid of a user."
},
"example": [
"12345"
]
},
"reference_value": {
"description": "*Conditional*. Only relevant for custom fields of type `reference`. This array of GIDs reflects the objects to be written to a `reference` custom field. Note that *write* operations will replace existing objects (if any) in the custom field with the objects specified in this array.",
"type": "array",
"items": {
"type": "string",
"description": "The GID of an object."
},
"example": [
"12345"
]
}
}
}
]
},
"CustomFieldCreateRequest": {
"allOf": [
{
"$ref": "#/components/schemas/CustomFieldRequest"
},
{
"type": "object",
"required": [
"resource_subtype"
],
"properties": {
"resource_subtype": {
"description": "The type of the custom field. Must be one of the given values.",
"type": "string",
"example": "text",
"enum": [
"text",
"enum",
"multi_enum",
"number",
"date",
"people",
"reference"
]
}
}
}
]
},
"CustomFieldResponse": {
"allOf": [
{
"$ref": "#/components/schemas/CustomFieldBase"
},
{
"type": "object",
"properties": {
"representation_type": {
"description": "This field tells the type of the custom field.",
"type": "string",
"example": "number",
"readOnly": true,
"enum": [
"text",
"enum",
"multi_enum",
"number",
"date",
"people",
"formula",
"custom_id",
"reference"
]
},
"id_prefix": {
"description": "This field is the unique custom ID string for the custom field.",
"type": "string",
"nullable": true,
"example": "ID"
},
"input_restrictions": {
"description": "*Conditional*. Only relevant for custom fields of type `reference`. This array of strings reflects the allowed types of objects that can be written to a `reference` custom field value.",
"type": "array",
"items": {
"type": "string"
},
"example": "task"
},
"is_formula_field": {
"description": "*Conditional*. This flag describes whether a custom field is a formula custom field.",
"type": "boolean",
"example": false
},
"is_value_read_only": {
"description": "*Conditional*. This flag describes whether a custom field is read only.",
"type": "boolean",
"example": false
},
"created_by": {
"allOf": [
{
"$ref": "#/components/schemas/UserCompact"
},
{
"nullable": true
}
]
},
"people_value": {
"description": "*Conditional*. Only relevant for custom fields of type `people`. This array of [compact user](/reference/users/users) objects reflects the values of a `people` custom field.",
"type": "array",
"items": {
"$ref": "#/components/schemas/UserCompact"
}
},
"reference_value": {
"description": "*Conditional*. Only relevant for custom fields of type `reference`. This array of objects reflects the values of a `reference` custom field.",
"type": "array",
"items": {
"$ref": "#/components/schemas/AsanaNamedResource"
}
},
"html_text_value": {
"description": "*Conditional*. Only relevant for custom fields of type `text`. This is the HTML representation of the text value of a custom field, corresponding to the `text_value` plain-text field.",
"type": "string",
"readOnly": true,
"nullable": true,
"example": "<body>Some Value</body>"
},
"privacy_setting": {
"description": "The privacy setting of the custom field. *Note: Administrators in your organization may restrict the values of `privacy_setting`.*",
"type": "string",
"enum": [
"public_with_guests",
"public",
"private"
],
"example": "public_with_guests"
},
"default_access_level": {
"description": "The default access level when inviting new members to the custom field. This isn't applied when the `privacy_setting` is `private`, or the user is a guest. For local fields in a project or portfolio, the user must additionally have permission to modify the container itself.",
"type": "string",
"enum": [
"admin",
"editor",
"user"
],
"example": "user"
},
"resource_subtype": {
"description": "The type of the custom field. Must be one of the given values.\n",
"type": "string",
"readOnly": true,
"example": "text",
"enum": [
"text",
"enum",
"multi_enum",
"number",
"date",
"people",
"reference"
]
}
}
}
]
},
"EnumOption": {
"description": "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 500.\n\nYou can add enum options to a custom field by using the `POST /custom_fields/custom_field_gid/enum_options` endpoint.\n\n**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_gid` endpoint. Other attributes can be updated similarly.\n\nOn 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.\n\nEnum 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.\n\nAn enum options list can be reordered with the `POST /custom_fields/custom_field_gid/enum_options/insert` endpoint.",
"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": "enum_option",
"x-insert-after": "gid"
},
"name": {
"description": "The name of the enum option.",
"type": "string",
"example": "Low"
},
"enabled": {
"description": "Whether or not the enum option is a selectable value for the custom field.",
"type": "boolean",
"example": true
},
"color": {
"description": "The color of the enum option. Defaults to `none`.",
"type": "string",
"example": "blue"
}
}
},
"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"
}
}
}
},
"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"
}
}
}
},
"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": {
"/custom_fields": {
"parameters": [
{
"$ref": "#/components/parameters/pretty"
}
],
"post": {
"summary": "Create a custom field",
"description": "<b>Required scope: </b>custom_fields:write\n\nCreates a new custom field in a workspace. Every custom field is required\nto be created in a specific workspace, and this workspace cannot be\nchanged once set.\n\nA custom field’s name must be unique within a workspace and not conflict\nwith names of existing task properties such as `Due Date` or `Assignee`.\nA custom field’s type must be one of `text`, `enum`, `multi_enum`, `number`,\n`date`, or `people`.\n\nReturns the full record of the newly created custom field.",
"tags": [
"Custom fields"
],
"operationId": "createCustomField",
"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": [
"asana_created_field",
"created_by",
"created_by.name",
"currency_code",
"custom_label",
"custom_label_position",
"date_value",
"date_value.date",
"date_value.date_time",
"default_access_level",
"description",
"display_value",
"enabled",
"enum_options",
"enum_options.color",
"enum_options.enabled",
"enum_options.name",
"enum_value",
"enum_value.color",
"enum_value.enabled",
"enum_value.name",
"format",
"has_notifications_enabled",
"html_text_value",
"id_prefix",
"input_restrictions",
"is_formula_field",
"is_global_to_workspace",
"is_value_read_only",
"multi_enum_values",
"multi_enum_values.color",
"multi_enum_values.enabled",
"multi_enum_values.name",
"name",
"number_value",
"people_value",
"people_value.name",
"precision",
"privacy_setting",
"reference_value",
"reference_value.name",
"representation_type",
"resource_subtype",
"text_value",
"type"
],
"schema": {
"type": "array",
"items": {
"type": "string",
"enum": [
"asana_created_field",
"created_by",
"created_by.name",
"currency_code",
"custom_label",
"custom_label_position",
"date_value",
"date_value.date",
"date_value.date_time",
"default_access_level",
"description",
"display_value",
"enabled",
"enum_options",
"enum_options.color",
"enum_options.enabled",
"enum_options.name",
"enum_value",
"enum_value.color",
"enum_value.enabled",
"enum_value.name",
"format",
"has_notifications_enabled",
"html_text_value",
"id_prefix",
"input_restrictions",
"is_formula_field",
"is_global_to_workspace",
"is_value_read_only",
"multi_enum_values",
"multi_enum_values.color",
"multi_enum_values.enabled",
"multi_enum_values.name",
"name",
"number_value",
"people_value",
"people_value.name",
"precision",
"privacy_setting",
"reference_value",
"reference_value.name",
"representation_type",
"resource_subtype",
"text_value",
"type"
]
}
},
"style": "form",
"explode": false
}
],
"requestBody": {
"description": "The custom field object to create.",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/CustomFieldCreateRequest"
}
}
}
}
}
},
"responses": {
"201": {
"description": "Custom field successfully created.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/CustomFieldResponse"
}
}
}
}
}
},
"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": [
"custom_fields: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\nCustomField result = client.customfields.createCustomField()\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 customFieldsApiInstance = new Asana.CustomFieldsApi(client);\nlet body = {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}}; // Object | The custom field object to create.\nlet opts = { \n 'opt_fields': \"asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,default_access_level,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,id_prefix,input_restrictions,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,privacy_setting,reference_value,reference_value.name,representation_type,resource_subtype,text_value,type\"\n};\ncustomFieldsApiInstance.createCustomField(body, 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.customfields.createCustomField({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\ncustom_fields_api_instance = asana.CustomFieldsApi(api_client)\nbody = {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}} # dict | The custom field object to create.\nopts = {\n 'opt_fields': \"asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,default_access_level,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,id_prefix,input_restrictions,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,privacy_setting,reference_value,reference_value.name,representation_type,resource_subtype,text_value,type\", # 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 # Create a custom field\n api_response = custom_fields_api_instance.create_custom_field(body, opts)\n pprint(api_response)\nexcept ApiException as e:\n print(\"Exception when calling CustomFieldsApi->create_custom_field: %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.custom_fields.create_custom_field({'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->customfields->createCustomField(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.custom_fields.create_custom_field(field: \"value\", field: \"value\", options: {pretty: true})"
}
]
}
}
}
}
}