---
title: "Create Api Key"
method: POST
path: "/api/v1/keys"
tags: ["api-keys"]
---

# Create Api Key

`POST /api/v1/keys`

## Request

- Base URL: `https://api.maritime.sh` (the document declares no server; this is the origin it was published from)
- URL: `https://api.maritime.sh/api/v1/keys`
- Auth: HTTP bearer

Create a new API key. The raw key is returned only once.

## Request body

- ApiKeyCreate
  - `name` string, required: Human-readable name for this key
  - `scopes` string[]: Scopes: provision (create), deploy (lifecycle/chat), secrets (env vars), manage (delete + everything, wildcard). Defaults to full access; pass a narrower set to restrict a key.
  - `expires_in_days` integer, nullable: Key expiry in days from now. Null = never expires
  - `project_id` string, nullable: Restrict this key to one project (plan 22 §3). Scoped keys only work on the /api/v1 partner surface (front door, usage) for that project; every other endpoint rejects them.

## Response `201`

Successful Response

- ApiKeyCreated: Returned only on creation. Includes the raw key (shown once).
  - `id` string, required
  - `name` string, required
  - `key_prefix` string, required
  - `scopes` string[], required
  - `is_active` boolean, required
  - `project_id` string, nullable
  - `last_used_at` string, date-time, nullable, required
  - `expires_at` string, date-time, nullable, required
  - `created_at` string, date-time, required
  - `computer_sessions_30d` integer
  - `raw_key` string, required: Full API key. Store securely, shown only once

## Other responses

- `422`: Validation Error

---

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