Jira Cloud add attachment using API

Hi !
I’m using API to upload attachment to issues, until yesterday it was working well but now it doesn’t work anymore.

I’m using the command : curl -H “Content-Type: multipart/form-data” -X --location --request POST “https://kisskool.atlassian.net/rest/api/3/issue/NIC-155/attachments” -u “:” -H “X-Atlassian-Token:no-check” --form file=@“C:\Reports\test.pdf”

and the answer is : {“errorMessages”:[“Issue does not exist or you do not have permission to see it.”],“errors”:{}}

any help is welcomed !

Welcome to the Atlassian Developer Community, @AlexandreTHIBAUD!

I tried the REST API using the following curl command and it worked as expected; that said, I do not think there is an issue with the API.

curl --location --request POST 'https://myinstance.atlassian.net/rest/api/3/issue/TEST-1/attachments' \
 -u 'email:apiToken' \
 -H 'X-Atlassian-Token: no-check' \
 --form 'file=@"myfile.txt"'

Based on the error message, your account does not have access to NIC-155. In order to isolate the issue, have you tried the following?

  1. Trying the same call but for a different issue? This way you can isolate if access to NIC-155 is the problem.
  2. Can you try calling Get issue edit metadata? If you get a 404 and you are sure that the issue exists, then the account you are using does not have the necessary permissions to view the issue.
  3. Also you might want to check if your account/user still has the Create attachments project permission for the project NIC.