# How to detect subtask issue type

**URL:** <https://community.developer.atlassian.com/t/how-to-detect-subtask-issue-type/50387>\
**Category:** Jira Cloud\
**Tags:** issuetypes, rest-api\
**Created:** [July 28, 2021, 1:49pm UTC](https://community.developer.atlassian.com/t/how-to-detect-subtask-issue-type/50387 "2021-07-28T13:49:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![OndejMedek](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/ondejmedek/32/42527_2.png) [@OndejMedek](https://community.developer.atlassian.com/u/OndejMedek)\
**Post date:** [July 28, 2021, 1:49pm UTC](https://community.developer.atlassian.com/t/how-to-detect-subtask-issue-type/50387/1 "2021-07-28T13:49:10Z")

</div>

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](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-types/#api-rest-api-3-issuetype-post) states, that `hierarchyLevel = -1` is for Subtask. So, which flag should be used to distinguish subtask, the `subtask = true` or `hierarchyLevel = -1` ?

---

<div class="post-metadata">

**Author:** ![anon96974232](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@anon96974232](https://community.developer.atlassian.com/u/anon96974232)\
**Post date:** [August 2, 2021, 5:19am UTC](https://community.developer.atlassian.com/t/how-to-detect-subtask-issue-type/50387/2 "2021-08-02T05:19:54Z")

</div>

Hello @OndejMedek

I followed that link you provided to the [Create issue type endpoint](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-types/#api-rest-api-3-issuetype-post). 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.

---

<div class="post-metadata">

**Author:** ![OndejMedek](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/ondejmedek/32/42527_2.png) [@OndejMedek](https://community.developer.atlassian.com/u/OndejMedek)\
**Post date:** [August 2, 2021, 12:08pm UTC](https://community.developer.atlassian.com/t/how-to-detect-subtask-issue-type/50387/3 "2021-08-02T12:08:32Z")

</div>

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](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-projectidorkey-get), [Get create issue metadata](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-createmeta-get), … to distinguish subtask issue type. I do not need to create an issue type, that [Create issue type endpoint](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-types/#api-rest-api-3-issuetype-post) 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.

---

<div class="post-metadata">

**Author:** ![mechaman](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@mechaman](https://community.developer.atlassian.com/u/mechaman)\
**Post date:** [March 2, 2024, 11:12pm UTC](https://community.developer.atlassian.com/t/how-to-detect-subtask-issue-type/50387/4 "2024-03-02T23:12:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![OndejMedek](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/ondejmedek/32/42527_2.png) [@OndejMedek](https://community.developer.atlassian.com/u/OndejMedek)\
**Post date:** [March 4, 2024, 7:52am UTC](https://community.developer.atlassian.com/t/how-to-detect-subtask-issue-type/50387/5 "2024-03-04T07:52:05Z")

</div>

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