---
title: "Create Agent API Key"
method: POST
path: "/api/v1/organizations/users/{userId}/agents/{agentId}/api-keys"
---

# Create Agent API Key

`POST /api/v1/organizations/users/{userId}/agents/{agentId}/api-keys`

## Request

- Base URL: `https://api.skyfire.xyz`
- URL: `https://api.skyfire.xyz/api/v1/organizations/users/{userId}/agents/{agentId}/api-keys`
- Auth: API key in header `skyfire-api-key`

As an Organization Admin, create a new API key for an agent belonging to a user in your organization.

## Path parameters

- `userId` string, uuid, required
- `agentId` string, uuid, required

## Request body

- object
  - `notes` string: Free-form label for the key, e.g. a rotation batch or environment name. At most 1000 characters.

## Response `200`

Ok

- object
  - `id` string, required: Unique identifier of the API key. Use this ID to activate or deactivate the key.
  - `apiKey` string, required: The raw API key. Returned only in this response — it cannot be retrieved again.
  - `lastFour` string, required: Last four characters of the key, for identifying it in listings.
  - `active` boolean, required: Whether the key currently authenticates. Always `true` on creation.
  - `notes` string: The label provided at creation. Omitted when none was set.
  - `createdAt` string, required: When the key was created. e.g. `"2026-08-28T17:04:11.000Z"`.

## Other responses

- `401`: Unauthorized
- `404`: Not Found
- `422`: Unprocessable Entity

## Changes

- **2026-11-03** `22cbec9d7630`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/skyfire/apis/skyfire-agent-and-token-apis/changes/api/v1/organizations/users/:userId/agents/:agentId/api-keys/post.md)

---

[API](https://skmtc.dev/skyfire/apis/skyfire-agent-and-token-apis.md) - [All operations](https://skmtc.dev/skyfire/apis/skyfire-agent-and-token-apis/llms.txt) - [OpenAPI document](https://skmtc.dev/skyfire/apis/skyfire-agent-and-token-apis/revisions/22cbec9d7630?raw)
