---
title: "Create a key (secret is shown once)"
method: POST
path: "/api/v2/api-keys"
tags: ["v2 API Keys"]
---

# Create a key (secret is shown once)

`POST /api/v2/api-keys`

## Request

- Base URL: `https://pdf2md.dev`
- URL: `https://pdf2md.dev/api/v2/api-keys`
- Auth: one of:
  - API key in cookie `p2m_session`
  - HTTP bearer

## Request body

- V2ApiKeyCreateRequest
  - `name` string, required
  - `scopes` string[]
  - `expires_at` string, date-time, nullable

## Response `201`

Key created

- V2ApiKeyCreated
  - `id` string, uuid, required
  - `name` string, required
  - `prefix` string, required
  - `scopes` string[], required
  - `last_used_at` string, date-time, nullable
  - `expires_at` string, date-time, nullable
  - `created_at` string, date-time, required
  - `secret` string, required: Full secret p2m_... — shown ONCE; only the hash is stored on the server (security.md)

## Other responses

- `400`: Invalid data (not a PDF, no url/file, broken link)
- `401`: Missing/invalid API key or session
- `403`: Not linked / key limit reached

---

[API](https://skmtc.dev/pdf2md/apis/pdf-to-markdown-api-facade.md) · [All operations](https://skmtc.dev/pdf2md/apis/pdf-to-markdown-api-facade/llms.txt) · [OpenAPI document](https://skmtc.dev/pdf2md/apis/pdf-to-markdown-api-facade/revisions/4636782fb8b6?raw)
