user

Create an access token

Changed on
post/users/{username}/tokens

Request

  • Base URL
    https://demo.gitea.com/api/v1
  • Auth
    • HTTP basic
    • or API key in query parameter token
    • or API key in query parameter access_token
    • or API key in header Authorization
    • or API key in query parameter sudo
    • or API key in header Sudo
    • or API key in header X-GITEA-OTP
  • TypeScript
    A function with typed inputs. Its response is checked against the schema.

Path parameters

usernamestring required

username of the user whose token is to be created

Request body

namestring required
scopesstring[]

Example request

{
  "scopes": [
    "all",
    "read:activitypub",
    "read:issue",
    "write:misc",
    "read:notification",
    "read:organization",
    "read:package",
    "read:repository",
    "read:user"
  ]
}

Response

AccessToken represents an API access token.

created_atstring date-time

The timestamp when the token was created

idinteger

The unique identifier of the access token

last_used_atstring date-time

The timestamp when the token was last used

namestring

The name of the access token

scopesstring[]

The scopes granted to this access token

sha1string

The SHA1 hash of the access token

token_last_eightstring

The last eight characters of the token

Changes

    • info

      removed the non-success response with the status

    • info

      removed the non-success response with the status