POST/repos/{owner}/{repo}/issues/{issue_number}/sub_issues

Add a sub-issue to an issue

Adds an existing issue as a sub-issue of a parent issue in a repository. Provide the sub-issue's sub_issue_id; it must belong to the same repository owner as the parent, and replace_parent transfers it from its current parent when true. A 201 response returns the added sub-issue.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

3 parameters · 2 body fields
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The repository name without the `.git` extension. The name is not case sensitive.
issue_numberintegerrequired
The number that identifies the parent issue.

The sub-issue to add and whether to replace its current parent.

sub_issue_idintegerrequired
The id of the sub-issue to add. The sub-issue must belong to the same repository owner as the parent issue
replace_parentbooleanoptional
Option that, when true, instructs the operation to replace the sub-issues current parent issue

5 status codes
201Returns the added sub-issue object.
idintegerrequired
node_idstringrequired
urlstringrequired
URL for the issue
repository_urlstringrequired
labels_urlstringrequired
comments_urlstringrequired
events_urlstringrequired
html_urlstringrequired
numberintegerrequired
Number uniquely identifying the issue within its repository
statestringrequired
State of the issue; either 'open' or 'closed'
state_reasonstringoptional
The reason for the current state
Allowed:completedreopenednot_plannedduplicate
titlestringrequired
Title of the issue
bodystringoptional
Contents of the issue
userobjectrequired
A GitHub user.
labelsarray<string>required
Labels to associate with this issue; pass one or more label names to replace the set of labels on this issue; send an empty array to clear all labels from the issue; note that the labels are silently dropped for users without push access to the repository
assigneeobjectrequired
A GitHub user.
assigneesarray<SimpleUser>optional
milestoneobjectrequired
A collection of related issues and pull requests.
lockedbooleanrequired
active_lock_reasonstringoptional
commentsintegerrequired
pull_requestobjectoptional
closed_atstringrequired
created_atstringrequired
updated_atstringrequired
draftbooleanoptional
closed_byobjectoptional
A GitHub user.
body_htmlstringoptional
body_textstringoptional
timeline_urlstringoptional
typeobjectoptional
The type assigned to the issue. This is only present for issues in repositories where issue types are supported.
repositoryobjectoptional
A repository on GitHub.
performed_via_github_appobjectoptional
GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub.
author_associationstringoptional
How the author is associated with the repository.
Allowed:COLLABORATORCONTRIBUTORFIRST_TIMERFIRST_TIME_CONTRIBUTORMANNEQUINMEMBERNONEOWNER
reactionsobjectoptional
sub_issues_summaryobjectoptional
parent_issue_urlstringoptional
URL to get the parent issue of this issue, if it is a sub-issue
pinned_commentobjectoptional
Comments provide a way for people to collaborate on an issue.
issue_dependencies_summaryobjectoptional
issue_field_valuesarray<IssueFieldValue>optional
403Returned when the authenticated user does not have permission to perform the operation.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the requested resource cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
410Returned when the requested resource is gone.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 403 is returned when you do not have permission to modify the issue; a 404 when the parent issue or sub-issue cannot be found; a 410 when the requested resource is gone; and a 422 when validation fails or the endpoint is considered spammed. sub_issue_id is required and must identify an issue owned by the same repository owner; set replace_parent to true only when you intend to replace its current parent. The owner path parameter and repo path parameter must identify the repository, and the issue_number path parameter must identify the parent issue.