---
title: "Create an API key"
method: POST
path: "/spaces/{space_id}/api_keys"
---

# Create an API key

`POST /spaces/{space_id}/api_keys`

Creates a new API key (client credentials) for the specified space.
Requires user authentication (JWT). API keys cannot create other API keys.

## Path parameters

- `space_id` string, required

## Request body

- CreateApiKeyRequest — Request to create a new API key in a space.
  - `name` string, required — User-provided label for the new API key.

## Response `201`

API key created

- ApiKeyCredentials — Credentials for a newly created API key. The secret portion cannot be retrieved again later.
  - `api_key` string, required — Bearer token for the key. Use as `Authorization: Bearer <api_key>`.
  - `access_key` string, required — Use as the username in HTTP Basic auth.
  - `secret_key` string, required — Use as the password in HTTP Basic auth.

## Other responses

- `default` — Error response

---

[API](https://skmtc.net/timescale/apis/ghost-api.md) · [All operations](https://skmtc.net/timescale/apis/ghost-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/timescale/ghost-api/revisions/808022f897be/schema)
