---
title: "Create access token for service account"
method: POST
path: "/service-accounts/{service_account}/access-tokens"
tags: ["access-tokens"]
---

# Create access token for service account

`POST /service-accounts/{service_account}/access-tokens`

## Request

- Base URL: `https://example.scalr.io/api/iacp/v3`
- URL: `https://example.scalr.io/api/iacp/v3/service-accounts/{service_account}/access-tokens`
- Auth: HTTP bearer

This endpoint creates service account's access token.

## Path parameters

- `service_account` 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

- `404`: Service account not found, or user unauthorized to perform action.
- `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)
