---
title: "Create a one-time secret"
method: POST
path: "/api/secrets"
tags: ["One-time secrets"]
---

# Create a one-time secret

`POST /api/secrets`

## Request

- Base URL: `https://brewpage.app`
- URL: `https://brewpage.app/api/secrets`
- Auth: one of:
  - none
  - API key in header `X-Owner-Token`

Stores client-side encrypted text or one file for 1 to 10 views (default 1) and 1h, 1d, 7d or 30d (default 7d), with a title the recipient sees. Owned like a publication: send X-Owner-Token (none: a new one is returned). Share https://brewpage.app/secret/{id}#{key} with the key only in the fragment; manageUrl is for the creator only.

## Headers

- `X-Owner-Token` unknown

## Request body

- SecretCreateRequest
  - `ciphertext` string, required: AES-GCM-256 output (encrypted text plus its 16-byte tag) as base64url without padding, at most 54000 characters. Encrypt in the client; the key never reaches the server.
  - `iv` string, required: The 12-byte AES-GCM nonce as 16 base64url characters.
  - `ttl` '1h' | '1d' | '7d' | '30d', nullable: How long the secret stays readable: 1h, 1d, 7d or 30d. Omitted: 7d.
  - `maxViews` integer, nullable: How many times it can be opened, 1 to 10. Omitted: 1.
  - `title` string, required: Shown to the recipient before opening: never put the secret here. 1-200 characters, one line.
  - `note` string, nullable: Your own note, at most 500 characters; only you see it.
  - `tags` string[]: Your tags, at most 10 of 1-32 characters; only you see them.
  - `kind` 'text' | 'file', nullable: text: UTF-8 text; file: one file in envelope v1. Omitted: text.
  - `keyCheck` string, nullable: base64url of the first 16 bytes of SHA-256("brewpage-secret-key-check-v1" + the 32 key bytes): the page checks a key against it before spending a view.

## Response `201`

Created

- SecretCreateResponse
  - `id` string, required: 22-character secret id. Share https://brewpage.app/secret/{id}#{key}, the key in the fragment only.
  - `ref` string, required: 10-character owner handle of the owner routes; it can't open the secret
  - `kind` 'text' | 'file', required: text or file
  - `title` string, required: Title the recipient sees
  - `expiresAt` string, date-time, required: When the secret stops being readable
  - `maxViews` integer, required: How many times it can be opened
  - `ownerToken` string, required: Owner token: keep it; send it as X-Owner-Token on later creates and owner routes
  - `manageUrl` string, required: Private manage link (status, opens, delete): give it to the creator only, never to the recipient
  - `tags` string[]: Your tags; absent when none
  - `notices` PublishNotice[]: How the request was adjusted; absent when not
    - `code` string, required: Kebab-case, e.g. ttl-clamped, namespace-defaulted, secret-detected, visibility-not-listable, extend-needs-profile, rotate-still-listed, private-domain-detached, badge-hide-needs-profile, owner-token-new (save the new ownerToken, reuse it), credential-published (token or manage link in public content: remove it, reset it), archive-unverified (archive: check contents before opening).
    - `message` string, required

## Other responses

- `400`: SECRET_CIPHERTEXT_INVALID, SECRET_IV_INVALID, SECRET_TTL_INVALID, SECRET_MAX_VIEWS_INVALID, SECRET_KIND_INVALID or SECRET_TOO_LARGE; or a body that is not a JSON object
- `403`: OWNER_TOKEN_REVOKED or OWNER_TOKEN_EXPIRED: omit X-Owner-Token to get a new one
- `409`: SECRET_LIMIT: too many live secrets for this owner (limit, used)
- `413`: Request body over 64 KB
- `429`: Rate limited: wait Retry-After (= retryAfterSeconds); no account: accountUrl, free sign-up with higher limits
- `503`: SECRETS_UNAVAILABLE: temporarily off

## Changes

- **2026-11-22** `83483c70abbd`: 1 breaking, 15 info
  - added the new required request property `title`
  - the endpoint scheme security `OwnerToken` was added to the API
  - added the new optional `header` request parameter `X-Owner-Token`
  - added the new optional request property `keyCheck`
  - …12 more
- **2026-11-22** `21d3daa71f92`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/brewpage/apis/brewpage-api/changes/api/secrets/post.md)

---

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