Sample - GitHub REST API
POST/repos/{owner}/{repo}/issues

Create an issue

Creates a new issue in a repository. Supply a title and optionally set the issue body, assignees, milestone, labels, issue fields, type, or parent issue; creating an issue also triggers notifications. Users with pull access can create issues, while fields that require push or triage access may be silently dropped when the caller lacks that access.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

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, including the required title and optional content, assignments, metadata, and relationships.

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 as the milestone number; users without push access cannot set it, and 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, including its identifier, repository and issue URLs, number, state, title, body, author, labels, milestone, and related issue metadata.
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 malformed or contains invalid issue data.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Returned when the authenticated user is not permitted to create an issue in the repository.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the repository or a referenced resource cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
410Returned when issues are disabled for the repository.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when issue 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 malformed request, a 403 when the authenticated user cannot create the issue, a 404 when the repository or referenced resource is not found, and a 410 when issues are disabled for the repository. A 422 is returned when validation fails or the endpoint has been spammed, and a 503 when the service is unavailable. title is required; milestone may be a string or integer, labels and assignees must be arrays when supplied, and each issue_field_values item must include field_id and value.