跳转到内容
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!
Support
This is the documentation of 21.11.0, which is no longer the latest release. See the latest release.

Create an access token

POST
/users/{username}/tokens
curl --request POST \
--url https://gitea.example.com/api/v1/users/example/tokens \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "scopes": [ "example" ] }'
username
required
string

Username of user

Media typeapplication/json

CreateAccessTokenOption options when create access token

object
name
required
string
scopes
Array<string>
Examplegenerated
{
"name": "example",
"scopes": [
"example"
]
}

AccessToken represents an API access token.

Media typeapplication/json
AccessToken represents an API access token.
object
id
integer format: int64
name
string
scopes
Array<string>
sha1
string
token_last_eight
string
Examplegenerated
{
"id": 1,
"name": "example",
"scopes": [
"example"
],
"sha1": "example",
"token_last_eight": "example"
}

APIError is error format response

Media typeapplication/json
message
string
url
string

APIForbiddenError is a forbidden error response

Media typeapplication/json
message
string
url
string