Going Stellar

Home/Atlassian REST API reference

Jira and Confluence Cloud REST API

Delete a Jira work item with the REST API

DELETE /rest/api/3/issue/{issueIdOrKey} removes a work item and answers 204 with no body. A later read of the same key gives 404. The spec adds that a work item with sub-tasks is refused with 400 unless deleteSubtasks=true.

Endpoints

MethodPathWhat it does
DELETE/rest/api/3/issue/{issueIdOrKey}Deletes a work item; deleteSubtasks removes its sub-tasks too.

Examples

POST /rest/api/3/issue

A throwaway work item to delete in the next call.

curl

curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "fields": {
    "project": {
      "key": "WEB"
    },
    "issuetype": {
      "name": "Task"
    },
    "summary": "Example to delete"
  }
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue'

Python (requests)

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': 'WEB'},
                     'issuetype': {'name': 'Task'},
                     'summary': 'Example to delete'}},
)
print(r.status_code, r.text)

Response: HTTP 201

{
 "id": "10771",
 "key": "WEB-60",
 "self": "https://your-domain.atlassian.net/rest/api/3/issue/10771"
}

Sent to Atlassian Cloud on .

DELETE /rest/api/3/issue/{issueIdOrKey}

Delete it by key. The answer is 204 and there is no body.

curl

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

Python (requests)

import os
import requests

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

Response: HTTP 204

No response body.

Response headers

X-Ratelimit-Limit: 400
X-Ratelimit-Remaining: 399

Sent to Atlassian Cloud on .

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

Reading the deleted key gives the same 404 as a key that never existed.

curl

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

Python (requests)

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'},
)
print(r.status_code, r.text)

Response: HTTP 404

{
 "errorMessages": [
  "Issue does not exist or you do not have permission to see it."
 ],
 "errors": {}
}

Sent to Atlassian Cloud on .

How it behaves

  • A successful delete answers 204 with no body.
  • A GET on the deleted key answers 404 with 'Issue does not exist or you do not have permission to see it.', the same text as for an unknown key.
  • The delete call showed X-Ratelimit-Limit 400, the same bucket size as reads.

Pitfalls

  • Deletion is permanent through the API. Confirm the key before sending, since the response gives no undo hint.
  • The spec says a work item with sub-tasks cannot be deleted unless deleteSubtasks is true. That path was not probed, so test it on a copy first.
  • The caller needs Delete issues permission as well as Browse projects; a 403 from the spec means the permission is missing.
  • Resolve the key from a search or a stored id first. A key that exists is deleted whether or not it was the one you meant.

Questions and answers

Can I delete a work item that has sub-tasks?

Set deleteSubtasks=true. Without it the spec says the API answers 400.

How do I confirm it worked?

The 204 is the confirmation; a following GET gives 404.

Sources

  1. The Jira Cloud platform REST API v3 (Atlassian Developer)
  2. Delete issue (Jira REST API v3)

Markdown version · All REST API pages