Docs/Agent API
Developer Reference

Agent API Reference

Programmable ERC-20 token deployment for AI agents and autonomous systems. Base URL: https://avagenesis.com

Overview

Standard flow (your wallet): POST /api/agents/keys → POST /api/agents/create-token → sign + broadcast tx → POST /api/agents/confirm → done. Same contracts and fee flow as human users. Your agent owns the contract from block one.

The Agent API uses the exact same factory contracts as the human-facing token creator on this site. When your agent calls create-token, it gets back encoded calldata ready to sign. Your agent broadcasts the transaction from its own wallet — gas and the $10 platform fee are paid directly, and the fee flows to the platform treasury on-chain, identical to a human user.

🤖 No wallet? Use POST /api/agents/deploy-tokenSepolia testnet only. Nothing on mainnet is free. Gas costs real money on every chain. Mainnet always requires your agent to sign with its own wallet.

🧪 Free testnet: use "chain": "sepolia" for zero-cost test deployments on Sepolia before going live on mainnet.

Authentication

All endpoints (except key creation and public discovery endpoints) require a Bearer token:

Authorization: Bearer ava_live_<48-hex-chars>

Create an API key

POST /api/agents/keys

{
  "name": "My Agent",          // optional label
  "monthlyLimit": 100          // max deployments/month (default: 100)
}
// Response (201)
{
  "ok": true,
  "key": "ava_live_a1b2c3d4...",   // ← SHOWN ONCE — store securely
  "id": "uuid",
  "prefix": "ava_live_a1b2c3...",
  "name": "My Agent",
  "monthlyLimit": 100,
  "createdAt": "2026-05-14T..."
}

⚠ The raw API key is returned exactly once. It is never stored. If lost, create a new key and revoke the old one.

Rate Limits

ScopeLimitWindow
Per API key200 requests15 minutes
Key creation (per IP)5 keys1 hour
Monthly deployments100 (default)Calendar month

Rate limit headers are returned on every response: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

GET /api/agents/gas-prices

Returns live gas prices and deployment cost estimates. Use to choose the cheapest chain. No auth required.

GET /api/agents/gas-prices
// No authentication required
{
  "ok": true,
  "recommendation": "base",
  "chains": [
    {
      "chain": "base",
      "name": "Base",
      "nativeToken": "ETH",
      "gasPriceGwei": "0.0031",
      "estimatedDeployCostNative": "0.00000087",
      "estimatedDeployCostUsd": "0.0033",
      "nativePriceUsd": "3800.00",
      "factoryAvailable": true
    }
    // ... other chains sorted cheapest first
  ]
}

GET /api/agents/templates

Pre-built token configurations. Pass the template id in create-token to auto-fill features.

Template IDFeatures
utilityNo features — standard ERC-20
governanceBurnable only
rewardMintable + burnable
treasuryMintable + pausable + blacklist
communityBurnable + anti-whale (2%)
memeNo features, high supply

POST /api/agents/simulate-token

Dry-run: validates your payload and returns encoded calldata + fee without creating an intent or spending gas.

POST /api/agents/simulate-token
Authorization: Bearer ava_live_...

{
  "chain":    "base",
  "name":     "Agent Token",
  "symbol":   "AGT",
  "supply":   "1000000",
  "decimals": 18,
  "template": "governance"
}

POST /api/agents/deploy-token (No wallet needed)

Sepolia testnet only. Attempting mainnet chains returns HTTP 403. Nothing on mainnet is free — gas costs real money on Ethereum, Base, BNB Chain, and Polygon. If your agent has a wallet, use POST /api/agents/create-token for mainnet — your agent pays gas + fee directly, exactly like a human user.

POST /api/agents/deploy-token
Authorization: Bearer ava_live_...
Content-Type: application/json
X-Idempotency-Key: <unique-uuid>       // optional — prevents duplicate deploys on retry

{
  "chain":        "sepolia",           // or: ethereum | base | bnb | polygon
  "name":         "Agent Token",
  "symbol":       "AGT",
  "supply":       "1000000",
  "decimals":     18,                  // optional, default: 18
  "ownerAddress": "0xYourWallet",      // optional — tokens + ownership sent here
  "template":     "governance",        // optional
  "features": {                        // optional — overrides template
    "mintable":   false,
    "burnable":   true
  },
  "callbackUrl":  "https://example.com/webhook"   // optional
}
// Response (202) — deployment started, polls automatically
{
  "ok": true,
  "intentId": "3f8a1b2c-...",
  "status": "deploying",
  "message": "Deployment started. Platform wallet is signing and broadcasting the transaction.",
  "status_url": "https://avagenesis.com/api/agents/status/3f8a1b2c-...",
  "stream_url":  "https://avagenesis.com/api/agents/status-stream/3f8a1b2c-..."
}

// Poll status_url — when deployed you get:
{
  "ok": true,
  "status": "deployed",
  "token": {
    "name":            "Agent Token",
    "symbol":          "AGT",
    "contractAddress": "0xF904E4ff79Ae18C7a3716106eB694eF4a3520C19"
  },
  "transactions": {
    "txHash":      "0xb6344008d18de8...",
    "explorerUrl": "https://sepolia.etherscan.io/tx/0xb6344...",
    "tokenUrl":    "https://sepolia.etherscan.io/token/0xF904..."
  }
}

ownerAddress and Ownable2Step

If you pass ownerAddress, the platform will transfer all tokens to that address and call transferOwnership(). Because the token uses Ownable2Step, you must then call acceptOwnership() on the contract to finalize. If omitted, tokens and ownership remain with the platform deployer.

Using via MCP (ava_deploy_token tool)

// The MCP tool polls automatically and returns the contract address directly:
{
  "ok":              true,
  "status":          "deployed",
  "contractAddress": "0xF904E4ff...",
  "tokenName":       "Agent Token",
  "tokenSymbol":     "AGT",
  "chain":           "sepolia",
  "txHash":          "0xb6344008...",
  "explorerUrl":     "https://sepolia.etherscan.io/tx/0xb634...",
  "tokenUrl":        "https://sepolia.etherscan.io/token/0xF904..."
}

POST /api/agents/create-token ★ Standard — your wallet

✦ Same flow as human users. Your agent signs the transaction from its own wallet — gas + $10 fee paid directly to the factory, fee forwarded to platform treasury on-chain. Contract ownership is yours from the first block. No platform middleman needed.

Returns encoded calldata ready to sign. Broadcast from your wallet, then confirm with the txHash. Idempotency-safe via X-Idempotency-Key header.

POST /api/agents/create-token
Authorization: Bearer ava_live_...
X-Idempotency-Key: <unique-uuid>       // optional — prevents duplicate deploys on retry

{
  "chain":       "base",
  "name":        "Agent Genesis Token",
  "symbol":      "AGT",
  "supply":      "1000000",
  "decimals":    18,
  "template":    "governance",         // optional
  "features": {                        // optional — overrides template
    "mintable":   false,
    "burnable":   true,
    "pausable":   false,
    "blacklist":  false,
    "transferTax": 0,
    "antiWhale":  false,
    "maxWalletPercent": 0
  },
  "callbackUrl": "https://example.com/webhook"   // optional
}
// Response (201)
{
  "ok": true,
  "intentId": "3f8a1b2c-...",
  "status": "awaiting_payment",
  "next_step": {
    "action": "broadcast_transaction",
    "to":     "0xFactoryAddress...",   // factory contract
    "value":  "2631578947368421",       // fee in wei
    "data":   "0xa1b2c3...",           // encoded createToken() calldata
    "chainId": 8453,
    "gasEstimate": 280000
  },
  "fee": {
    "usd": 10,
    "eth": "0.00263158",
    "nativeToken": "ETH"
  },
  "confirm_url": "/api/agents/confirm/3f8a1b2c-...",
  "status_url":  "/api/agents/status/3f8a1b2c-...",
  "stream_url":  "/api/agents/status-stream/3f8a1b2c-..."
}

Request fields

FieldTypeRequiredDescription
chainstringrequiredethereum | base | bnb | polygon | sepolia
namestringrequiredToken name (max 64 chars)
symbolstringrequiredUppercase alphanumeric (max 16 chars)
supplystringrequiredHuman-readable initial supply (e.g. '1000000')
decimalsintegeroptionalToken decimals (default: 18, range: 0–18)
templatestringoptionalTemplate ID from /api/agents/templates
featuresobjectoptionalFeature overrides (see TokenFeatures below)
callbackUrlstringoptionalWebhook URL for status change events

POST /api/agents/confirm/:intentId

After broadcasting the transaction, submit the txHash. The server monitors on-chain and transitions intent status automatically.

POST /api/agents/confirm/3f8a1b2c-...
Authorization: Bearer ava_live_...

{
  "txHash": "0xa1b2c3d4..."
}

GET /api/agents/status/:intentId

Poll the current status. Returns contract address and explorer links when deployed.

// Response when deployed
{
  "ok": true,
  "status": "deployed",
  "token": {
    "name": "Agent Genesis Token",
    "symbol": "AGT",
    "contractAddress": "0x..."
  },
  "transactions": {
    "txHash": "0x...",
    "explorerUrl": "https://basescan.org/tx/0x...",
    "tokenUrl":    "https://basescan.org/token/0x..."
  }
}

Status lifecycle

deploy-token:deployingdeployed
create-token (advanced):awaiting_paymentpaiddeployingdeployed
Any stage → failed

GET /api/agents/status-stream/:intentId

Server-Sent Events stream. Emits status updates every 5 seconds until deployed or failed (max 15 min).

const es = new EventSource(
  'https://avagenesis.com/api/agents/status-stream/INTENT_ID',
  { headers: { Authorization: 'Bearer ava_live_...' } }
);
es.onmessage = (e) => {
  const data = JSON.parse(e.data);
  if (data.status === 'deployed') {
    console.log('Token deployed at:', data.token.contractAddress);
    es.close();
  }
};

Webhook Callbacks

If callbackUrl is provided, events are POSTed to that URL on each status change. Signed with HMAC-SHA256. 4-attempt retry with exponential backoff.

// Webhook payload
{
  "event":           "agent.deployment.deployed",
  "intentId":        "3f8a1b2c-...",
  "chain":           "base",
  "tokenName":       "Agent Genesis Token",
  "tokenSymbol":     "AGT",
  "contractAddress": "0x...",
  "txHash":          "0x...",
  "status":          "deployed",
  "timestamp":       "2026-05-14T10:00:00.000Z"
}
// Verify signature (Node.js)
const crypto = require('crypto');
const sig = req.headers['x-ava-signature'];
const expected = 'sha256=' + crypto
  .createHmac('sha256', process.env.AVA_WEBHOOK_SECRET)
  .update(req.body)
  .digest('hex');
if (sig !== expected) throw new Error('Invalid signature');

Events: agent.deployment.awaiting_payment · agent.deployment.paid · agent.deployment.deploying · agent.deployment.deployed · agent.deployment.failed

MCP Server

Ava Genesis exposes a Model Context Protocol server. Compatible with Claude, GPT-4 tool use, and any MCP client.

// MCP server endpoint
https://avagenesis.com/api/mcp

// Add to Claude Desktop config (claude_desktop_config.json)
{
  "mcpServers": {
    "ava-genesis": {
      "url": "https://avagenesis.com/api/mcp"
    }
  }
}

Available MCP tools:

ava_deploy_token
ava_get_gas_prices
ava_list_templates
ava_simulate_token
ava_get_deployment_status
ava_list_my_tokens
ava_create_api_key
ava_create_token_intent
ava_confirm_deployment

Error Codes

HTTPMeaningCommon cause
400Bad RequestValidation error — check errors[] array in response
401UnauthorizedMissing, malformed, or revoked API key
403ForbiddenIntent belongs to a different API key
404Not FoundIntent or key ID does not exist
409ConflictIntent already in terminal state (failed)
429Too Many RequestsRate limit or monthly deployment cap exceeded
503Service UnavailableFactory not deployed on requested chain
500Server ErrorInternal error — retry with exponential backoff

Security Notes

API keys are hashed (SHA-256) before storage. Raw keys are never stored.
All inputs are validated server-side. Never trust client data.
Webhook payloads are signed with HMAC-SHA256. Verify X-Ava-Signature on your server.
deploy-token: The platform deployer private key is server-side only. Your agent never touches it.
create-token (advanced): Your private key never leaves your agent. The server only receives encoded calldata.
Idempotency keys prevent duplicate deployments on retry — always use them in production.
Rate limits and monthly caps prevent abuse. Contact support to increase limits.