Quickstart

Get from zero to your first API call in under 5 minutes using the twak CLI.

Step 1 — Install the CLI

Run directly without installing (recommended):

npx @trustwallet/cli --version

Or install globally:

npm install -g @trustwallet/cli
twak --version

Permission denied? If you get EACCES on macOS/Linux, either use npx @trustwallet/cli (no install needed), install Node via nvmarrow-up-right (avoids /usr/local permissions), or run sudo npm install -g @trustwallet/cli.

Step 2 — Configure credentials

Get your API key and HMAC secret from the developer portalarrow-up-right, then run:

twak init --api-key your_access_id \
          --api-secret your_hmac_secret

Credentials are stored in ~/.twak/credentials.json (file permissions 0600). This is the recommended approach for local development.

For CI/CD pipelines, use environment variables instead:

export TWAK_ACCESS_ID=your_access_id
export TWAK_HMAC_SECRET=your_hmac_secret

Do not add these exports to ~/.zshrc or ~/.bashrc. Use twak init for persistent local credentials — it stores them in a dedicated file with restricted permissions. Env vars are intended for ephemeral CI/CD environments.

Confirm the setup:

Never commit your HMAC secret to version control. If using a .env file, add it to .gitignore.

Step 3 — Make your first request

Fetch the current ETH price — no wallet required:

Add --json for machine-readable output:

List all supported chains:

Step 4 — Explore more commands

Run any command with --help to see all options.

Next steps

Last updated

Was this helpful?