Jira Cloud fields and work types
Jira description field: Atlassian Document Format in the API
description is the long text of a work item. Through /rest/api/3 it is written and read as an Atlassian Document (type doc, version 1, a content array), and the OpenAPI text says the same for environment and for multi-line text custom fields. The common mistake is sending a plain string.
Endpoints
| Method | Path | What it does |
|---|---|---|
PUT | /rest/api/3/issue/{issueIdOrKey} | Sets fields.description to an Atlassian Document. |
POST | /rest/api/3/issue | Accepts fields.description in the same shape on create. |
GET | /rest/api/3/issue/{issueIdOrKey}/editmeta | Lists description as an optional field with the set operation. |
Examples
PUT /rest/api/3/issue/{issueIdOrKey}
Sets the description to a one-paragraph document and asks for the edited field back.
curl
curl -X PUT \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"fields": {
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Description as ADF."
}
]
}
]
}
}
}' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}?returnIssue=true&fields=description'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.put(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}?returnIssue=true&fields=description',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'returnIssue': 'true', 'fields': 'description'},
json={'fields': {'description': {'type': 'doc',
'version': 1,
'content': [{'type': 'paragraph',
'content': [{'type': 'text',
'text': 'Description as ADF.'}]}]}}},
)
print(r.status_code, r.text)Response: HTTP 200
{
"key": "ZZREF-6",
"fields": {
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Description as ADF."
}
]
}
]
}
}
}Sent to Atlassian Cloud on .
GET /rest/api/3/issue/{issueIdOrKey}/editmeta
Shows the edit metadata for description: not required, schema type string, operation set.
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": {
"description": {
"required": false,
"schema": {
"type": "string",
"system": "description"
},
"name": "Description",
"key": "description",
"operations": [
"set"
]
}
}
}Sent to Atlassian Cloud on .
PUT /rest/api/3/issue/{issueIdOrKey}
A multi-line text custom field, which follows the same ADF rule, refuses a plain string. The error names the format.
curl
curl -X PUT \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"fields": {
"customfield_10163": "plain string"
}
}' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}?returnIssue=true&fields=customfield_10163'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.put(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}?returnIssue=true&fields=customfield_10163',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'returnIssue': 'true', 'fields': 'customfield_10163'},
json={'fields': {'customfield_10163': 'plain string'}},
)
print(r.status_code, r.text)Response: HTTP 400
{
"errorMessages": [],
"errors": {
"customfield_10163": "Operation value must be an Atlassian Document (see the Atlassian Document Format)"
}
}Sent to Atlassian Cloud on .
GET /rest/api/3/issue/{issueIdOrKey}
Reads a multi-line text custom field with expand=renderedFields. The stored document comes back next to an HTML rendering.
curl
curl -G \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
--data-urlencode 'fields=customfield_10163,customfield_10169,customfield_10170' \
--data-urlencode 'expand=renderedFields' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'fields': 'customfield_10163,customfield_10169,customfield_10170', 'expand': 'renderedFields'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"renderedFields": {
"customfield_10163": "<p>Paragraph written as ADF.</p>"
},
"fields": {
"customfield_10163": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Paragraph written as ADF."
}
]
}
]
}
}
}Sent to Atlassian Cloud on .
GET /rest/api/2/issue/{issueIdOrKey}
Reads the same multi-line custom field through /rest/api/2, where the value arrives as plain text.
curl
curl -G \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
--data-urlencode 'fields=customfield_10163,customfield_10164,customfield_10170' \
'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'fields': 'customfield_10163,customfield_10164,customfield_10170'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"fields": {
"customfield_10163": "Paragraph written as ADF."
}
}Sent to Atlassian Cloud on .
GET /rest/api/2/issue/{issueIdOrKey}
Reads description and environment of another work item through /rest/api/2.
curl
curl -G \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
--data-urlencode 'fields=description,environment' \
'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'fields': 'description,environment'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"key": "ZZREF-11",
"fields": {
"description": null,
"environment": "macOS 15, Safari"
}
}Sent to Atlassian Cloud on .
How it behaves
- PUT with fields.description as a doc of one paragraph answered 200 and, with returnIssue=true, returned the same document (sys-description-adf).
- The edit metadata reports schema type string for description even though v3 expects an Atlassian Document, so the schema alone does not show the wire format (editmeta-zz).
- For a multi-line text custom field a plain string answered 400 with Operation value must be an Atlassian Document (see the Atlassian Document Format) (set-paragraph-string).
- Through /rest/api/2 the multi-line custom field and environment read back as plain strings, and in v3 renderedFields gave the HTML form (read-cf-v2, sys-description-env-v2, read-cf-rendered).
- description of a work item that never had one reads as null in v2 (sys-description-env-v2).
Pitfalls
- A string works for summary and single-line text fields but not for description in v3. The 400 appears on the field, so the fix is to wrap the text in a doc with a paragraph node.
- The edit metadata calls the schema a string. Build the request from the OpenAPI text and the examples, not from that label.
- A description read from v3 is a document tree. Rendering or searching it as text needs a conversion step, or expand=renderedFields for HTML.
Questions and answers
Can I send description as a string?
Not through /rest/api/3. The OpenAPI text says description takes Atlassian Document Format, and the multi-line custom field probed for this page rejected a string with a 400.
Does API v2 behave differently?
On read, yes. Environment and a multi-line custom field came back as plain strings in v2. Description was null on the work item probed, so a v2 description value was not seen.
Related
- summary
- environment
- Paragraph (textarea)
- Reading field values: names, schema, v2 and v3
- Which fields can be set: editmeta and createmeta