Set a Default Value for a Custom Field
Use the REST API to set the default value for a custom field in a specific project. Default values are stored in the project custom field settings.
This use case sets default values for a version field. You can use the same pattern for other bundle-based custom fields that support the defaultValues attribute.
Summary
When you have the required IDs, update the project custom field by sending a POST request to this endpoint:
Step-by-Step
To set a default value for a project custom field
Get the ID of the project where you want to set the default value. For instructions, see Get a Project ID. This example uses the project
Sample Projectwith the entity ID0-0.Get the list of custom fields that are attached to the project. Request the field ID, field name, assigned bundle, and current default values.
curl -X GET 'https://example.youtrack.cloud/api/admin/projects/0-0/customFields?fields=id,field(name),bundle(id,name,values(id,name)),defaultValues(id,name),$type' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer <YouTrack_token>' \ -H 'Content-Type: application/json'In the response, locate the custom field and the value that you want to set as default. This example uses the
Affected versionsfield with the entity ID105-42and the2026.1version value with the entity ID133-19.[ { "field": { "name": "Affected versions", "$type": "CustomField" }, "bundle": { "values": [ { "name": "2026.1", "id": "133-19", "$type": "VersionBundleElement" }, { "name": "2026.2", "id": "133-24", "$type": "VersionBundleElement" } ], "name": "Affected versions", "id": "97-4", "$type": "VersionBundle" }, "defaultValues": [], "id": "105-42", "$type": "VersionProjectCustomField" } ]Set the default value by updating the
defaultValuesattribute of the project custom field.curl -X POST 'https://example.youtrack.cloud/api/admin/projects/0-0/customFields/105-42?fields=id,field(name),defaultValues(id,name)' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer <YouTrack_token>' \ -H 'Content-Type: application/json' \ -d '{ "defaultValues": [ {"id": "133-19", "$type": "VersionBundleElement"} ] }'If the request is successful, the response contains the updated project custom field.
{ "field": { "name": "Affected versions", "$type": "CustomField" }, "defaultValues": [ { "name": "2026.1", "id": "133-19", "$type": "VersionBundleElement" } ], "id": "105-42", "$type": "VersionProjectCustomField" }
As a result, new issues in the project use the selected value as the default for this custom field.