# Jira project picker custom field: set by key via API

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

The project picker takes {"key": project key} and reads back as a project object with self, id, key, name and projectTypeKey. Edit metadata carries the allowed projects as allowedValues.

## 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. |
| GET | `/rest/api/3/issue/{issueIdOrKey}/editmeta` | Lists what can be edited. |

## Examples

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

Sets the field to a project by key.

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

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

Response: HTTP 200

```
{
 "key": "ZZREF-6",
 "fields": {
  "customfield_10178": {
   "self": "https://your-domain.atlassian.net/rest/api/3/project/10100",
   "id": "10100",
   "key": "ZZREF",
   "name": "zz-ref fields test",
   "projectTypeKey": "business",
   "simplified": false,
   "avatarUrls": {
    "48x48": "https://your-domain.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10416",
    "24x24": "https://your-domain.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10416?size=small",
    "16x16": "https://your-domain.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10416?size=xsmall",
    "32x32": "https://your-domain.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10416?size=medium"
   }
  }
 }
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

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

A project key that does not exist is refused.

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

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

Response: HTTP 400

```
{
 "errorMessages": [],
 "errors": {
  "customfield_10198": "Project key 'NOPE' is not valid"
 }
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

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

Finds work items by project key with =.

```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 project\" = ZZREF",
  "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 project" = ZZREF',
          'fields': ['summary'],
          'maxResults': 2},
)
print(r.status_code, r.text)
```

Response: HTTP 200

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

Sent to Atlassian Cloud on 29 Nov 2026.

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

Reading returns the project object.

```bash
curl -G \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  --data-urlencode 'fields=customfield_10162,customfield_10163,customfield_10164,customfield_10165,customfield_10166,customfield_10167,customfield_10168,customfield_10169,customfield_10170,customfield_10171,customfield_10172,customfield_10173,customfield_10174,customfield_10175,customfield_10176,customfield_10177,customfield_10178,customfield_10179,customfield_10180,customfield_10181' \
  '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_10163,customfield_10164,customfield_10165,customfield_10166,customfield_10167,customfield_10168,customfield_10169,customfield_10170,customfield_10171,customfield_10172,customfield_10173,customfield_10174,customfield_10175,customfield_10176,customfield_10177,customfield_10178,customfield_10179,customfield_10180,customfield_10181'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "key": "ZZREF-6",
 "fields": {
  "customfield_10178": {
   "id": "10100",
   "key": "ZZREF",
   "name": "zz-ref fields test",
   "projectTypeKey": "business",
   "simplified": false
  }
 }
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

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

Edit metadata lists the operation set; allowedValues holds the projects that can be chosen.

```bash
curl \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/editmeta'
```

```python
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_10178": {
   "name": "zz-ref project",
   "operations": [
    "set"
   ]
  }
 }
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

## How it behaves

- Type key com.atlassian.jira.plugin.system.customfieldtypes:project, searcher key com.atlassian.jira.plugin.system.customfieldtypes:projectsearcher, schema type project, display name "Project Picker (single project)".
- {"key": "ZZREF"} answered 200 with a project object that has id, key, name, projectTypeKey and avatarUrls.
- {"key": "NOPE"} gave 400 "Project key 'NOPE' is not valid".
- "zz-ref project" = ZZREF matched the work item; edit metadata lists the operation set and a populated allowedValues array of projects.
- The field search shows lastUsed as NOT_TRACKED for this type, so Jira does not report when the field was last used.

## Pitfalls

- The error for an unknown key repeats the key that was sent and does not list valid ones.
- allowedValues can be long on a site with many projects, so do not pull edit metadata only to find a project key.
- Only the key form was probed, so the id form is untested.

## Questions and answers

### How is the project passed?

By key in the run: {"key": "ZZREF"}. The response returned the full project object.

## Related

- [Version picker (single)](https://goingstellar.ro/reference/jira-fields/version-picker-field/)
- [User picker (single user)](https://goingstellar.ro/reference/jira-fields/user-picker-field/)
- [Select list (single choice)](https://goingstellar.ro/reference/jira-fields/select-list-field/)
- [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/)

