Create a label
POST
/repos/{owner}/{repo}/labels https://api.github.com
Creates a label for the specified repository with the given name and color. The name and color parameters are required. The color must be a valid hexadecimal color code.
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 | string |
Request Body
application/json
required
{ name: string;color?: string;description?: string; }
Responses
201 application/json
Response
interface Label {
id: number;
node_id: string;
url: string;
name: string;
description: string | null;
color: string;
default: boolean;
}
id: number;
node_id: string;
url: string;
name: string;
description: string | null;
color: string;
default: boolean;
}
Client Errors
404 application/json
Resource not found
interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
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;
}[];
}
message: string;
documentation_url: string;
errors?: {
resource?: string;
field?: string;
message?: string;
code: string;
index?: number;
value?: string[] | string | number | null;
}[];
}