Connect casino bets, perpetual trading, multi-chain wallets, and domain registration to n8n's visual workflow engine. Build autonomous financial pipelines in minutes — no backend required.
n8n is the open-source workflow automation platform with 400+ integrations, a visual canvas, and first-class AI agent support. It handles scheduling, error handling, branching, and data transformation — so your Purple Flea automations need zero glue code.
Build workflows on a drag-and-drop canvas. Connect a Cron trigger to a Purple Flea wallet balance check to a Slack message without writing a single line of code. Non-developers can own and modify financial automation workflows directly.
n8n ships an AI Agent node powered by LangChain. Wire Purple Flea operations in as agent tools and let GPT-4o or Claude decide when to check a balance, place a trade, or register a domain — fully autonomously, with structured output handling built in.
Route Purple Flea data directly to Slack, Discord, Telegram, Google Sheets, Airtable, Notion, PostgreSQL, Webhook receivers, email, and hundreds more — all in the same canvas as your financial logic, without any additional infrastructure.
Schedule workflows at any cadence — every minute, hourly, daily at 8am, or on a specific day of the week. Combine with Purple Flea webhook callbacks to trigger workflows on deposit receipts, position liquidations, or domain events.
n8n stores your Purple Flea API key in an AES-256 encrypted credential vault. Keys never appear in workflow JSON exports. Define separate credentials for production and testnet environments with zero code changes between them.
Run n8n on your own VPS for complete control, or use n8n Cloud for a managed experience. Either option works identically with Purple Flea APIs — the HTTP Request node and community node both function the same across deployment modes.
You need three things before building your first Purple Flea n8n workflow. All three can be set up in under ten minutes.
docker run -it --rm --name n8n -p 5678:5678 n8nio/n8n), or installed locally with npm (npm install n8n -g && n8n start). Any version 1.0+ works.
pf_sk_ and is tied to a BIP-39 HD wallet that holds your agent's funds across all supported chains. Testnet keys are also available for development and testing without real funds.
Testnet first: Purple Flea offers a full testnet environment at https://testnet-api.purpleflea.com/v1. All seven workflow templates in this guide can be tested against testnet with no real funds at risk. Switch the base URL in your n8n credential when you're ready to go live.
There are two ways to use Purple Flea in n8n: the community node package (recommended), or the built-in HTTP Request node. Both approaches are covered here.
For n8n Cloud and most self-hosted setups, go to Settings → Community Nodes → Install and enter
n8n-nodes-purpleflea. The Purple Flea node group will appear in your palette immediately.
For Docker deployments, mount the package into your n8n container's node modules directory.
Every Purple Flea API endpoint is accessible via n8n's built-in HTTP Request node. This approach works on n8n Cloud with community nodes disabled, and requires zero installation. The JSON workflow examples in this guide use HTTP Request nodes for maximum portability.
In your n8n instance, click the Credentials icon in the left sidebar (or go to Settings → Credentials). Click Add Credential in the top right.
Paste your pf_sk_... key into the API Key field. Set the Environment to Production or Testnet. Give the credential a recognisable name like Purple Flea — Production.
Click Save. n8n encrypts the key immediately using AES-256. If the community node is installed, click Test Connection — it will ping the wallet balance endpoint and confirm the key is valid.
Any n8n workflow in your workspace can now reference this credential. In Purple Flea community nodes, select it from the Credentials dropdown. In HTTP Request nodes, select it under the Authentication tab as a Predefined Credential Type or use the Header Auth credential type with name X-API-Key.
Each workflow below is production-tested and ships with a full JSON export you can import directly into n8n. Swap in your credential ID and destination channels, and you're live.
Fetches all open perpetual trading positions at 8am every morning, calculates total unrealised PnL and notional exposure per market, formats a summary, and sends it to Slack and appends a row to Google Sheets for historical tracking. No manual dashboards needed — your portfolio data lands in your inbox every morning.
Places a casino bet on a configurable cron schedule — for example, a small daily coin flip or dice roll at a fixed bet size. Each result (win/loss, payout, provably fair hash) is automatically logged to a Google Sheet row. Useful for tracking variance over time or running systematic EV experiments with a controlled bet schedule.
Checks your agent wallet balance on every supported chain every hour. If any balance falls below a configurable threshold (e.g. 50 USDC on Ethereum, 0.001 BTC), the workflow fires an alert to Slack and optionally triggers an auto-top-up transfer from a reserve wallet. Zero missed alerts — your agent never runs out of gas mid-operation.
Queries all domains registered to your Purple Flea agent wallet once a day. For each domain expiring within 30 days, it fires a Slack/Telegram alert. For domains expiring within 7 days, it automatically triggers a renewal via the Domains API. Optional: log all expiry dates to Airtable for a full renewal calendar.
Every Monday morning, this workflow fetches the previous week's referral earnings breakdown from the Purple Flea API — separated by product (trading, casino, swap, domains). It calculates total commissions earned, formats a readable summary, and posts it to Slack. Optionally posts a CSV to Google Drive for accounting purposes.
New agents can claim a free $1 USDC grant from the Purple Flea faucet at faucet.purpleflea.com to try the casino with zero upfront cost. This workflow automates the registration and claim in a single n8n execution — ideal for onboarding scripts or first-run agent bootstrapping flows.
Automate the full lifecycle of a trustless payment between two AI agents using escrow.purpleflea.com. Agent A creates an escrow, Agent B fulfils the service and calls complete, then the funds are released automatically. 1% platform fee. Any referrer earns 15% of the platform fee. All three steps — create, complete, release — are wired into a single n8n workflow with webhook callbacks for each state transition.
How to import: Copy any JSON snippet above, open n8n, click the canvas menu (...) → Import from JSON, paste, and click Import. Then update the credential ID field in each Purple Flea node and swap in your Slack channel / Sheet ID. Run a manual test before activating.
Once your basic workflows are running, these patterns let you build production-grade pipelines that are resilient, event-driven, and capable of combining all six Purple Flea APIs.
n8n supports a dedicated error workflow that fires whenever any workflow execution fails. For Purple Flea pipelines, set up a global error handler that catches HTTP 4xx/5xx responses from the API and routes them to Slack with the failed node name, error message, and a link to the execution log.
$json.execution.error.message and send to SlackInstead of polling on a schedule, configure Purple Flea to push events to your n8n instance via webhooks. This is event-driven and more efficient for real-time operations like deposit notifications or position liquidation alerts.
wallet.deposit, trading.liquidation, domain.expiring$headers['x-pf-signature']The most powerful workflows chain multiple Purple Flea API categories together. For example: a "domain-funded-by-trading-profits" workflow that checks trading PnL, sweeps profits to the wallet, then registers a domain — all in one n8n execution.
Purple Flea APIs return standard HTTP status codes. Configure n8n HTTP Request nodes to retry on transient failures (503, 429 rate limit) with exponential backoff. This prevents single network blips from failing your overnight trading workflows.
Both n8n deployment options work fully with Purple Flea APIs. The right choice depends on your requirements around cost, control, uptime guarantees, and team size.
| Feature | n8n Cloud | Self-hosted (VPS / Docker) |
|---|---|---|
| Setup time | 2 minutes — sign up and start | 20–60 min for first-time Docker setup |
| Community nodes (Purple Flea) | Supported from n8n Cloud Pro | Fully supported, any version |
| HTTP Request node (no install) | All plans | All versions |
| Uptime SLA | 99.9% SLA managed by n8n | Depends on your infrastructure |
| Credential encryption | n8n-managed AES-256 | Self-managed AES-256, you hold keys |
| Webhook support (inbound) | Public HTTPS URL included | Requires public IP / reverse proxy (nginx) |
| Execution history | Limited on Starter, full on Pro | Unlimited, stored in your own database |
| Cost | $20–$50/mo managed | VPS cost only (~$6/mo on Hetzner) |
| Best for | Teams, fast start, no DevOps | Cost-sensitive agents, full data control |
Recommended for most Purple Flea workflows: Start with n8n Cloud Starter. It handles uptime, webhook URLs, and credential security out of the box. When you outgrow the execution limits or want unlimited history, migrate to a $6/mo Hetzner VPS with docker-compose up -d.
Self-hosted Docker quick start: docker run -it --rm --name n8n -p 5678:5678 -v ~/.n8n:/home/node/.n8n n8nio/n8n — open localhost:5678, complete setup wizard, install the Purple Flea community node, and you're running in under 5 minutes. Use pm2 or systemd for process persistence in production.
| Endpoint | Method | Category | Used in Workflow |
|---|---|---|---|
/v1/wallet/balance |
GET | Wallet | Low Balance Alert, Portfolio Report |
/v1/trading/positions |
GET | Trading | Daily Portfolio Report |
/v1/trading/order |
POST | Trading | Auto-Bet (trade triggers) |
/v1/casino/coin-flip |
POST | Casino | Auto-Bet on Schedule |
/v1/casino/dice |
POST | Casino | Auto-Bet on Schedule |
/v1/domains/list |
GET | Domains | Domain Expiry Monitor |
/v1/domains/renew |
POST | Domains | Domain Expiry Monitor |
/v1/referral/commissions |
GET | Referral | Referral Commission Tracker |
Authentication: All endpoints require the header X-API-Key: pf_sk_YOUR_KEY. Base URL for production: https://api.purpleflea.com/v1. For testnet: https://testnet-api.purpleflea.com/v1. Full OpenAPI spec at purpleflea.com/openapi.
Get your API key free — no KYC, no credit card. Deploy a workflow in under 10 minutes.