---
title: "Create an API key"
method: POST
path: "/apiKeys.create"
tags: ["ApiKeys"]
---

# Create an API key

`POST /apiKeys.create`

## Request

- Base URL: `https://app.getoutline.com/api`
- URL: `https://app.getoutline.com/api/apiKeys.create`
- Auth: one of:
  - HTTP bearer
  - OAuth 2
    - Authorization code: `https://app.getoutline.com/oauth/authorize`
    - Token URL: `https://app.getoutline.com/oauth/token` scopes: `read`, `write`

Create a new personal API key for the authenticated user. The full key `value` is only returned in this response and cannot be retrieved again, so it should be stored securely.

## Request body

- object
  - `name` string, required: A name to identify the API key.
  - `expiresAt` string, date-time: An optional date and time when the key should expire.
  - `scope` string[]: An optional list of scopes to restrict which endpoints the key can access.

## Response `200`

OK

- object
  - `data` ApiKey
    - `id` string, uuid: Unique identifier for the object.
    - `name` string: A user provided name for the API key.
    - `scope` string[], nullable: An optional list of scopes that restrict which endpoints the key can access. When `null` the key has access to all endpoints available to the user.
    - `last4` string: The last four characters of the key, used to help identify it.
    - `value` string: The full secret value of the key. Only returned once, in the response to `apiKeys.create`.
    - `expiresAt` string, date-time, nullable: Date and time when this key expires, if ever.
    - `lastActiveAt` string, date-time, nullable: Date and time when this key was last used.
    - `createdAt` string, date-time: Date and time when this key was created.
    - `updatedAt` string, date-time: Date and time when this key was last updated.

## Other responses

- `400`: The request failed one or more validations.
- `401`: The API key is missing or otherwise invalid.
- `403`: The current API key is not authorized to perform this action.
- `429`: The request was rate limited.

## Changes

- **2026-09-22** `cd18cbbc1706`: 1 warning
  - the `name` request property's maxLength was set to `255`
- **2026-09-05** `6287bce7caad`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/defaulr/apis/outline-api/changes/apiKeys.create/post.md)

---

[API](https://skmtc.dev/defaulr/apis/outline-api.md) - [All operations](https://skmtc.dev/defaulr/apis/outline-api/llms.txt) - [OpenAPI document](https://skmtc.dev/defaulr/apis/outline-api/revisions/5ddf01ffba84?raw)
