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
npm install -g @myntkaup/cli
myntkaup --versionIt 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:
myntkaup auth login --webThe 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:
# 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/mewith 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 filekeeps 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 withmyntkaup auth list, and pick the default withmyntkaup auth use <name>. myntkaup auth statusshows the key in use, its scopes and its expiry.myntkaup auth logoutrevokes 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--revoketo 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
| Command | What it does |
|---|---|
myntkaup status | Whether the API is up, what's switched on, and your clock |
myntkaup whoami | The account and key in use |
myntkaup balances, limits, bank-accounts | Your 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 100 | A firm quote, without trading |
myntkaup buy BTC --usdc 100, sell ETH --amount 0.5 | Trade, within a price limit you confirm |
myntkaup trades, transactions, withdrawals, giftcards | History, newest first; get ID shows one entry |
myntkaup giftcards create BTC 0.0005, giftcards pdf ID -o F | Make a gift card, or save its PDF |
myntkaup withdraw bank 100 --account 0133-26-012345 | Withdraw 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:
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.It quotes and accepts at once
The CLI gets a quote with POST
/v1/quotes. It accepts it with POST/v1/tradesonly 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.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
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:
--jsonprints 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:
--allfollows every page (pagination). - Idempotency:
--idempotency-keyon a trade, gift card or withdrawal makes a repeat of the same command safe (idempotency).
Exit codes:
| Code | Meaning |
|---|---|
| 0 | OK |
| 1 | An unexpected error |
| 2 | A usage error, or a money move without --yes where the CLI can't ask |
| 3 | Not logged in, or the key was refused (401) |
| 4 | The key lacks the scope, or isn't allowed from this address (403) |
| 5 | Not found (404) |
| 6 | Refused: balance, limits, a quote outside your price limit, or "no" at the confirmation |
| 7 | Rate limited (429) |
| 8 | The API is unavailable, and nothing was changed |
| 9 | The outcome is unknown: check with myntkaup trades or withdrawals before trying again |
| 130 | Cancelled |
The error codes come with the API's message and request id, and a hint where there's something to do.
Settings
| Variable | Meaning |
|---|---|
MYNTKAUP_API_KEY_ID | With MYNTKAUP_API_PRIVATE_KEY: the key to use, instead of a profile |
MYNTKAUP_API_PRIVATE_KEY | The private key, mk_sk_… |
MYNTKAUP_API_BASE_URL | The API's address, like --base-url |
MYNTKAUP_PROFILE | The profile to use, like --profile |
MYNTKAUP_CONFIG_DIR | Where the CLI keeps its settings (myntkaup config path shows it) |
NO_COLOR | No colours |
Other global options: --no-input (never ask), --verbose (log each request to stderr, never its signature) and --timeout <seconds>.