---
title: "Create team API key"
method: POST
path: "/api-keys"
tags: ["api-keys"]
---

# Create team API key

`POST /api-keys`

Create a new team API key

## Request body

- NewTeamAPIKey
  - `name` string, required — Name of the API key

## Response `201`

Team API key created successfully

- CreatedTeamAPIKey
  - `id` string, uuid, required — Identifier of the API key
  - `key` string, required — Raw value of the API key
  - `mask` IdentifierMaskingDetails, required
    - `prefix` string, required — Prefix that identifies the token or key type
    - `valueLength` integer, required — Length of the token or key
    - `maskedValuePrefix` string, required — Prefix used in masked version of the token or key
    - `maskedValueSuffix` string, required — Suffix used in masked version of the token or key
  - `name` string, required — Name of the API key
  - `createdAt` string, date-time, required — Timestamp of API key creation
  - `createdBy` TeamUser
    - `id` string, uuid, required — Identifier of the user
    - `email` string, nullable, required — Email of the user
  - `lastUsed` string, date-time, nullable — Last time this API key was used

## Other responses

- `401` — Authentication error
- `500` — Server error

## Changes

- **2026-08-20** `e01b3f5506fe` — 2 info
  - added the optional property `error_code` to the response with the `401` status
  - added the optional property `error_code` to the response with the `500` status
- **2026-07-24** `93ed246a4c10` — 1 info
  - the endpoint scheme security `Supabase1TokenAuth AND Supabase2TeamAuth` was removed from the API
- **2026-05-27** `e13ef89d456c` — 1 breaking, 2 info
  - the response property `createdBy/allOf[#/components/schemas/TeamUser]/email` became nullable for the status `201`
  - the endpoint scheme security `AuthProviderBearerAuth AND AuthProviderTeamAuth` was added to the API
  - response property `createdBy/allOf[#/components/schemas/TeamUser]/email` deprecated
- **2025-07-18** `c1fe6498cb2f` — 3 breaking, 1 info
  - the response property `createdBy` became optional for the status `201`
  - the response property `lastUsed` became optional for the status `201`
  - removed the required property `keyMask` from the response with the `201` status
  - added the required property `mask` to the response with the `201` status
- **2025-03-21** `ca973917d2e1` — 1 info
  - endpoint added

[Full history](https://skmtc.dev/e2b-dev/apis/e2b-api/changes/api-keys/post.md)

---

[API](https://skmtc.dev/e2b-dev/apis/e2b-api.md) · [All operations](https://skmtc.dev/e2b-dev/apis/e2b-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/e2b-dev/e2b-api/revisions/e01b3f5506fe/schema)
