---
title: "Create Personal Access Token"
method: POST
path: "/tokens/"
tags: ["Tokens"]
---

# Create Personal Access Token

`POST /tokens/`

Create a new personal access token for authenticating API requests.
#### Request Body A JSON:API-compliant request with token attributes (`name`) and `scopes` as relationships.
#### Returns A `201 Created` response with the newly created token details, including the token itself (`token_id`).
**Note:** The token (`token_id`) is returned **only once** during creation.
#### Errors - `400 Bad Request`: Missing required fields or invalid scope. - `403 Forbidden`: User lacks permission to create tokens.

## Request body

- object
  - `data` object
    - `type` string, required
    - `attributes` object, required
      - `name` string
    - `relationships` object, required
      - `scopes` object
        - `data` object[]
          - `type` string
          - `id` string

## Response `201`

Token successfully created.

- object
  - `data` object
    - `id` string
    - `type` string
    - `attributes` object
      - `name` string
      - `token_id` string
    - `relationships` object
      - `scopes` object
        - `links` object
          - `related` string

---

[API](https://skmtc.net/osf/apis/osf-apiv2-documentation.md) · [All operations](https://skmtc.net/osf/apis/osf-apiv2-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/osf/osf-apiv2-documentation/versions/ca701048eb0d/schema)
