SDKs and CLI

Command line (CLI)

@myntkaup/cli: check balances and prices, trade within a price limit you confirm, and make gift cards and withdrawals from your terminal or a script.

Install

Shell
npm install -g @myntkaup/cli
myntkaup --version

It needs Node.js 22.12 or later. The command is myntkaup. npx @myntkaup/cli also works without installing it.

Log in

The simplest way is in the browser:

Shell
myntkaup auth login --web

The CLI opens Settings → API and asks for a code. There, choose Connect the CLI, pick what the key may do, confirm with your electronic ID, and copy the one-time code into the terminal. The CLI makes the key pair on your computer, so the private key is never shown or sent anywhere. Myntkaup never asks anyone for this code: paste it only into a command you started.

Or make a key yourself, as in Getting started, with only the scopes you need, and give it to the CLI:

Shell
# The .env file Settings → API offered:
myntkaup auth login --env-file ~/Downloads/myntkaup-mk_live_….env

# Or type the key id and private key (the private key isn't shown):
myntkaup auth login --with-key
  • The key is checked first. The CLI calls GET/v1/me with it, and saves nothing if that fails.
  • The private key stays on your computer. It goes to your system's keychain (macOS Keychain, Windows Credential Manager, or Secret Service on Linux). Where there's no keychain, --storage file keeps it in a file only your user can read. The CLI refuses to use that file if anyone else can.
  • Delete the downloaded file once it's imported.
  • Profiles: each saved key is a profile. Add more with --profile <name>, list them with myntkaup auth list, and pick the default with myntkaup auth use <name>.
  • myntkaup auth status shows the key in use, its scopes and its expiry.
  • myntkaup auth logout revokes a key the CLI made with --web, and forgets it. A key you imported may be in use elsewhere, so it's only forgotten; add --revoke to revoke it too.

Where requests go. A live key (mk_live_…) is only ever sent to https://public-api.myntkaup.is, whatever else is set. A test key (mk_test_…) goes to staging by default, or with --base-url to another https address, or to one on your own computer. auth login --web has no key to go by yet, so it connects to production; to connect a test key, add --base-url https://public-api.staging.myntkaup.is.

Commands

CommandWhat it does
myntkaup statusWhether the API is up, what's switched on, and your clock
myntkaup whoamiThe account and key in use
myntkaup balances, limits, bank-accountsYour balances, limits and the bank accounts you've used
myntkaup assets, prices [ASSET]What you can trade, and indicative prices at your tier
myntkaup quote buy BTC --usdc 100A firm quote, without trading
myntkaup buy BTC --usdc 100, sell ETH --amount 0.5Trade, within a price limit you confirm
myntkaup trades, transactions, withdrawals, giftcardsHistory, newest first; get ID shows one entry
myntkaup giftcards create BTC 0.0005, giftcards pdf ID -o FMake a gift card, or save its PDF
myntkaup withdraw bank 100 --account 0133-26-012345Withdraw USDC to a bank account in your own name
myntkaup withdraw crypto BTC 0.01 --address …Withdraw crypto; you confirm it from the email that follows

--usdc is an amount in USDC; --amount is an amount of the asset. myntkaup <command> --help lists every option.

Trading within a price limit

A quote is firm for only a few seconds, too short to read and answer. So buy and sell work differently from the API's two steps:

  1. You confirm a price limit

    The CLI shows the indicative price, about what you'd get or pay, and a price limit: by default 0.5% worse than the indicative price. Set it with --max-price (buy) or --min-price (sell), or change the margin with --max-slippage. The confirmation also names the account and key, so you know whose money it is.

  2. It quotes and accepts at once

    The CLI gets a quote with POST/v1/quotes. It accepts it with POST/v1/trades only if the price is within your limit and the amount is what you asked for. If the quote expires or the price moves, it gets a fresh one, at most twice, against the same limit.

  3. It follows the trade

    A pending trade is followed for up to 30 seconds (--wait). If the answer to the trade request is lost, the CLI reads the quote to see whether it was accepted, instead of trying again.

--dry-run gets and checks a quote without accepting it.

In scripts and CI

Shell
export MYNTKAUP_API_KEY_ID=mk_live_…
export MYNTKAUP_API_PRIVATE_KEY=mk_sk_…
myntkaup balances --json | jq -r '.data[] | "\(.asset) \(.available)"'
myntkaup buy BTC --usdc 25 --yes --json | jq -r .id
  • The key from the environment: with both variables set, the CLI uses them and saves nothing. Use a separate key for each machine, with only the scopes it needs.
  • Confirmations: anything that moves money asks first. Where the CLI can't ask, it stops unless you add --yes. With --yes, the price limit still applies.
  • Output: --json prints the API's JSON on stdout, as in the API reference. Prompts, notes and errors go to stderr. Gift card codes are masked unless you add --show-code.
  • Lists: --all follows every page (pagination).
  • Idempotency: --idempotency-key on a trade, gift card or withdrawal makes a repeat of the same command safe (idempotency).

Exit codes:

CodeMeaning
0OK
1An unexpected error
2A usage error, or a money move without --yes where the CLI can't ask
3Not logged in, or the key was refused (401)
4The key lacks the scope, or isn't allowed from this address (403)
5Not found (404)
6Refused: balance, limits, a quote outside your price limit, or "no" at the confirmation
7Rate limited (429)
8The API is unavailable, and nothing was changed
9The outcome is unknown: check with myntkaup trades or withdrawals before trying again
130Cancelled

The error codes come with the API's message and request id, and a hint where there's something to do.

Settings

VariableMeaning
MYNTKAUP_API_KEY_IDWith MYNTKAUP_API_PRIVATE_KEY: the key to use, instead of a profile
MYNTKAUP_API_PRIVATE_KEYThe private key, mk_sk_…
MYNTKAUP_API_BASE_URLThe API's address, like --base-url
MYNTKAUP_PROFILEThe profile to use, like --profile
MYNTKAUP_CONFIG_DIRWhere the CLI keeps its settings (myntkaup config path shows it)
NO_COLORNo colours

Other global options: --no-input (never ask), --verbose (log each request to stderr, never its signature) and --timeout <seconds>.