---
title: "Create a new token"
method: POST
path: "/api/v1/tokens"
tags: ["tokens"]
---

# Create a new token

`POST /api/v1/tokens`

This can only be done by a logged in user who has the required privileges.

## Request body

- TokenCreate
  - `inquirer` string, required — Id of user or a service running on behalf of the user. Who wants the token to be created.
  - `initiator` string — user or a a service who initiated this token request. Who is requesting the token creation (must have the permission to create a token). Defaults to requester id.
  - `accountId` string, required — Affected account the token is created for
  - `token` string
  - `type` 'EPHEMERAL_SERVICE_ACCOUNT' | 'PERSISTENT' | 'SELF'
  - `permissions` Permissions[]
  - `expiresIn` string — Sets the lifespan of the token. Possible values are -1 for permanent token and a string expression describing a time span, e.g. 2m, 5h

## Response `200`

Id of created user

- object
  - `token` string

## Changes

- **2021-08-25** `46700dd5e784` — 2 breaking
  - the request property `accountId` became required
  - the request property `inquirer` became required
- **2020-11-01** `23859774a104` — 1 warning, 1 info
  - removed the request property `tokenLifeSpan`
  - added the new optional request property `expiresIn`
- **2019-08-15** `42619b8ccbbe` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/openintegrationhub/apis/iam-api-for-oih/changes/api/v1/tokens/post.md)

---

[API](https://skmtc.dev/openintegrationhub/apis/iam-api-for-oih.md) · [All operations](https://skmtc.dev/openintegrationhub/apis/iam-api-for-oih/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/openintegrationhub/iam-api-for-oih/revisions/016871a170fd/schema)
