---
title: "Create an API key"
description: "Companies and keys API"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.certinvo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an API key

{/* Generated by apps/docs/scripts/generate.ts from contracts/api/openapi.yaml. Do not edit. */}
<div class="cvo-op">
<div class="cvo-op-main">

<div class="cvo-op-header">
<div class="cvo-op-path-row">
<span class="cvo-method" data-method="post">POST</span>
<code class="cvo-op-path-code">/v1/keys</code>
</div>
</div>

Mints one API key for the company of the signed-in person, and returns it with the secret.

**The secret is in this response and nowhere else.** It is never stored, so it cannot be read back, shown again or recovered by support. Save it when you receive it.

The request chooses only the name. The company comes from the session, and the environment is that company's own: a Sandbox session mints a `cvo_test_…` key and a Live session mints a `cvo_live_…` key.

Only a signed-in person may call this. An API key is refused with 401 `session_required`, because a key that could mint a key could outlive its own revocation.

The person must have signed in within the last 10 minutes, as the session's `auth_time` says. An older sign-in is refused with 401 `reauthentication_required`; the console then asks them to sign in again. Listing and revoking keys need no fresh sign-in.

## Request body

`application/json`, required

## Response

A `201` answer carries these fields.

## Status codes

| Status | Meaning |
|---|---|
| `201` | The key, with its secret. The secret is not returned again by any route. |
| `400` | The name is missing, empty or longer than 60 characters (`invalid_key`). Nothing was minted. |
| `401` | No usable credential was sent (`invalid_credentials`), an API key was used where only a signed-in person may act (`session_required`), or the sign-in is more than 10 minutes old (`reauthentication_required`). Nothing was minted. |
| `503` | This deployment is not configured to verify API keys, so it does not issue them (`no_database`). |

</div>
<div class="cvo-op-aside">

</div>
</div>

Source: https://docs.certinvo.com/reference/api/workspaces/create-an-api-key/index.mdx
