---
title: "Create an access token"
method: POST
path: "/users/{username}/tokens"
tags: ["Users"]
---

# Create an access token

`POST /users/{username}/tokens`

Requires basic authentication.

## Path parameters

- `username` string, required

## Request body

- object
  - `name` string, required

## Response `201`

Created

- AccessToken
  - `name` string
  - `sha1` string

## Other responses

- `404` — Resource not found.
- `422` — Validation error.

---

[API](https://skmtc.net/gogs/apis/gogs-api.md) · [All operations](https://skmtc.net/gogs/apis/gogs-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gogs/gogs-api/revisions/87e2da32266c/schema)
