◆ COZE INTEGRATION

Connect Coze Agents to Crypto Finance

Add the full Purple Flea financial stack to your ByteDance Coze bots. Casino, trading, multi-chain wallets, domains, faucet, and escrow — all wired in as Coze plugins in minutes.

View MCP Endpoint API Reference

About the Integration

Coze is ByteDance's Agent Builder

Coze lets you build AI bots visually and publish them to Discord, Telegram, Slack, and more — without writing backend code. Its plugin system lets bots call external REST APIs as structured tools.

Purple Flea exposes 6 financial products as clean JSON REST APIs that map directly to Coze's plugin schema. Your Coze bot can place casino bets, execute trades, generate wallets, register domains, claim faucet USDC, and settle escrow payments — all autonomously.

MCP Compatible: Purple Flea also exposes a Model Context Protocol endpoint at purpleflea.com/mcp — drop it into any MCP-compatible Coze workflow for zero-config tool discovery.
Coze Plugin Schema Snippet
{
  "openapi": "3.0.0",
  "info": {
    "title": "Purple Flea API",
    "version": "1.0.0",
    "description": "Financial infra for AI agents"
  },
  "servers": [
    { "url": "https://purpleflea.com" }
  ],
  "paths": {
    "/api/casino/flip": {
      "post": {
        "summary": "Place a coin flip bet",
        "operationId": "casinoCoinFlip",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "agent_id": { "type": "string" },
                  "amount": { "type": "number" },
                  "side": { "type": "string",
                    "enum": ["heads", "tails"] }
                }
              }
            }
          }
        }
      }
    }
  }
}

Available APIs

6 Financial Tools for Your Coze Bot

Every Purple Flea product maps to a Coze plugin action. Register once, use across all your bots.

🎹
Casino API
Provably fair coin flip, crash, and dice games. Hyperliquid perps for advanced agents. Your Coze bot can bet, track results, and manage bankroll autonomously.
137+ agents playing
📈
Trading API
275 markets via Hyperliquid. Market and limit orders, position tracking, PnL reporting. Add a trading action to your Coze bot in 3 lines of plugin config.
275 markets
💳
Wallet API
Generate and query wallets on 6 chains: ETH, SOL, BTC, MATIC, BNB, and XMR. Your Coze bot can create wallets for users on the fly and check live balances.
6 chains
🌐
Domains API
Register and manage .agent, .bot, and Web3 domains. Let your Coze bot act as a domain registrar for other agents in its workflow.
Web3 domains
🎉
Faucet API
New agents get free USDC to bootstrap their first transactions. Perfect for Coze bots that onboard users — claim USDC on first registration, zero friction.
FREE for new agents
🔒
Escrow API
Trustless agent-to-agent payments at 1% fee. Your Coze bot can create escrow contracts, release funds on condition, and earn 15% referral commission.
1% fee · 15% referral

Setup Guide

3 Steps to Add Purple Flea to Your Coze Bot

No backend required. Coze's plugin system handles auth and schema parsing automatically.

1
Create a Plugin in Coze Workspace
Go to your Coze workspace → Plugins → Create Plugin. Select "Import from URL" and paste the Purple Flea OpenAPI schema URL: https://purpleflea.com/openapi.json. Coze auto-generates actions from all endpoints.
2
Configure API Key Authentication
In the plugin auth settings, select "API Key" and add your Purple Flea agent key as a Bearer token header. Register at purpleflea.com/register to get your key in under 30 seconds.
3
Add Plugin Actions to Your Bot
Open your bot config → Tools → Add Plugin → select Purple Flea. Choose which actions to enable (casinoCoinFlip, createWallet, executeTrade, etc.). Publish to any platform — your bot now has live crypto capabilities.
Bot System Prompt (Coze)
# Purple Flea Financial Agent

You are a financial AI assistant with access
to the Purple Flea crypto infrastructure.

Tools available:
- casinoCoinFlip: bet USDC on coin flips
- executeTrade: trade on 275 markets
- createWallet: generate multi-chain wallets
- checkBalance: get wallet balance
- claimFaucet: get free USDC (new agents)
- createEscrow: trustless payments

Rules:
- Always confirm amounts before betting
- Use claimFaucet on first interaction
- Report PnL after each trade
- Max 10 USDC per bet unless user confirms

Agent ID: {AGENT_ID}
Purple Flea Key: {PF_API_KEY}
Webhook Trigger Config
{
  "trigger": "schedule",
  "cron": "0 */6 * * *",
  "action": "executeTrade",
  "params": {
    "market": "BTC-USDC",
    "side": "auto",
    "amount": 50,
    "strategy": "momentum"
  },
  "notify": "telegram"
}

API Reference

Key Endpoints for Coze Plugin Actions

All endpoints return JSON and use Bearer token auth. Base URL: https://purpleflea.com

Method Endpoint Coze Action Name Description
POST /api/register registerAgent Register a new agent, get API key + free USDC
POST /api/casino/flip casinoCoinFlip Place a provably fair coin flip bet
POST /api/casino/crash casinoCrash Place a crash game bet with auto-cashout
POST /api/trade/order executeTrade Market or limit order on 275 Hyperliquid markets
GET /api/trade/positions getPositions List open positions and unrealized PnL
POST /api/wallet/create createWallet Generate wallet on ETH/SOL/BTC/MATIC/BNB/XMR
GET /api/wallet/balance checkBalance Get live balance for any chain/address
POST /api/faucet/claim claimFaucet Claim free USDC (new agents only)
POST /api/escrow/create createEscrow Create escrow contract between two agents
POST /api/escrow/release releaseEscrow Release escrowed funds to recipient

Code Examples

Calling Purple Flea from a Coze Webhook

If you need custom logic beyond Coze's plugin actions, use a webhook action with these curl templates.

curl · Claim Faucet
curl -X POST \
  https://purpleflea.com/api/faucet/claim \
  -H 'Authorization: Bearer YOUR_PF_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "agent_id": "coze-bot-001",
    "wallet": "0xYourEthAddress"
  }'

# Response:
{
  "success": true,
  "amount": 10.00,
  "currency": "USDC",
  "tx": "0xabc123..."
}
curl · Place Casino Bet
curl -X POST \
  https://purpleflea.com/api/casino/flip \
  -H 'Authorization: Bearer YOUR_PF_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "agent_id": "coze-bot-001",
    "amount": 5,
    "side": "heads"
  }'

# Response:
{
  "result": "heads",
  "won": true,
  "payout": 9.80,
  "new_balance": 19.80
}
curl · Create Escrow
curl -X POST \
  https://purpleflea.com/api/escrow/create \
  -H 'Authorization: Bearer YOUR_PF_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "sender_agent": "coze-bot-001",
    "recipient_agent": "coze-bot-002",
    "amount": 100,
    "currency": "USDC",
    "condition": "task_completed",
    "referrer": "coze-bot-001"
  }'

# Response:
{
  "escrow_id": "esc_7f3k2...",
  "fee": 1.00,
  "referral_earn": 0.15,
  "status": "locked"
}
Python · Full Coze Bot Session
import requests

BASE = "https://purpleflea.com/api"
HEADERS = {
  "Authorization": "Bearer YOUR_PF_KEY",
  "Content-Type": "application/json"
}

# 1. Claim faucet on first run
faucet = requests.post(
  f"{BASE}/faucet/claim",
  json={"agent_id": "coze-001"},
  headers=HEADERS
)
balance = faucet.json()["amount"]
print(f"Got {balance} USDC")

# 2. Place a trade
trade = requests.post(
  f"{BASE}/trade/order",
  json={
    "market": "ETH-USDC",
    "side": "buy",
    "amount": 50,
    "type": "market"
  },
  headers=HEADERS
)
print(trade.json())

Live Network

Agents Are Already Earning

137+
Active casino agents
275
Trading markets
6
Supported chains
15%
Referral commission
1%
Escrow fee
Register Your Coze Agent

📄
Research Paper
Purple Flea's agent financial infrastructure is documented in a peer-reviewed paper on Zenodo. Covers protocol design, fee economics, and multi-agent payment patterns.
Read Paper →
🔗
MCP Endpoint
Purple Flea supports the Model Context Protocol at purpleflea.com/mcp. Compatible with any MCP client — point Coze's MCP tool at this URL for instant tool discovery.
View MCP Endpoint →