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

# Authentication

> Use a browser session to manage a workspace and a bearer key to generate documents from a server or automation.

## Create a workspace key

In the [workspace](https://dockiln.io/app), open **Settings → API keys**, give the key a recognizable name and select **Create key**. Copy the full value before leaving the screen. DocKiln stores its hash. The key list shows metadata and cannot recover the original value.

Put the value in your application's secret store as `DOCKILN_API_KEY`. Keep it out of browser bundles, URLs and request logs. Use the same origin as the workspace for `DOCKILN_URL`.

```bash title="Verify a key" theme={null}
curl -fsS "$DOCKILN_URL/v1/usage" \
  -H "Authorization: Bearer $DOCKILN_API_KEY"
```

The response contains `used`, `quota` and `resetsAt` in Unix milliseconds. The request reads usage without creating a document.

## Browser sign-in during migration

On a deployment with Neon Managed Better Auth enabled, open the workspace and choose email and password or one of the displayed social providers. Email registrations require verification. The login screen can resend the verification message or request a password reset. After resetting, sign in with the new password.

For an existing workspace, sign in with a verified identity using the same email, then enter the **original DocKiln workspace password** when prompted. This connects the existing tenant and keeps its templates, history, usage and API keys. A matching email alone cannot claim a workspace. Until it is connected, the **Use original workspace login** option accepts the original credentials. If you cannot prove ownership, contact the operator before creating a second workspace.

Automations should continue using their existing workspace API keys. The legacy registration endpoint is disabled when managed sign-up is active, and legacy password login is limited to unlinked workspaces.

## Session and key permissions

A key can work with templates, submit jobs, read history and download files from the workspace that issued it. Signing in creates an expiring HttpOnly cookie. Key management, webhook and storage configuration, AI template assistance and test checkout use the signed-in account session. A bearer key on an account-only route returns **403**.

## Rotate or revoke

Create a replacement key, update your secret store and verify it with the usage request above. Revoke the old key in Settings. Subsequent requests using the revoked key return **401**. A valid key from another workspace cannot retrieve your document or template by ID.

## Manage review-build keys

The 1.1 review build allows signed-in workspace owners to rename, disable and enable keys using a PATCH request to `/v1/keys/{id}`. Revoked keys cannot be restored.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.