---
title: "Create a personal access token"
method: POST
path: "/api/v2/personal_access_tokens"
tags: ["Key Management"]
---

# Create a personal access token

`POST /api/v2/personal_access_tokens`

Create a personal access token for the current user.

## Request body

- PersonalAccessTokenCreateRequest — Request used to create an access token.
  - `data` PersonalAccessTokenCreateData, required — Object used to create an access token.
    - `attributes` PersonalAccessTokenCreateAttributes, required — Attributes used to create an access token.
      - `expires_at` string, date-time, required — Expiration date of the access token. Must be at least 24 hours in the future.
      - `name` string, required — Name of the access token.
      - `scopes` string[], required — Array of scopes to grant the access token.
    - `type` 'personal_access_tokens', required — Personal access tokens resource type.

## Response `201`

Created

- PersonalAccessTokenCreateResponse — Response for creating an access token. Includes the token key.
  - `data` FullPersonalAccessToken — Datadog access token, including the token key.
    - `attributes` FullPersonalAccessTokenAttributes — Attributes of a full access token, including the token key.
      - `created_at` string, date-time — Creation date of the access token.
      - `expires_at` string, date-time, nullable — Expiration date of the access token.
      - `key` string — The access token key. Only returned upon creation.
      - `name` string — Name of the access token.
      - `public_portion` string — The public portion of the access token.
      - `scopes` string[] — Array of scopes granted to the access token.
    - `id` string — ID of the access token.
    - `relationships` PersonalAccessTokenRelationships — Resources related to the access token.
      - `owned_by` RelationshipToUser — Relationship to user.
        - `data` RelationshipToUserData, required — Relationship to user object.
          - `id` string, required — A unique identifier that represents the user.
          - `type` 'users', required — Users resource type.
    - `type` 'personal_access_tokens' — Personal access tokens resource type.

## Other responses

- `400` — Bad Request
- `403` — Forbidden
- `429` — Too many requests

---

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