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

# Create Share Key

`POST /api/v1/config/share-keys`

## Request

- Base URL: `https://memory.kagura-ai.com` (the document declares no server; this is the origin it was published from)
- URL: `https://memory.kagura-ai.com/api/v1/config/share-keys`
- Auth: none declared

Mint a read-only, TTL-bounded share key for one owned context (#1027).

The caller must OWN ``context_id`` — enforced via
``check_context_access(..., OWNER)``, which raises a uniform 404 if the
context does not exist, and 403 if the caller lacks owner access (whether
they are a non-member or a member without owner rights — the 403 does not
distinguish, to avoid leaking membership). This prevents minting a share
key for a context the user cannot administer.

## Headers

- `authorization` string, nullable

## Request body

- ShareKeyCreate: Request to mint a share key bound to one owned context.
  - `name` string, required: Friendly name
  - `context_id` string, uuid, required: The single context to confine the key to (must be owned)
  - `ttl_days` integer, nullable: Requested lifetime in days. Clamped server-side to a 30-day ceiling; omit for the 30-day default.

## Response `201`

Successful Response

- ShareKeyCreateResponse: Mint response — includes the plaintext key ONCE.
  - `id` unknown, required
  - `key_prefix` unknown, required
  - `name` unknown, required
  - `user_id` unknown, required
  - `context_id` unknown, required
  - `scope` unknown, required
  - `created_at` unknown, required
  - `last_used_at` unknown
  - `revoked_at` unknown
  - `expires_at` unknown, required
  - `status` unknown, required
  - `share_key` unknown, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud.md) · [All operations](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/llms.txt) · [OpenAPI document](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/revisions/09f17f5ada29?raw)
