Search + K

Command Palette

Search for a command to run...

Sign In

Create an issue

POST /repos/{owner}/{repo}/issues
Copy endpoint
https://api.github.com

Any user with pull access to a repository can create an issue. If issues are disabled in the repository, the API returns a 410 Gone status.

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see "Rate limits for the API" and "Best practices for using the REST API."

This endpoint supports the following custom media types. For more information, see "Media types."

  • application/vnd.github.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
  • application/vnd.github.text+json: Returns a text only representation of the markdown body. Response will include body_text.
  • application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
  • application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.

Parameters

path Path Parameters

Name Type
owner required

The account owner of the repository. The name is not case sensitive.

string
repo required

The name of the repository without the .git extension. The name is not case sensitive.

string

Request Body

application/json required
{
title: string | number;
body?: string;
assignee?: string | null;
milestone?: string | number;
labels?: ({
id?: number;
name?: string;
description?: string | null;
color?: string | null;
}
| string
)[]
;
assignees?: string[];
type?: string | null;
}

Responses

201 application/json

Response

interface Issue {
id: number;
node_id: string;
url: string;
repository_url: string;
labels_url: string;
comments_url: string;
events_url: string;
html_url: string;
number: number;
state: string;
state_reason?: "completed" | "reopened" | "not_planned" | "duplicate" | null;
title: string;
body?: string | null;
user: SimpleUser

A GitHub user.

interface SimpleUser {
name?: string | null;
email?: string | null;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string;
user_view_type?: string;
}
| null
;
labels: ({
id?: number;
node_id?: string;
url?: string;
name?: string;
description?: string | null;
color?: string | null;
default?: boolean;
}
| string
)[]
;
assignee: SimpleUser

A GitHub user.

interface SimpleUser {
name?: string | null;
email?: string | null;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string;
user_view_type?: string;
}
| null
;
assignees?: SimpleUser

A GitHub user.

interface SimpleUser {
name?: string | null;
email?: string | null;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string;
user_view_type?: string;
}
[]
| null
;
milestone: Milestone

A collection of related issues and pull requests.

interface Milestone {
url: string;
html_url: string;
labels_url: string;
id: number;
node_id: string;
number: number;
state: "open" | "closed";
title: string;
description: string | null;
creator: SimpleUser | null;
open_issues: number;
closed_issues: number;
created_at: string;
updated_at: string;
closed_at: string | null;
due_on: string | null;
}
| null
;
locked: boolean;
active_lock_reason?: string | null;
comments: number;
pull_request?: {
merged_at?: string | null;
diff_url: string | null;
html_url: string | null;
patch_url: string | null;
url: string | null;
}
;
closed_at: string | null;
created_at: string;
updated_at: string;
draft?: boolean;
closed_by?: SimpleUser

A GitHub user.

interface SimpleUser {
name?: string | null;
email?: string | null;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string;
user_view_type?: string;
}
| null
;
body_html?: string;
body_text?: string;
timeline_url?: string;
type?: IssueType

The type of issue.

type IssueType = {
id: number;
node_id: string;
name: string;
description: string | null;
color?: "gray" | "blue" | "green" | "yellow" | "orange" | "red" | "pink" | "purple" | null;
created_at?: string;
updated_at?: string;
is_enabled?: boolean;
}
| null
;
repository?: Repository

A repository on GitHub.

interface Repository {
id: number;
node_id: string;
name: string;
full_name: string;
license: LicenseSimple | null;
forks: number;
permissions?: {
admin: boolean;
pull: boolean;
triage?: boolean;
push: boolean;
maintain?: boolean;
}
;
owner: SimpleUser;
private: boolean;
html_url: string;
description: string | null;
fork: boolean;
url: string;
archive_url: string;
assignees_url: string;
blobs_url: string;
branches_url: string;
collaborators_url: string;
comments_url: string;
commits_url: string;
compare_url: string;
contents_url: string;
contributors_url: string;
deployments_url: string;
downloads_url: string;
events_url: string;
forks_url: string;
git_commits_url: string;
git_refs_url: string;
git_tags_url: string;
git_url: string;
issue_comment_url: string;
issue_events_url: string;
issues_url: string;
keys_url: string;
labels_url: string;
languages_url: string;
merges_url: string;
milestones_url: string;
notifications_url: string;
pulls_url: string;
releases_url: string;
ssh_url: string;
stargazers_url: string;
statuses_url: string;
subscribers_url: string;
subscription_url: string;
tags_url: string;
teams_url: string;
trees_url: string;
clone_url: string;
mirror_url: string | null;
hooks_url: string;
svn_url: string;
homepage: string | null;
language: string | null;
forks_count: number;
stargazers_count: number;
watchers_count: number;
size: number;
default_branch: string;
open_issues_count: number;
is_template?: boolean;
topics?: string[];
has_issues: boolean;
has_projects: boolean;
has_wiki: boolean;
has_pages: boolean;
has_downloads: boolean;
has_discussions?: boolean;
archived: boolean;
disabled: boolean;
visibility?: string;
pushed_at: string | null;
created_at: string | null;
updated_at: string | null;
allow_rebase_merge?: boolean;
temp_clone_token?: string;
allow_squash_merge?: boolean;
allow_auto_merge?: boolean;
delete_branch_on_merge?: boolean;
allow_update_branch?: boolean;
use_squash_pr_title_as_default?: boolean;
squash_merge_commit_title?: "PR_TITLE" | "COMMIT_OR_PR_TITLE";
squash_merge_commit_message?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK";
merge_commit_title?: "PR_TITLE" | "MERGE_MESSAGE";
merge_commit_message?: "PR_BODY" | "PR_TITLE" | "BLANK";
allow_merge_commit?: boolean;
allow_forking?: boolean;
web_commit_signoff_required?: boolean;
open_issues: number;
watchers: number;
master_branch?: string;
starred_at?: string;
anonymous_access_enabled?: boolean;
code_search_index_status?: { lexical_search_ok?: boolean;lexical_commit_sha?: string; };
}
;
performed_via_github_app?: Integration

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.

type Integration = {
id: number;
slug?: string;
node_id: string;
client_id?: string;
owner: SimpleUser | Enterprise;
name: string;
description: string | null;
external_url: string;
html_url: string;
created_at: string;
updated_at: string;
permissions: {
issues?: string;
checks?: string;
metadata?: string;
contents?: string;
deployments?: string;
[key: string]: string;
}
;
events: string[];
installations_count?: number;
}
| null
| null
;
author_association?: AuthorAssociation

How the author is associated with the repository.

type AuthorAssociation = "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "MEMBER" | "NONE" | "OWNER"
;
reactions?: ReactionRollup
interface ReactionRollup {
url: string;
total_count: number;
+1: number;
-1: number;
laugh: number;
confused: number;
heart: number;
hooray: number;
eyes: number;
rocket: number;
}
;
sub_issues_summary?: SubIssuesSummary
interface SubIssuesSummary {
total: number;
completed: number;
percent_completed: number;
}
;
parent_issue_url?: string | null;
issue_dependencies_summary?: IssueDependenciesSummary
interface IssueDependenciesSummary {
blocked_by: number;
blocking: number;
total_blocked_by: number;
total_blocking: number;
}
;
issue_field_values?: IssueFieldValue

A value assigned to an issue field

interface IssueFieldValue {
issue_field_id: number;
node_id: string;
data_type: "text" | "single_select" | "number" | "date";
value: string | number;
single_select_option?: { id: number;name: string;color: string; } | null;
}
[]
;
}

Client Errors

400 application/json

Bad Request

interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
403 application/json

Forbidden

interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
404 application/json

Resource not found

interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
410 application/json

Gone

interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
422 application/json

Validation failed, or the endpoint has been spammed.

interface ValidationError {
message: string;
documentation_url: string;
errors?: {
resource?: string;
field?: string;
message?: string;
code: string;
index?: number;
value?: string[] | string | number | null;
}
[]
;
}

Server Errors

503 application/json

Service unavailable

{ code?: string;message?: string;documentation_url?: string; }