Creating An Issue In A Sprint Using The JIRA REST API

Platform Notice: Cloud and Data Center - This article applies equally to both cloud and data center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

When attempting to create a new issue that is already in a sprint using the REST API, you receive the following error:

1 2 "errorMessages":[],"errors": {"sprint":"Field 'sprint' cannot be set. It is not on the appropriate screen, or unknown."}

This is using a JSON payload similar to the following with the POST /rest/api/2/issue endpoint:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 { "fields": { "project": { "key": "SP" }, "summary": "Sprint issue test", "description": "REST APIs are great.", "issuetype": { "name": "Bug" }, "sprint": { "name": "Sprint 1" } } }

Cause

The incorrect format is used for the sprint. Since sprints can share names and other features, the back end Sprint ID needs to be used.

Solution

  1. Determine the custom field ID of the Sprint custom field. To do so, navigate to ⚙ > Issues > Custom fields and click ⚙ > View for the Sprint custom field. Take a look at your URL, you should see customFieldId=XXXXX or something similar - that is the ID of your Sprint custom field. In the example from the screenshot below, the ID is 10104:

    (Auto-migrated image: description temporarily unavailable)
  2. Determine the ID of your Sprint. You can find this by hitting the endpoint /rest/agile/1.0/board/{boardId}/sprint, with your board ID being the value found in your URL under rapidView=. You can also find your board IDs using the endpoint /rest/agile/1.0/board.

  3. Once you have those values, you can assign a sprint value as if it were another custom field, using "customfield_XXXXX": YY, where XXXXX is your custom field ID from step 1, and YY is your sprint ID from step 1.

Here is an example of a correctly formed JSON to create an issue in a Sprint with ID 1, and in the case the custom field ID of the Sprint field is 10104:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 { "fields": { "project": { "key": "SP" }, "summary": "Sprint issue test", "description": "REST APIs are great.", "issuetype": { "name": "Bug" }, "customfield_10104": 1 } }

Updated on April 14, 2025

Still need help?

The Atlassian Community is here for you.