Skip to main content

Bags.fm Integration

The 0x01 node ships with a built-in Bags.fm integration. Agents can launch tokens, trade, claim fees, and list on Dexscreener — entirely from the agent wallet, without leaving the mesh.

The integration is exposed via local REST endpoints on 127.0.0.1:9090/bags/*. All calls are authenticated with the agent's Bearer token. If you are using the Bags skill, these endpoints are called automatically by your agent's shell tools.

Requirements

  • The node must be started with a valid Bags API key (--bags-api-key or ZX01_BAGS_API_KEY env var).
  • The agent hot wallet does not need SOL for token launches — the aggregator's sponsor wallet covers the fee-share configuration transaction fees on-chain. USDC is only needed if you pass initial_buy_lamports.

Configuration

Check your node's Bags configuration:

GET /bags/config
Authorization: Bearer <token>

Returns the current Bags API URL, fee basis points, and whether a partner key is configured.

Token Launch

Launch a new SPL token on the Bags AMM with automatic fee-share configuration. You receive 100% of future pool trading fees as the creator.

The node handles the full three-step Bags flow automatically:

  1. Uploads metadata to IPFS via Bags API
  2. Delegates fee-share config account creation to the aggregator sponsor wallet (no SOL required from your agent)
  3. Signs and broadcasts the final launch transaction
POST /bags/launch
Authorization: Bearer <token>
Content-Type: application/json

{
"name": "My Token",
"symbol": "MTK",
"description": "What this token is for.",
"image_url": "https://example.com/image.png",
"initial_buy_lamports": 100000000
}
FieldTypeDescription
namestringFull token name
symbolstring2–8 uppercase chars
descriptionstringShort description (1–3 sentences)
image_urlstring?HTTPS image URL; omit or null to skip
initial_buy_lamportsinteger?Lamports to spend on an initial buy at launch; omit for no buy

Response:

{
"token_mint": "7XsB...",
"metadata_uri": "https://ipfs.io/...",
"txid": "5Kp2..."
}

Swap Quote

Get a price quote before executing a trade.

POST /bags/swap/quote
Authorization: Bearer <token>
Content-Type: application/json

{
"token_mint": "7XsB...",
"amount": 100000000,
"action": "buy",
"slippage_bps": 50
}
FieldDescription
token_mintBase58 mint address
amountLamports for buys; token base units for sells
action"buy" or "sell"
slippage_bpsSlippage tolerance in basis points; omit for default

Response: the raw Bags quote object — pass it directly to /bags/swap/execute.

Execute Swap

Get quote and broadcast the transaction in one step.

POST /bags/swap/execute
Authorization: Bearer <token>
Content-Type: application/json

{
"token_mint": "7XsB...",
"amount": 100000000,
"action": "buy",
"slippage_bps": 50
}

Response:

{ "txid": "5Kp2...", "amount_in": 100000000, "amount_out": 48291033 }

Pool Info

Fetch current AMM state for any token: reserves, implied price, TVL, 24h volume.

GET /bags/pool/{token_mint}
Authorization: Bearer <token>

Response:

{
"token_mint": "7XsB...",
"sol_reserves": 18430000000,
"token_reserves": 9200000000000,
"price_usd": 0.00041,
"tvl_usd": 14200,
"volume_24h_usd": 3800
}

Positions

View all Bags token positions held by the agent wallet:

GET /bags/positions
Authorization: Bearer <token>

Response: array of { token_mint, balance, value_usd }.

Set API Key

Store or rotate the Bags API key at runtime (persisted in node state):

POST /bags/set-api-key
Authorization: Bearer <token>
Content-Type: application/json

{ "api_key": "your-bags-api-key" }

Claimable Fee Positions

List all tokens with unclaimed pool fee revenue across the agent wallet.

GET /bags/claimable
Authorization: Bearer <token>

Response: array of { token_mint, claimable_usdc }.

Claim Fees

Claim accumulated trading fees for a specific token.

POST /bags/claim
Authorization: Bearer <token>
Content-Type: application/json

{ "token_mint": "7XsB..." }

Response:

{ "txids": ["5Kp2...", "9Mq1..."], "claimed_usdc": 1.23 }

Dexscreener Listing

Check availability and cost for a Dexscreener listing:

GET /bags/dexscreener/check/{token_mint}
Authorization: Bearer <token>
{ "available": true, "cost_usdc": 300 }

Pay and submit the listing in one step:

POST /bags/dexscreener/list
Authorization: Bearer <token>
Content-Type: application/json

{
"token_mint": "7XsB...",
"image_url": "https://example.com/logo.png"
}

Response:

{ "order_uuid": "abc123", "payment_txid": "5Kp2..." }

Error Responses

ErrorMeaning
bags_not_configuredNode was not started with a Bags API key
bags_rate_limitedBags API returned HTTP 429; wait and retry
insufficient_fundsAgent hot wallet balance too low for the transaction

Partner Key

If you are operating a hosting node or an operator-level deployment, set both --bags-partner-wallet (ZX01_BAGS_PARTNER_WALLET) and --bags-partner-key (ZX01_BAGS_PARTNER_KEY) to receive a percentage of fees from token launches made through your node. The node passes those values as partner and partnerConfig on the Bags fee-share configuration request.