Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

"Specify a valid project ID or key" creating issue


This is the url I'm using:

and this is the payload I got from an example on the net, I only changed the project key:

{"fields":{"summary":"TEST SUMMARY","issuetype":{"name":"Bug"},"project":{"key":"ET"}}}

BTW, I got the project key from /project/search:


  "total": 1,

  "isLast": true,

  "maxResults": 50,

  "values": [{

    "avatarUrls": {...},

    "entityId": "...",

    "isPrivate": false,

    "uuid": "...",

    "expand": "description,lead,issueTypes,url,projectKeys,permissions,insight",

    "simplified": true,

    "name": "...",

    "self": "",

    "style": "next-gen",

    "id": "10000",

    "projectTypeKey": "software",

    "key": "ET",

    "properties": {}


  "self": "",

  "startAt": 0


I also checked I have access to create issues using /mypermissions?permissions=CREATE_ISSUES


    "havePermission": true,

    "name": "Create Issues",

    "description": "Ability to create issues.",

    "id": "11",

    "type": "PROJECT",

    "key": "CREATE_ISSUES"


I followed the authentication tutorial here:

... and based my code on the examples here:

Any ideas? Thanks :)


2 answers

1 accepted

1 vote
Answer accepted
Thomas Deiler Community Leader Apr 10, 2021

Dear @Etienne Sillon ,

if you try to change the project key of an entire Jira project, I doubt that this is implemented with REST. You need to do this within the UI.

If you want to change the issue key of a single issue, you need:

  • create a new one
  • clone its content
  • link and delete old

This is a "work-a-round". Unfortunately there is no MOVE rest endpoint yet implemented. See JRASERVER-71343 for a suggestion for Server. Its same in Cloud.

So long


Hi Thomas,

Thank you very much for the reply. I'm not trying to change the project key, I'm just trying to create an issue in the project but I don't seem to be able to specify the correct key.

When I do .../project/search I get my project info including "key": "ET", so that's what I use to create the issue with  .../issue with payload: {"fields":{"summary":"TEST SUMMARY","issuetype":{"name":"Bug"},"project":{"key":"ET"}}}



Thomas Deiler Community Leader Apr 11, 2021

Dear @Etienne Sillon ,

sorry for misunderstanding you.

Your question is tagged as "cloud". In this case you do not specify the project key but it's id, instead.

"project": {"id": "10000"}

See more here.

So long


Hi Thomas, 

Thanks again for the reply. I had tried the project id as well but got the same result. 

I did manage to create an issue by creating an API token and using the curl command as per the link you sent:

curl --request POST \
--url '' \
--user 'xxxxx:xxxxx' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"update": {},
"fields": {
"summary":"TEST SUMMARY","issuetype":{"id":"10001"},"project":{"id":"10000"}

Not sure why the exact same payload doesn't work through the Java client, even thought I can access the project and issues using it.

Anyway, all good, I'll use the API token version, thanks again!


@Etienne Sillon hey i am having the same problem; via postman client everything is fine, but in java client i can't get it to work. Did you solve the problem in the end?

@Raffaele Messina yep, this is the code I used:



    public static void createIssue(String projectId, String issueTypeId, String summary, String description) {


    String url = "";

    JSONObject payload = getCreateIssuePayload(projectId, issueTypeId, summary, description);

        sendHttpPost(url, payload);






    private static JSONObject getCreateIssuePayload(String projectId, String issueTypeId, String summary, String description) {


    JSONObject ret = new JSONObject();


        try {


        JSONObject fieldsData = new JSONObject();


        JSONObject projectData = new JSONObject();

            projectData.put("id", projectId);

    fieldsData.put("project", projectData);


    fieldsData.put("summary", summary);

    fieldsData.put("description", description);


    JSONObject issueTypeData = new JSONObject();

        issueTypeData.put("id", issueTypeId);

    fieldsData.put("issuetype", issueTypeData);


        ret.put("fields", fieldsData);


} catch (JSONException e) {

// TODO Auto-generated catch block






return ret;






public static String sendHttpPost(String url, JSONObject payload) {


    System.out.println("sendHttpPost(): url=" + url);


String ret = "";



    HttpClient httpclient = HttpClients.createDefault();


    HttpPost post = new HttpPost(url);

    post.addHeader("Accept" , "application/json");

    post.addHeader("Content-Type" , "application/json");

    post.addHeader("Authorization" , "Basic XXXXXXXXX");


    try {


    StringEntity payloadEntity = new StringEntity(payload.toString());



    HttpResponse response = httpclient.execute(post);


        int code = response.getStatusLine().getStatusCode();

        System.out.println("status=" + code);


    HttpEntity entity = response.getEntity();


    if (entity != null) {

        InputStream instream = entity.getContent();

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(instream), 1);

        try {

                String line;

                while ((line = bufferedReader.readLine()) != null) {

                ret += line;




            } finally {





} catch (Exception e) {




    if(ret.length() == 0) {

    ret = "I'm sorry, there was an error processing your request";



    System.out.println("sendHttpPost(): ret=" + ret);


    return ret;



Getting the exact same issue here. Our organization needs this to automate the creation of bugs.

I fixed mine by wrapping the whole payload under `fields`.

This was the same problem I had.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events