API reference · Keys

Claim a key with a connect code

POST/v1/key-pairings/claim

Creates a key from a one-time code made in Settings → API (Connect the CLI), with the public key of a key pair the caller made itself, so the private key never leaves the caller. The name, scopes, IP allowlist and expiry were chosen in Settings, after an electronic ID check. No signature needed: the code is the credential, used once, and valid for 10 minutes. Unknown, used and expired codes all answer not_found. Limited to 10 attempts an hour per IP address.

Scope
None. This endpoint needs no signature.
Rate-limit class
None (cached)
Authentication
None

Request body

application/json · ClaimKeyPairingRequest. Unknown fields are rejected.

  • codestringrequired

    The one-time code Settings → API shows after Connect the CLI. Valid for 10 minutes.

    Starts with mkp_. Example: mkp_abcdefghijklmnopqrstuvwxyz.

  • public_keystringrequired

    The new key's Ed25519 public key: the 32 bytes, base64url without padding.

    Matches ^[A-Za-z0-9_-]{43}$. Example: 11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo.

  • clientobjectrequired

    What is claiming the key, shown to the account holder in Settings → API.

    4 properties
    • namestringrequired

      1 to 40 characters. No control characters. Example: myntkaup-cli.

    • versionstringrequired

      1 to 40 characters. No control characters. Example: 0.2.0.

    • hostnamestringoptional

      1 to 100 characters. No control characters.

    • osstringoptional

      1 to 40 characters. No control characters. Example: darwin.

Responses

201 Created

The new key, and its account. application/json · Me

  • accountobject
    3 properties
    • typestring (enum)

      One of person, company.

    • namestring
    • tierstring

      The account's fee tier.

      Matches ^tier-\d{1,3}$.

  • keyobject
    6 properties
    • idstring

      Matches ^mk_(live|test)_[a-z0-9]{20}$.

    • namestring
    • scopesarray of string (enum)
    • ip_allowlistarray of string
    • created_atstring (date-time)
    • expires_atstring (date-time)nullable

      null for a key without expiry.

Every response carries MK-Request-Id.

Errors

Errors use the error envelope. Match on code.

StatusCodeMeaning
400invalid_requestThe request is malformed: bad JSON, an unknown or invalid field, or a missing header.
403api_access_disabledAPI access is switched off.
404not_foundNo such resource.
413payload_too_largeThe request body is larger than 8 KB.
415unsupported_media_typeRequest bodies must be application/json.
422key_limit_reachedThe account already has as many API keys as it can (5): revoke one in Settings → API first.
429rate_limitedToo many requests. Wait for Retry-After seconds.
500internal_errorSomething went wrong on our side.
503overloadedThe service is overloaded. Retry after Retry-After seconds.

Request

curl https://public-api.myntkaup.is/v1/key-pairings/claim
import { Myntkaup } from "@myntkaup/api";

const client = new Myntkaup(); // reads the key from the environment
// The public half of a key pair you made; keep the private half.
const claimed = await client.claimKeyPairing({
  code: "mkp_abcdefghijklmnopqrstuvwxyz",
  publicKey: "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo",
  client: { name: "my-tool", version: "1.0.0" },
});
console.log(claimed.key.id, claimed.key.scopes);
from myntkaup import Myntkaup

client = Myntkaup()  # reads the key from the environment
# The public half of a key pair you made; keep the private half.
claimed = client.claim_key_pairing(
    code="mkp_abcdefghijklmnopqrstuvwxyz",
    public_key="11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo",
    client={"name": "my-tool", "version": "1.0.0"},
)
print(claimed["key"]["id"], claimed["key"]["scopes"])

Response

201 Created
{
  "account": {
    "type": "person",
    "name": "Jón Jónsson",
    "tier": "tier-1"
  },
  "key": {
    "id": "mk_live_4f9c2a7d1e0b8c6a5d3f",
    "name": "DCA bot",
    "scopes": [
      "account:read",
      "transactions:read"
    ],
    "ip_allowlist": [
      "203.0.113.10"
    ],
    "created_at": "2026-11-01T09:30:00Z",
    "expires_at": "2027-01-30T09:30:00Z"
  }
}

Base URL https://public-api.myntkaup.is