---
title: "Attach Key"
method: POST
path: "/v1/keys/attach"
tags: ["keys"]
---

# Attach Key

`POST /v1/keys/attach`

## Request

- Base URL: `https://api.bitpoort.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.bitpoort.com/v1/keys/attach`
- Auth: none required

Bind a ``bp_`` key to the authenticated Clerk account.

Returns ``{ok: true, account_id, key_prefix, name}`` on success.
Errors:

- 401 ``AUTH_REQUIRED`` -- no Clerk session resolvable from the
  request (cookie, dev override header, or query param).
- 400 ``KEY_NOT_FOUND`` -- the bp_ key isn't in our DB.
- 409 ``KEY_ALREADY_ATTACHED`` -- the key is already bound to a
  DIFFERENT account. Re-attaching to the same account is a noop
  and returns 200.

## Request body

- AttachKeyRequest
  - `api_key` string, required: The bp_ API key to bind.
  - `name` string, nullable: Optional friendly name for the dashboard. Defaults to the existing api_keys.name.

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/bitpoort/apis/bitpoort-api.md) · [All operations](https://skmtc.dev/bitpoort/apis/bitpoort-api/llms.txt) · [OpenAPI document](https://skmtc.dev/bitpoort/apis/bitpoort-api/revisions/1a51d8566777?raw)
