Create a label
POST
/repos/{owner}/{repo}/labels
const url = 'https://gitea.example.com/api/v1/repos/example/example/labels';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"color":"#00aabb","description":"example","exclusive":false,"is_archived":false,"name":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://gitea.example.com/api/v1/repos/example/example/labels \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "color": "#00aabb", "description": "example", "exclusive": false, "is_archived": false, "name": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”owner
required
string
Owner of the repo
repo
required
string
Name of the repo
Request Body
Section titled “Request Body”Media typeapplication/json
CreateLabelOption options for creating a label
object
color
required
string
Example
#00aabbdescription
Description provides additional context about the label’s purpose
string
exclusive
boolean
Example
falseis_archived
boolean
Example
falsename
required
string
Responses
Section titled “Responses”Label
Media typeapplication/json
Label a label to an issue or a pr
object
color
string
description
Description provides additional context about the label’s purpose
string
exclusive
boolean
id
ID is the unique identifier for the label
integer format: int64
is_archived
boolean
name
Name is the display name of the label
string
url
URL is the API endpoint for accessing this label
string
Example
{ "color": "00aabb", "exclusive": false, "is_archived": false}APINotFound is a not found empty response
Media typeapplication/json
APIValidationError is error format response related to input validation
Media typeapplication/json
Headers
Section titled “Headers”message
string
url
string