---
title: "Create a new user token by admin user"
method: POST
path: "/users/{user_id}/tokens"
tags: ["users"]
---

# Create a new user token by admin user

`POST /users/{user_id}/tokens`

Give access to allow user to do specific actions on one or more resources

## Path parameters

- `user_id` string, required

## Request body

- union — The token could be created either `scope` or `resource` based.
  - UserTokenCreateResourceRequest
    - `name` string, required
    - `metadata` object
    - `expires_at` string
    - `resources` UserTokenPermissionResourceItem[], required
      - `resource_type` 'channel' | 'subchannel' | 'artifact', required
      - `resource_id` string, required — resource name
      - `permission` string, required
  - UserTokenCreateScopedRequest
    - `name` string, required
    - `metadata` object
    - `expires_at` string, date
    - `scopes` string[], required

## Response `200`

Created token object, which also contains the token itself and id of the token

- UserTokenCreateResponse
  - `id` string — Token Id, represents the token position for token management
  - `token` string — Token itself. It's one-time generated, couldn't be read with different api.

## Other responses

- `401` — Unauthenticated, no token is provided or token is invalid
- `403` — Access is forbidden
- `500` — Internal server error

---

[API](https://skmtc.net/anaconda/apis/anaconda-server-api.md) · [All operations](https://skmtc.net/anaconda/apis/anaconda-server-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/anaconda/anaconda-server-api/versions/6aef0cb7a151/schema)
