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

Create an issue

Creates an issue in a repository. Provide a title; you can also include a body, labels, assignees, milestone, issue type, parent issue, or issue field values. Creating an issue triggers notifications, and creating content too quickly may result in secondary rate limiting.

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

2 parameters · 9 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 details. title is required; other fields let you set the issue body, assignments, labels, milestone, type, parent issue, and custom field values.

titlestringrequired
The title of the issue.
bodystringoptional
The contents of the issue.
assigneestringoptional
Login for the user that this issue should be assigned to. _NOTE: Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise. **This field is closing down.**_
milestonestringoptional
The milestone to associate with the issue, supplied as a string or integer. Only users with push access can set this for a new issue; otherwise, the value is silently dropped.
labelsarray<string>optional
Labels to associate with this issue. _NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise._
assigneesarray<string>optional
Logins for Users to assign to this issue. _NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise._
issue_field_valuesarray<object>optional
An array of issue field values to set on this issue. Each field value must include the field ID and the value to set. Issue fields are only available for organization-owned repositories with the feature enabled. Field values are silently dropped otherwise.
typestringoptional
The name of the issue type to associate with this issue. _NOTE: Only users with push access can set the type for new issues. The type is silently dropped otherwise._
parent_issue_idintegeroptional
The id of the parent issue to add this issue to as a sub-issue. _NOTE: Only users with triage access to both the parent issue's repository and this repository can set the parent issue._

7 status codes
201Returns the created issue object, including its identifier, repository issue number, state, title, body, labels, and related issue details.
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
400Returned when the request is invalid.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Returned when the request is forbidden, including when the caller lacks access to create an issue in the repository.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the repository cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
410Returned when issues are disabled in the repository.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional
503Returned when the service is unavailable.
codestringoptional
messagestringoptional
documentation_urlstringoptional

Error handling

A 400 is returned for a bad request; a 403 is returned when the request is forbidden; a 404 is returned when the repository is not found; a 410 is returned when issues are disabled; a 422 is returned when validation fails or the endpoint has been spammed; and a 503 is returned when the service is unavailable. The owner path parameter and repo path parameter must identify the target repository. The body must include title; title accepts a string or integer, and permissions are not applicable to this request.