---
title: "Create an Agent Pool Access Token"
method: POST
path: "/agent-pools/{agent_pool}/access-tokens"
tags: ["access-tokens"]
---

# Create an Agent Pool Access Token

`POST /agent-pools/{agent_pool}/access-tokens`

## Request

- Base URL: `https://example.scalr.io/api/iacp/v3`
- URL: `https://example.scalr.io/api/iacp/v3/agent-pools/{agent_pool}/access-tokens`
- Auth: HTTP bearer

This endpoint creates agent pool's access token.

## Path parameters

- `agent_pool` string, required

## Query parameters

- `include` string[]

## Request body

- AccessTokenDocument: JSON:API Document. see: https://jsonapi.org/format/#document-structure
  - `data` AccessToken: Access Token for the Scalr API.
    - `attributes` object
      - `created-at` string, date-time: Date/Time the token was created.
      - `description` string, nullable: The description of the token.
      - `expires-at` string, date-time, nullable: Date/Time when the token is set to expire.
      - `expires-in` integer, nullable: The number of minutes until the token expires.
      - `is-expired` boolean: Whether the token is expired.
      - `last-used-at` string, date-time, nullable: Date/Time when the token was last used.
      - `name` string, nullable: The name of the token.
      - `token` string, nullable: The JWT token which an API client should pass in the `Authorization: Bearer <token>` header. Available only in the [Create an Access Token](#create-an-access-token) response.
    - `id` string
    - `links` object
      - `self` string
    - `relationships` object
      - `created-by` object: The user who created the token.
        - `data` object, nullable, required
          - `id` string, required
          - `type` 'users' | '', required
    - `type` 'access-tokens', required
  - `included` object[]
  - `meta` object

## Response `201`

Successfully created.

- AccessTokenDocument: JSON:API Document. see: https://jsonapi.org/format/#document-structure
  - `data` AccessToken: Access Token for the Scalr API.
    - `attributes` object
      - `created-at` string, date-time: Date/Time the token was created.
      - `description` string, nullable: The description of the token.
      - `expires-at` string, date-time, nullable: Date/Time when the token is set to expire.
      - `expires-in` integer, nullable: The number of minutes until the token expires.
      - `is-expired` boolean: Whether the token is expired.
      - `last-used-at` string, date-time, nullable: Date/Time when the token was last used.
      - `name` string, nullable: The name of the token.
      - `token` string, nullable: The JWT token which an API client should pass in the `Authorization: Bearer <token>` header. Available only in the [Create an Access Token](#create-an-access-token) response.
    - `id` string
    - `links` object
      - `self` string
    - `relationships` object
      - `created-by` object: The user who created the token.
        - `data` object, nullable, required
          - `id` string, required
          - `type` 'users' | '', required
    - `type` 'access-tokens', required
  - `included` object[]
  - `meta` object

## Other responses

- `422`: Malformed request body (missing attributes, wrong types, etc.).
- `4XX`: Client error.
- `5XX`: Server error.

---

[API](https://skmtc.dev/scalr/apis/scalr-iacp-api.md) - [All operations](https://skmtc.dev/scalr/apis/scalr-iacp-api/llms.txt) - [OpenAPI document](https://skmtc.dev/scalr/apis/scalr-iacp-api/revisions/d3e1dc85657a?raw)
