Jira Cloud fields and work types
Rename a Jira custom field and its description via API
A custom field is renamed with PUT /rest/api/3/field/{fieldId} and a body of name and description. The answer is 204 with no body, the customfield id does not change, and every place that shows the name, such as edit metadata and screen listings, shows the new one afterwards.
Endpoints
| Method | Path | What it does |
|---|---|---|
PUT | /rest/api/3/field/{fieldId} | Updates name, description and searcherKey of a custom field. |
GET | /rest/api/3/field/search | Reads the field back to confirm the new name. |
Examples
PUT /rest/api/3/field/customfield_10172
Renames a URL field and rewrites its description in one call.
curl
curl -X PUT \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"name": "zz-ref url renamed",
"description": "Renamed through the API."
}' \
'https://your-domain.atlassian.net/rest/api/3/field/customfield_10172'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.put(
'https://your-domain.atlassian.net/rest/api/3/field/customfield_10172',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
json={'name': 'zz-ref url renamed', 'description': 'Renamed through the API.'},
)
print(r.status_code, r.text)Response: HTTP 204
No response body.
Response headers
Content-Type: text/html;charset=UTF-8
X-Ratelimit-Limit: 300
X-Ratelimit-Remaining: 299Sent to Atlassian Cloud on .
GET /rest/api/3/issue/{issueIdOrKey}/editmeta
Edit metadata afterwards lists the same field under the new name, with the same key customfield_10172.
curl
curl \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/editmeta'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/editmeta',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"fields": {
"customfield_10172": {
"name": "zz-ref url renamed",
"key": "customfield_10172",
"schema": {
"type": "string",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:url",
"customId": 10172
}
}
}
}Sent to Atlassian Cloud on .
GET /rest/api/3/field/customfield_10162
There is no GET on the field id. A client that tries to read the renamed field this way gets a 405.
curl
curl \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/rest/api/3/field/customfield_10162'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/field/customfield_10162',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)Response: HTTP 405
{
"type": "about:blank",
"title": "Method Not Allowed",
"status": 405,
"detail": "Method 'GET' is not supported.",
"instance": "/rest/api/3/field/customfield_10162"
}Sent to Atlassian Cloud on .
How it behaves
- PUT answered 204. The Content-Type of the empty answer is text/html, and the call was charged to a bucket of 300.
- The field id and key did not change: edit metadata lists customfield_10172 with the renamed text, and the screen tab listing of the same field shows the new name too.
- JQL addresses a custom field by name or by cf[id]. A JQL string that quotes a name that does not exist answers 200 with no work items, not an error, so a query written with the old name would fail quietly instead of raising an error.
Pitfalls
- The spec says the name need not be unique and may be up to 255 characters, and the description up to 40000. Two fields with the same name make a name-based JQL clause ambiguous, so queries should use cf[id].
- The spec lets the body carry searcherKey too, which must be valid for the field type or null.
- A 204 has no body, so read the field back through field/search if the new name has to be confirmed.
Questions and answers
Does renaming a custom field change its id?
No. The key and the id (customfield_10172 in the run) stayed the same, and work items keep their values.
Will saved JQL filters break after a rename?
A clause that quotes the old name no longer finds the field. The run with an unknown name answered 200 and an empty list, so the failure is quiet. Clauses written as cf[10172] are not affected.
Related
- Find fields with field/search
- JQL on custom fields
- Create a custom field: types and searchers
- Fields on screens
- Which fields can be set: editmeta and createmeta
- Field ids, keys and names