Generate an access token for the specified user
POST
/users/{username}/tokens
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ” username
required
string
Username of user
Request Body
Section titled “ Request Body ” Media type application/json
CreateAccessTokenOption options when create access token
object
name
required
string
repositories
If provided and not-empty, creates an access token with access only to specified repositories.
Array<object>
object
name
required
Name of repository
string
owner
required
Name of user or organisation that owns the repository
string
scopes
Array<string>
Example
[ "all", "read:activitypub", "read:issue", "write:misc", "read:notification", "read:organization", "read:package", "read:repository", "read:user"]Responses
Section titled “ Responses ”AccessToken represents an API access token.
Media type application/json
AccessToken represents an API access token.
object
created_at
string format: date-time
id
integer format: int64
name
string
repositories
Indicates that an access token only has access to the specified repositories. Will be null if the access token is not limited to a set of specified repositories.
Array<object>
RepositoryMeta basic repository information
object
full_name
string
id
integer format: int64
name
string
owner
string
scopes
Array<string>
sha1
string
token_last_eight
string
Example generated
{ "created_at": "2026-04-15T12:00:00Z", "id": 1, "name": "example", "repositories": [ { "full_name": "example", "id": 1, "name": "example", "owner": "example" } ], "scopes": [ "example" ], "sha1": "example", "token_last_eight": "example"}APIError is error format response
Media type application/json
APIError is an api error with a message
object
message
string
url
string
Example generated
{ "message": "example", "url": "example"}APIForbiddenError is a forbidden error response
Media type application/json
object
message
string
url
string
Example generated
{ "message": "example", "url": "example"}APINotFound is a not found error response
Media type application/json
object
errors
Array<string>
message
string
url
string
Example generated
{ "errors": [ "example" ], "message": "example", "url": "example"}