Skip to main content
Build CoinFello into your own frontend by hitting the A2A endpoint directly. The API follows the Agent-to-Agent protocol spec.

Demo Project

A working example app showing authentication, streaming, and client-side tool call handling.

Endpoint

POST https://app.coinfello.com/api/a2a
All requests use JSON-RPC 2.0.

Methods

MethodDescription
message/sendSend a message and get a response
message/streamSend a message and stream the response via SSE
tasks/getGet a task by ID (optionally limit history length)
tasks/cancelCancel a running task

Agent ID

Every message/send and message/stream request must include an agentId. The endpoint is agent-agnostic — the agent is resolved at request time from the value you supply. Pass it in params.configuration:
{
  "params": {
    "configuration": { "agentId": 1 },
    "message": { ... }
  }
}
Omitting agentId on a new request returns: "agentId is required: provide in configuration.agentId or as a DataPart". Once a task exists, subsequent messages that include its taskId do not need to repeat it. Find the numeric ID in the agent card under skills where each entry is a separate chat agent.

Example: Send a Message

curl -b cookies.txt -X POST https://app.coinfello.com/api/a2a \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "message/send",
    "params": {
      "configuration": { "agentId": 1 },
      "message": {
        "role": "user",
        "parts": [{ "type": "text", "text": "What are the best yields for ETH right now?" }]
      }
    }
  }'

Streaming

Use message/stream to get Server-Sent Events back. Each event is a JSON-RPC response wrapping an A2A stream event:
curl -b cookies.txt -X POST https://app.coinfello.com/api/a2a \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "message/stream",
    "params": {
      "configuration": { "agentId": 1 },
      "message": {
        "role": "user",
        "parts": [{ "type": "text", "text": "Swap 0.1 ETH to USDC" }]
      }
    }
  }'

Authentication

Authentication uses SIWE (Sign-In with Ethereum). Complete the SIWE flow to obtain a session cookie before making requests. See Authentication for the full flow with curl examples.

Client-side tool calls

The CoinFello chat agent which you can get from its agent card returns tool call requests as part of its A2A responses. Your frontend is responsible for handling these calls — rendering UI, prompting the user for approval, executing wallet transactions, and returning results back to the agent. Tool calls appear in the agent’s response as functionCall parts:
{
  "role": "agent",
  "parts": [
    {
      "type": "functionCall",
      "name": "execute_lifi_swap",
      "id": "call_abc123",
      "parameters": {
        "fromChainId": 1,
        "toChainId": 1,
        "fromTokenAddress": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
        "toTokenAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        "fromAmount": "100000000000000000",
        "slippage": 0.005,
        "fromTokenSymbol": "ETH",
        "toTokenSymbol": "USDC",
        "fromTokenDecimals": 18,
        "toTokenDecimals": 6
      }
    }
  ]
}
After the user approves or the action completes, submit the result back via message/send with a functionReturn part:
{
  "role": "user",
  "parts": [
    {
      "type": "functionReturn",
      "id": "call_abc123",
      "name": "execute_lifi_swap",
      "result": { "txHash": "0xabc..." }
    }
  ]
}

Tool reference

Proposes a generic smart contract call for the user to approve or reject. Display the contract address, function name, arguments, and value before submitting the transaction.
ParameterTypeDescription
tostringContract address
functionNamestringName of the contract function
argsstring[]Encoded function arguments
chainIdnumberTarget chain ID
valuestringNative token value in wei
abistring[]ABI fragments needed to encode the call
Sends native gas token (e.g. ETH) to an address. Show the recipient and amount for user confirmation before broadcasting.
ParameterTypeDescription
tostringRecipient address
chainIdnumberTarget chain ID
valuestringAmount in wei
Transfers an NFT to another address. Display the NFT details and recipient before the user approves.
ParameterTypeDescription
contractAddressstringNFT contract address
tokenIdstringToken ID
toAddressstringRecipient address
amountstringAmount (for ERC-1155; use "1" for ERC-721)
chainIdnumberTarget chain ID
Requests a visual token balance display. Render balance cards or a portfolio summary using the provided data — no wallet transaction required.
ParameterTypeDescription
addressstringWallet address
balancesobject[]Array of token balance objects (symbol, amount, price, value, logo, etc.)
totalValuenumberTotal portfolio value in USD
Executes a token swap or cross-chain bridge via LI.FI. Fetch a quote from LI.FI using the provided parameters, show the route to the user, then execute on approval.
ParameterTypeDescription
fromChainIdnumberSource chain ID
toChainIdnumberDestination chain ID
fromTokenAddressstringSource token address
toTokenAddressstringDestination token address
fromAmountstringAmount in source token’s smallest unit
slippagenumberSlippage tolerance (e.g. 0.005 for 0.5%)
fromTokenSymbolstringSource token symbol
toTokenSymbolstringDestination token symbol
fromTokenDecimalsnumberSource token decimals
toTokenDecimalsnumberDestination token decimals
Prepares a staking transaction for a specific yield opportunity. Show the APY, protocol, pool, and lockup period before requesting approval.
ParameterTypeDescription
yieldIdstringYield opportunity ID
amountstringAmount to stake
walletAddressstringUser’s wallet address
tokenSymbolstringToken to stake
tokenAddressstringToken contract address
chainIdnumberTarget chain ID
networkstringNetwork name
protocolstringProtocol name
poolNamestringPool name
apynumberCurrent APY
lockupPeriodstringHuman-readable lockup duration
rewardTokenSymbolsstring[]Reward token symbols
Prepares an unstaking transaction to withdraw from a staking position.
ParameterTypeDescription
yieldIdstringYield opportunity ID
amountstringAmount to withdraw
walletAddressstringUser’s wallet address
Aave V4 lending market interactions. All four share the same parameter shape and require user approval before executing.
ParameterTypeDescription
marketAddressstringAave market contract address
tokenAddressstringToken contract address
tokenSymbolstringToken symbol
amountstringAmount in token’s smallest unit
walletAddressstringUser’s wallet address
chainIdnumberTarget chain ID
Asks the user to grant permission for automatic yield rebalancing. Display the current position, minimum yield increase threshold, and maximum lockup before the user accepts or declines.
ParameterTypeDescription
chainIdnumberTarget chain ID
tokenAddressstringToken to rebalance
currentPosition.protocolstringCurrent protocol
currentPosition.amountstringCurrent staked amount
currentPosition.apynumberCurrent APY
minYieldIncreasenumberMinimum APY improvement to trigger rebalance
maxLockupDaysnumberMaximum lockup days the user will accept

React Package

Interested in a drop-in @coinfello/react package? Reach out to us — it’s on the roadmap.