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

Update an issue

Updates an existing issue or pull request in a repository. Supply only the fields you want to change, including title, body, state, labels, assignees, milestones, or issue field values. Changes to labels, assignees, milestones, and issue types may be silently dropped without push access.

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

3 parameters · 11 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 integer that identifies the issue or pull request within the repository.

Fields to update on an issue or pull request; omit fields that should retain their current values.

titlestringoptional
The title of the issue.
bodystringoptional
The contents of the issue.
assigneestringoptional
Username to assign to this issue. **This field is closing down.**
statestringoptional
The open or closed state of the issue.
Allowed:openclosed
state_reasonstringoptional
The reason for the state change. Ignored unless `state` is changed.
Allowed:completednot_plannedduplicatereopened
duplicate_issue_idintegeroptional
The ID of the issue to mark as the canonical duplicate when `state_reason` is `duplicate`. The issue must exist and be accessible to the authenticated user. Ignored when `state_reason` is not `duplicate`.
milestonestringoptional
The milestone number to associate with the issue, or null to remove the current milestone; a string value is also accepted by the schema.
labelsarray<string>optional
Labels to associate with this issue. Pass one or more labels to _replace_ the set of labels on this issue. Send an empty array (`[]`) to clear all labels from the issue. Only users with push access can set labels for issues. Without push access to the repository, label changes are silently dropped.
assigneesarray<string>optional
Usernames to assign to this issue. Pass one or more user logins to _replace_ the set of assignees on this issue. Send an empty array (`[]`) to clear all assignees from the issue. Only users with push access can set assignees for new issues. Without push access to the repository, assignee changes are silently dropped.
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. Only users with push access can set field values for issues
typestringoptional
The issue type to associate with this issue. Only users with push access can set the type for issues. Without push access to the repository, type changes are silently dropped.

7 status codes
200Returns the updated issue or pull request object, including its current state, title, body, labels, assignees, and other fields.
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
suggestionsobjectoptional
Pending suggestions for each suggestible field (`type`, `issue_field_values`, `labels`, `assignees`, `state`) the request touched. Omitted for fields not in the request or with no pending or ignored suggestions. Items tagged `ignored` are echoes of the current request's inputs that were not persisted as pending suggestions.
301Returned when the issue was transferred to another repository and the response redirects to its new location.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Returned when the authenticated user does not have permission to edit the issue.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the repository or issue does not exist or is not accessible.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
410Returned when the issue is gone.
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 403 is returned when the authenticated user lacks permission to edit the issue, and a 404 is returned when the repository or issue cannot be found. A 410 is returned when the issue is gone, while a 422 indicates validation failure or excessive activity; a 503 indicates service unavailability. state must be open or closed, and state_reason must be completed, not_planned, duplicate, or reopened.