---
title: "Create API Key"
method: POST
path: "/api-keys"
---

# Create API Key

`POST /api-keys`

## Request body

- CreateAPIKeyParams
  - `$schema` string, uri — A URL to the JSON Schema for this object.
  - `expires_at` string, date-time, nullable — When this API key expires.
  - `name` string, required
  - `scopes` string, nullable — Space separated scopes that this API key is valid for.
  - `team` string, nullable — The team this API key is associated with. This field is optional. You must be a member of the team that you're creating the API key for, and if you're using an API key to create a new API key, the API key you use to authenticate this request must be a personal API key.

## Response `201`

Created

- CreateAPIKeyResponse
  - `$schema` string, uri — A URL to the JSON Schema for this object.
  - `api_key` APIKey, required
    - `created_at` string, date-time, required
    - `expires_at` string, date-time
    - `identifier` string, required
    - `last_used_at` string, date-time, nullable, required
    - `name` string, required
    - `owner` APIKeyOwner
      - `name` string, required — The owner's name: a user's full name (or email) or a service account's name.
      - `type` 'user' | 'service_account', required — The kind of principal this API key authenticates as.
    - `scopes` string

## Other responses

- `default` — Error

---

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