---
title: "Create Api Key"
method: POST
path: "/agent_api_keys"
tags: ["Agent APIKeys"]
---

# Create Api Key

`POST /agent_api_keys`

## Request body

- CreateAPIKeyRequest
  - `agent_id` string, nullable — The UUID of the agent
  - `agent_name` string, nullable — The name of the agent - if not provided, the agent_id must be set.
  - `api_key` string, nullable — Optionally provide the API key value - if not set, one will be generated.
  - `api_key_type` 'internal' | 'external' | 'github' | 'slack'
  - `name` string, required — The name of the agent's API key.

## Response `200`

Successful Response

- CreateAPIKeyResponse
  - `agent_id` string, required — The UUID of the agent
  - `api_key` string, required — The value of the newly created API key.
  - `api_key_type` 'internal' | 'external' | 'github' | 'slack', required
  - `created_at` string, date-time, required — When the agent API key was created
  - `id` string, required — The unique identifier of the agent API key.
  - `name` string, nullable, required — The optional name of the agent API key.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/terminaluse/apis/sb0-api.md) · [All operations](https://skmtc.net/terminaluse/apis/sb0-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/terminaluse/sb0-api/versions/f24a474dc415/schema)
