How to detect subtask issue type

Jira API returns IssueTypeDetails object for the issue type with:

subtask boolean Whether this issue type is used to create subtasks.
hierarchyLevel integer Hierarchy level of the issue type.

Various doc pages e.g. the one for POST /rest/api/3/issuetype states, that hierarchyLevel = -1 is for Subtask. So, which flag should be used to distinguish subtask, the subtask = true or hierarchyLevel = -1 ?

Hello @OndejMedek

I followed that link you provided to the Create issue type endpoint. There is no mention of any boolean parameter called ‘subtask’.

For the parameter ‘type’ the documentation says:

type
string. Deprecated. Use hierarchyLevel instead.

Well, I guess the answer is right there in the documentation… use hierarchyLevel.

Thanks for the answer. Your response is about type string (input), but my question is about subtask boolean (output) in the IssueTypeDetails response. I am sorry the question is not clear. I am concerned about reading various endpoint responses, e.g. Get project, Get create issue metadata, … to distinguish subtask issue type. I do not need to create an issue type, that Create issue type endpoint is just en example, where is stated, that hierarchyLevel = -1 means subtask issue type.

So, it seems to me subtask in IssueTypeDetails is deprecated, too. But the doc is not clear about that.

1 Like

Hey @OndejMedek , what was your solution? I am trying to understand what the subtask issue type is myself.

Hi @mechaman , I use hierarchyLevel = -1 to detect subtask type.

1 Like