> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenlayer.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Token Layer CLI

> Scriptable Rust CLI for Token Layer actions, profiles, and market reads

The Token Layer CLI provides a deterministic command surface for agents, scripts, and operators that need Token Layer actions and info reads without writing custom client code first.

## Install

From this monorepo:

```bash theme={null}
cd packages/token-layer-cli
cargo install --path .
```

This installs both `tokenlayer` and `token-layer`.

## Quick start

Initialize a profile:

```bash theme={null}
tokenlayer init
```

Or create a local wallet profile without the interactive wizard:

```bash theme={null}
tokenlayer init --quick-wallet --name default
```

## Profiles

Profiles let one machine manage multiple auth contexts for different agents or operators.

```bash theme={null}
tokenlayer profile list
tokenlayer profile use --name default
tokenlayer --profile default info me
```

Profile storage:

* `~/.token-layer-cli/profiles.json`
* `$TL_CLI_HOME/profiles.json`

## Wallets

The CLI can generate and store local Ethereum and Solana wallets.

```bash theme={null}
tokenlayer wallet add --chain ethereum --name bot-1-eth
tokenlayer wallet add --chain solana --name bot-1-sol
tokenlayer wallet list
```

Wallet storage:

* `~/.token-layer-cli/wallets.json`
* `$TL_CLI_HOME/wallets.json`

These files include private keys. Treat them as secrets.

## Authentication

Three main auth paths are supported:

* profile-based auth from `tokenlayer init`
* direct flags such as `--jwt`, `--api-key`, and `--token`
* environment variables such as `TL_JWT`, `TL_API_KEY`, and `TL_PROFILE`

You can also select the API environment with:

* `--source mainnet`
* `--source testnet`

## Action commands

### Register with wallet signing

```bash theme={null}
tokenlayer action register \
  --wallet-name default-eth \
  --signature-chain-id 0x1
```

### Create a token

```bash theme={null}
tokenlayer action create-token \
  --name "Agent Token" \
  --symbol AGNT \
  --description "Autonomous launch" \
  --image "https://example.com/logo.png" \
  --chain-slug base
```

### Trade a token

```bash theme={null}
tokenlayer action trade-token \
  --token-id <TOKEN_UUID> \
  --chain-slug base \
  --direction buy \
  --buy-amount-usd 1
```

### Transfer a token

```bash theme={null}
tokenlayer action transfer-token \
  --token-id <TOKEN_UUID> \
  --recipient-address 0x000000000000000000000000000000000000dEaD \
  --amount 0.1 \
  --from-chain-slug base \
  --to-chain-slug base
```

## Info commands

```bash theme={null}
tokenlayer info get-tokens-v2 --order-by volume_24h --limit 20
tokenlayer info get-token-activity --token-id <TOKEN_ID_OR_ADDRESS> --limit 20
tokenlayer info get-token-candles --token-id <TOKEN_ID_OR_ADDRESS> --candle-interval 1h --limit 200
tokenlayer info get-token-stats --token-id <TOKEN_ID_OR_ADDRESS>
tokenlayer info me
```

## Agent workflow

For autonomous systems, the common loop is:

1. Discover candidates with `info get-tokens-v2`
2. Inspect recent flow with `info get-token-activity` or `info get-token-trades`
3. Evaluate market structure with `info get-token-candles` and `info get-token-stats`
4. Execute with `action trade-token` or `action transfer-token`

## Local development in this repo

```bash theme={null}
cd packages/token-layer-cli
cargo run -- --help
```

The package source lives in `packages/token-layer-cli`, and the CLI targets the same Token Layer HTTP API documented in this site.
