# Jira short text custom field: set and read via API

URL: https://goingstellar.ro/reference/jira-fields/text-field/

The short text field (textfield) takes a bare JSON string, set through PUT on the work item with the field id as key. It rejects Atlassian Document Format and any value over 255 characters. The field id, not the display name, is what the fields parameter and the request body expect.

## Endpoints

| Method | Path | What it does |
|---|---|---|
| PUT | `/rest/api/3/issue/{issueIdOrKey}` | Sets or changes the value. |
| GET | `/rest/api/3/issue/{issueIdOrKey}` | Reads the stored value. |
| POST | `/rest/api/3/issue` | Creates a work item with values. |
| GET | `/rest/api/3/issue/{issueIdOrKey}/editmeta` | Lists what can be edited. |
| POST | `/rest/api/3/search/jql` | Finds work items by value. |

## Examples

### PUT /rest/api/3/issue/{issueIdOrKey}

Sets the field on an existing work item and asks Jira to return the edited work item.

```bash
curl -X PUT \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "fields": {
    "customfield_10162": "Checkout total"
  }
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}?returnIssue=true&fields=customfield_10162'
```

```python
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_10162',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    params={'returnIssue': 'true', 'fields': 'customfield_10162'},
    json={'fields': {'customfield_10162': 'Checkout total'}},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "key": "ZZREF-6",
 "fields": {
  "customfield_10162": "Checkout total"
 }
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### PUT /rest/api/3/issue/{issueIdOrKey}

Shows the 400 produced when the string is longer than 255 characters.

```bash
curl -X PUT \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "fields": {
    "customfield_10162": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  }
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}?returnIssue=true&fields=customfield_10162'
```

```python
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_10162',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    params={'returnIssue': 'true', 'fields': 'customfield_10162'},
    json={'fields': {'customfield_10162': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'}},
)
print(r.status_code, r.text)
```

Response: HTTP 400

```
{
 "errorMessages": [],
 "errors": {
  "customfield_10162": "zz-ref text can't exceed 255 characters"
 }
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### POST /rest/api/3/issue

Passes the custom field next to the system fields on create; the response carries only id, key and self.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "fields": {
    "project": {
      "key": "ZZREF"
    },
    "issuetype": {
      "name": "Task"
    },
    "summary": "Created with custom fields",
    "customfield_10162": "on create",
    "customfield_10164": {
      "value": "Blue"
    },
    "customfield_10171": 7,
    "customfield_10169": "2026-12-01"
  }
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/issue',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'fields': {'project': {'key': 'ZZREF'},
                     'issuetype': {'name': 'Task'},
                     'summary': 'Created with custom fields',
                     'customfield_10162': 'on create',
                     'customfield_10164': {'value': 'Blue'},
                     'customfield_10171': 7,
                     'customfield_10169': '2026-12-01'}},
)
print(r.status_code, r.text)
```

Response: HTTP 201

```
{
 "id": "10789",
 "key": "ZZREF-10",
 "self": "https://your-domain.atlassian.net/rest/api/3/issue/10789"
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### GET /rest/api/3/issue/{issueIdOrKey}

Reads the value back with expand=names,schema, which also returns the type key and the display name.

```bash
curl -G \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  --data-urlencode 'fields=customfield_10162,customfield_10164,customfield_10169' \
  --data-urlencode 'expand=names,schema' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}'
```

```python
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_10162,customfield_10164,customfield_10169', 'expand': 'names,schema'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "key": "ZZREF-6",
 "names": {
  "customfield_10162": "zz-ref text"
 },
 "schema": {
  "customfield_10162": {
   "type": "string",
   "custom": "com.atlassian.jira.plugin.system.customfieldtypes:textfield",
   "customId": 10162
  }
 },
 "fields": {
  "customfield_10162": "Checkout total"
 }
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### POST /rest/api/3/search/jql

Searches the field through its number with cf[...] and the contains operator.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "jql": "project = ZZREF AND cf[10162] ~ \"Checkout\"",
  "fields": [
    "summary"
  ],
  "maxResults": 2
}' \
  'https://your-domain.atlassian.net/rest/api/3/search/jql'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/search/jql',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'jql': 'project = ZZREF AND cf[10162] ~ "Checkout"',
          'fields': ['summary'],
          'maxResults': 2},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "issues": [
  {
   "key": "ZZREF-6"
  }
 ],
 "isLast": true
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### POST /rest/api/3/search/jql

Runs the same search by the quoted field name.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "jql": "project = ZZREF AND \"zz-ref text\" ~ \"Checkout\"",
  "fields": [
    "summary"
  ],
  "maxResults": 2
}' \
  'https://your-domain.atlassian.net/rest/api/3/search/jql'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/search/jql',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'jql': 'project = ZZREF AND "zz-ref text" ~ "Checkout"',
          'fields': ['summary'],
          'maxResults': 2},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "issues": [
  {
   "key": "ZZREF-6"
  }
 ],
 "isLast": true
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### PUT /rest/api/3/issue/{issueIdOrKey}

A short text field created in the run, taken off the screen again, was still written by id and answered 204 with no body.

```bash
curl -X PUT \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "fields": {
    "customfield_10222": "x"
  }
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.put(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'fields': {'customfield_10222': 'x'}},
)
print(r.status_code, r.text)
```

Response: HTTP 204

No response body.

Sent to Atlassian Cloud on 29 Nov 2026.

## How it behaves

- Type key com.atlassian.jira.plugin.system.customfieldtypes:textfield, searcher key com.atlassian.jira.plugin.system.customfieldtypes:textsearcher, schema type string, type display name "Short text (plain text only)".
- The body {"fields": {"customfield_10162": "Checkout total"}} answered 200 with the edited work item because returnIssue=true was sent, and the value reads back as the same string.
- A longer string gave 400 with {"customfield_10162": "zz-ref text can't exceed 255 characters"}; the message names the field by its display name while the key is the field id.
- Asking for fields=zz-ref text (the display name) on GET issue answered 200 with the work item but no fields object, so the id must be used in the fields parameter.
- JQL accepts the field as cf[10162] or as the quoted name, and the ~ operator found the work item holding "Checkout total" with the term "Checkout". A field that was not on any screen still accepted {"fields": {id: "x"}} with 204, since the edit call does not check the screen.

## Pitfalls

- Do not send an Atlassian Document to this type; the edit operation documents that textfield accepts a string and does not handle document content.
- The 255 character limit is checked on write, so a long value fails the request with a 400 instead of being cut.
- Use the field id as the key, and look it up with the field search endpoint when only the display name is known.

## Questions and answers

### How long can a short text custom field value be?

255 characters. A longer value is refused with a 400 whose message says the field cannot exceed 255 characters.

### Can I search the field without knowing its name?

Yes, cf[N] with the number from the customfield_N id works in JQL and matched the same work item as the quoted name.

## Related

- [Paragraph (textarea)](https://goingstellar.ro/reference/jira-fields/paragraph-field/)
- [Text field (read only)](https://goingstellar.ro/reference/jira-fields/read-only-text-field/)
- [URL](https://goingstellar.ro/reference/jira-fields/url-field/)
- [JQL on custom fields](https://goingstellar.ro/reference/jira-fields/jql-on-custom-fields/)
- [Reading field values: names, schema, v2 and v3](https://goingstellar.ro/reference/jira-fields/reading-field-values/)
- [Which fields can be set: editmeta and createmeta](https://goingstellar.ro/reference/jira-fields/editmeta-createmeta-fields/)

## Sources

- [Issues (Jira REST API v3)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/)
- [Issue fields (Jira REST API v3)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-fields/)

