🚀 0xNod Backend API

Privacy-First XMTP Messaging Platform

📊 PostgreSQL
💾 S3 Storage
🔐 Client-Side Encrypted
🤖 AI Agents

✨ Core Features

👤
User Profiles
Public profiles with avatar uploads to S3
📇
Encrypted Contacts
Client-side encrypted contact storage
💾
Message Backups
XIP-64 compliant encrypted backups
🔔
Push Notifications
Silent APNs notifications via XMTP
🪝
Webhooks
Event-driven integrations with retry logic
💬
XMTP Rooms
Group chat with slash commands
🤖
AI Agents
WhaleIntel integration with x402 payments
💰
Crypto Payments
USDC/ETH with blockchain verification

👤 User Profiles

GET /api/profiles

Retrieve user profile by wallet address. Query param: walletAddress

POST /api/profiles

Create or update user profile with optional avatar upload (base64 or URL)

📇 Contacts

GET /api/contacts

Get all contacts for a user. Query param: userInboxId

GET /api/contacts/search

Search contacts by query string. Params: userInboxId, query

POST /api/contacts

Create new contact with encrypted data

PUT /api/contacts

Update existing contact information

DELETE /api/contacts

Delete contact. Params: userInboxId, walletAddress

💾 Message Backups

GET /api/backup/list

List all backups for user. Query param: inboxId

GET /api/backup/download/:backupId

Download encrypted backup blob by ID

POST /api/backup/upload

Upload encrypted backup with metadata. Auto-expires in 30 days

DELETE /api/backup/delete/:backupId

Delete backup by ID

🔔 Push Notifications

POST /api/notifications/register-device

Register iOS device for silent push notifications

POST /api/notifications/unregister-device

Unregister device from notifications

GET /api/notifications/service-control

Get notification service status and configuration

🪝 Webhooks

GET /api/webhooks

List all webhooks for wallet address. Query: walletAddress

POST /api/webhooks

Create new webhook subscription with HMAC signature support

PUT /api/webhooks/:id

Update webhook URL, events, or secret

DELETE /api/webhooks/:id

Delete webhook subscription

Supported Events: profile.updated, contact.created, contact.updated, contact.deleted, backup.uploaded, backup.deleted, room.created, member.joined, member.left

💬 XMTP Group Rooms

GET /api/rooms

List all rooms. Query: walletAddress (optional)

GET /api/rooms/xmtp-status

Check XMTP RoomGate agent status and configuration

GET /api/rooms/memberships

Get room memberships. Query: walletAddress or inboxId

GET /api/rooms/:roomId

Get room details by ID

GET /api/rooms/:roomId/members

List all members in a room

POST /api/rooms

Create new XMTP group room (requires RoomGate agent)

POST /api/rooms/:roomId/join

Join existing room with valid inbox ID

GET /api/rooms/:roomId/polls

List all polls in room

POST /api/rooms/:roomId/polls

Create new poll (or use /poll command in XMTP)

POST /api/rooms/:roomId/polls/:pollId/votes

Vote on poll option

POST /api/rooms/:roomId/polls/:pollId/close

Close poll and finalize results

GET /api/rooms/:roomId/bets

List all bets in room

POST /api/rooms/:roomId/bets

Create new bet (or use /bet command in XMTP)

POST /api/rooms/:roomId/bets/:betId/enter

Enter bet with prediction

POST /api/rooms/:roomId/bets/:betId/settle

Settle bet with winning option

GET /api/rooms/:roomId/scoreboard

Get leaderboard scores for room members

Chat Bot Commands: /poll, /vote, /close, /bet, /enter, /settle, /scoreboard, /help

🤖 AI Agents

GET /api/agents

List all available AI agents with status and configuration

GET /api/wint/status

Check WhaleIntel agent x402 configuration status

POST /api/wint/chat

Chat with wint (backend pays via x402 - recommended)

POST /api/wint/chat/credit

Chat with wint using prepaid credits

Integration: WhaleIntel AI agent with x402 payments for crypto intelligence queries

💳 Credit System

GET /api/credits/wallet/:walletAddress

Check credit balance for wallet address

GET /api/credits

Check credit balance (legacy). Query: inboxId

GET /api/credits/transactions

View transaction history. Query: inboxId

POST /api/credits/topup

Add credits to account (testing only - use payments for production)

💰 Crypto Payments

GET /api/payments/info

Get payment receiver address and pricing information

POST /api/payments/usdc/initiate

Initiate USDC payment (Ethereum, Polygon, Arbitrum)

POST /api/payments/crypto/initiate

Initiate ETH payment with network selection

POST /api/payments/verified/confirm

Verify transaction on blockchain and confirm payment

GET /api/payments/transaction/:txHash

Check payment transaction status

Supported Networks: Ethereum Mainnet, Sepolia Testnet, Polygon, Arbitrum
Pricing: $0.10 USDC or 0.0001 ETH per credit

🔗 Wallet Connections

GET /api/wallet-connections

Get connection events. Query: walletAddress

POST /api/wallet-connections

Track wallet connection event for analytics

⚠️ Security Notice: This API currently has NO authentication or authorization. Do not use in production without implementing wallet signature verification (EIP-191/EIP-712) and proper authentication middleware on all endpoints.