RESTAKING API

EigenLayer Restaking API for AI Agents

Automate EigenLayer restaking with Purple Flea's agent-native API. Stake ETH, stETH, rETH, and cbETH across multiple AVSs, delegate to operators, and compound rewards — all via REST or MCP tools with no manual intervention.

View Docs Get API Key
6
Supported LSTs
AVS
Multiple Operators
Real-time
APY Data
4
MCP Tools
Background

What is Restaking?

Restaking is a mechanism pioneered by EigenLayer that allows ETH stakers to put their staked assets to work securing additional protocols beyond Ethereum itself — earning additional yield in the process.

🔗
EigenLayer Core
EigenLayer is a smart contract protocol on Ethereum that enables restaking. Stakers deposit ETH or liquid staking tokens (LSTs) into EigenLayer's contracts, where they are locked and used as economic security for AVSs.
🏗️
Actively Validated Services (AVSs)
AVSs are protocols that use EigenLayer's restaked ETH as a security layer. Examples include oracle networks (EigenDA), cross-chain bridges, data availability layers, and decentralized sequencers. Each AVS pays out its own reward token on top of base staking yield.
📈
Stacked Yield
Restakers earn base Ethereum staking rewards (from the underlying LST) plus additional AVS rewards simultaneously. A restaker with stETH may earn ~3.8% base APY plus 1–4% in AVS rewards depending on which operators they delegate to.

How it works for AI agents: An agent holds idle ETH or LSTs in its Purple Flea wallet. Rather than letting them sit unused, the agent calls POST /v1/restaking/stake to deposit into EigenLayer, then POST /v1/restaking/delegate to select a high-yield operator. The agent can monitor rewards with GET /v1/restaking/rewards and auto-claim when a threshold is reached.


REST API

API Endpoints

All restaking endpoints follow Purple Flea's standard REST conventions. Authentication uses your API key via Authorization: Bearer pf_live_... header.

Method Endpoint Description
POST /v1/restaking/stake Stake ETH, rETH, stETH, cbETH, ankrETH, or swETH into EigenLayer. Specify asset, amount, and optional operator address.
GET /v1/restaking/position Retrieve current restaking position: deposited amounts per LST, total USD value, current operator delegation, and unstaking queue status.
GET /v1/restaking/rewards Fetch accumulated restaking rewards across all delegated AVSs. Returns per-AVS reward amounts, total USD value, and last claim timestamp.
POST /v1/restaking/claim Claim accumulated restaking rewards to the agent's wallet. Optionally specify avs_address to claim from a single AVS, or omit to claim all pending rewards.
GET /v1/restaking/avs List all available AVSs with current APY, total restaked TVL, operator count, risk tier, and supported LSTs. Sorted by APY descending by default.
POST /v1/restaking/delegate Delegate restaked assets to a specific EigenLayer operator. Specify operator_address and optionally the LSTs to redelegate. Undelegation triggers a 7-day withdrawal queue.
Example — GET /v1/restaking/avs
# List AVSs sorted by APY
curl https://api.purpleflea.com/v1/restaking/avs \
  -H 'Authorization: Bearer pf_live_your_key'

# Response
{
  "avs": [
    {
      "name": "EigenDA",
      "address": "0x870679E138bCdf293b7Ff14dD44b70FC97e12fc0",
      "apy": 4.2,
      "tvl_usd": 1240000000,
      "operator_count": 42,
      "risk_tier": "low",
      "supported_lsts": ["ETH", "stETH", "rETH", "cbETH"]
    },
    {
      "name": "AltLayer MACH",
      "apy": 6.1,
      "tvl_usd": 340000000,
      "risk_tier": "medium"
    }
  ]
}

Supported Assets

Supported LST Tokens

Purple Flea's Restaking API accepts all six major Liquid Staking Tokens supported by EigenLayer, as well as native ETH for direct restaking.

Native ETH
Direct ETH restaking via EigenLayer's native restaking path. Requires running an Ethereum validator or using a liquid staking wrapper.
EigenLayer Native
🔵
stETH — Lido
The largest LST by TVL. Lido's liquid staking token accrues daily rebases. Widely supported across all EigenLayer AVSs and DeFi protocols.
Largest TVL
🟠
rETH — Rocket Pool
Rocket Pool's decentralized LST. Value accrues over time (exchange rate model rather than rebases). Favored for decentralization.
Decentralized
🔷
cbETH — Coinbase
Coinbase Wrapped Staked ETH. Exchange rate model, institutional-grade custody. High liquidity on major DEXs and CEXs.
Institutional
🔴
ankrETH — Ankr
Ankr's liquid staking token. Uses exchange rate model. Supported across multiple chains beyond Ethereum.
Multi-chain
🌀
swETH — Swell
Swell Network's LST. Exchange rate model with focus on EigenLayer integration. Bonus SWELL token rewards available.
Bonus Rewards

Integration

Python Integration Example

This example shows an autonomous AI agent that monitors its ETH balance, stakes idle ETH when it exceeds a threshold, selects the highest-APY AVS, and auto-claims rewards weekly.

Python — Autonomous Restaking Agent
import requests
import time
from datetime import datetime, timedelta

API_KEY = "pf_live_your_api_key"
BASE_URL = "https://api.purpleflea.com"
HEADERS = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}

# Configuration
STAKE_THRESHOLD_ETH = 0.5   # Stake when wallet holds > 0.5 ETH idle
CLAIM_THRESHOLD_USD = 10.0  # Claim rewards when > $10 accumulated
PREFERRED_LST = "stETH"      # Preferred LST for restaking

def get_best_avs():
    """Find the highest-APY AVS with acceptable risk."""
    r = requests.get(f"{BASE_URL}/v1/restaking/avs", headers=HEADERS)
    avs_list = r.json()["avs"]
    # Filter to low/medium risk only, pick highest APY
    safe_avs = [a for a in avs_list if a["risk_tier"] in ["low", "medium"]]
    return max(safe_avs, key=lambda x: x["apy"])

def check_and_stake():
    """Stake idle ETH above threshold."""
    wallet = requests.get(f"{BASE_URL}/v1/wallet/balance", headers=HEADERS).json()
    eth_balance = wallet["balances"]["ETH"]

    if eth_balance > STAKE_THRESHOLD_ETH:
        stake_amount = eth_balance - 0.1  # Keep 0.1 ETH for gas
        best_avs = get_best_avs()
        print(f"Staking {stake_amount:.4f} ETH into AVS: {best_avs['name']} ({best_avs['apy']}% APY)")

        r = requests.post(f"{BASE_URL}/v1/restaking/stake", headers=HEADERS, json={
            "asset": "ETH",
            "amount": str(stake_amount),
            "operator": best_avs["top_operator_address"]
        })
        return r.json()

def check_and_claim_rewards():
    """Claim rewards if above threshold."""
    rewards = requests.get(f"{BASE_URL}/v1/restaking/rewards", headers=HEADERS).json()
    total_usd = rewards["total_usd_value"]

    if total_usd >= CLAIM_THRESHOLD_USD:
        print(f"Claiming ${total_usd:.2f} in restaking rewards")
        r = requests.post(f"{BASE_URL}/v1/restaking/claim", headers=HEADERS, json={})
        return r.json()

# Main agent loop
while True:
    print(f"[{datetime.now().isoformat()}] Running restaking checks...")
    check_and_stake()
    check_and_claim_rewards()
    pos = requests.get(f"{BASE_URL}/v1/restaking/position", headers=HEADERS).json()
    print(f"Current position: ${pos['total_usd_value']:.2f} restaked")
    time.sleep(3600)  # Check every hour

Risk Assessment

Risk Model

Restaking introduces additional risk on top of base Ethereum staking. Agents should understand and configure appropriate risk tolerances before deploying capital.

⚠️ Slashing Risk
EigenLayer operators can be slashed if they misbehave while securing an AVS. This can result in partial or total loss of restaked principal. Purple Flea's API exposes operator slashing history and slash conditions for each AVS to help agents make informed decisions.
🔗 Correlated AVS Risk
Delegating to an operator securing multiple AVSs simultaneously can compound slashing exposure. A single operator failure may trigger slashing across all AVSs they operate. The API's risk tier classification helps agents avoid over-correlated exposure.
💧 Liquidity Risk
Restaked assets enter a 7-day withdrawal queue before being accessible. Agents managing liquidity-sensitive portfolios should maintain a separate liquid allocation. The /v1/restaking/position endpoint shows queue status and estimated unlock timestamps.
📊 Smart Contract Risk
EigenLayer's contracts are audited and have been battle-tested with billions in TVL, but smart contract risk always exists. Agents can query TVL and audit history via the AVS list endpoint to assess maturity of each protocol.

Use Cases

Agent Use Cases for Restaking

Restaking unlocks a category of autonomous yield strategies that are impossible with manual management — perfectly suited for always-on AI agents.

🏦
AI Treasury Manager
An agent managing an organization's on-chain treasury automatically restakes idle ETH whenever holdings exceed operational reserves. Weekly reward compounding maximizes yield without manual oversight. Target: +2–5% APY on ETH idle balances.
🤝
Multi-Agent Yield Optimizer
A fleet of specialized agents collaborates: one monitors AVS APY across operators, another executes redelegations to higher-yield operators as market conditions change, and a third handles reward claiming and reinvestment. Coordinated via Purple Flea's escrow.
♻️
Autonomous Reward Compounder
Agent monitors restaking rewards in real-time. When accumulated rewards exceed the gas cost of claiming (typically $10–20 in rewards), the agent auto-claims, converts reward tokens to stETH, and restakes — compounding the position continuously.

MCP Integration

MCP Tools for Restaking

All restaking operations are available as MCP tools for agents running via the Purple Flea MCP server. Use these tool names in your agent's system prompt or tool calls.

restaking_stake
restaking_position
restaking_rewards
restaking_claim
restaking_avs_list
restaking_delegate
MCP Tool Call — restaking_claim
{
  "tool": "restaking_claim",
  "parameters": {
    "agent_id": "agent_abc123",
    "avs_address": "all",
    "min_usd_threshold": 10
  }
}
// Returns: { claimed_usd: 14.23, tx_hash: "0xabc...", rewards_by_avs: {...} }

Related APIs

Explore the Full DeFi Stack

Restaking works best as part of a broader yield strategy. Combine it with liquid staking, lending, and aggregators for maximum agent yield.

GET STARTED

Start Restaking with Your Agent

Get an API key and connect your agent to EigenLayer in minutes. Full documentation and Python/Node.js examples in the API reference.