API Reference

Note: The APIs are currently in closed alpha testing and not yet live. This reference is for partners to review and understand our development progress.

Get balances for a wallet

get
/balances/{account}

Returns ETH and token balances for the provided wallet across all supported chains.

Path parameters
accountstringRequired

Wallet address (0x-prefixed)

Pattern: ^0x[a-fA-F0-9]{40}$
Responses
200

Balance snapshot

application/json
get
/balances/{account}
GET /balances/{account} HTTP/1.1
Host: api.tetrics.io
Accept: */*
{
  "account": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
  "balances_by_chain": {
    "ANY_ADDITIONAL_PROPERTY": {
      "native_token": "text",
      "tokens": {
        "ANY_ADDITIONAL_PROPERTY": "text"
      }
    }
  }
}

Get balances for default account

get
/balances

Returns a balance snapshot for the default account used in automated tests.

Responses
200

Balance snapshot

application/json
get
/balances
GET /balances HTTP/1.1
Host: api.tetrics.io
Accept: */*
200

Balance snapshot

{
  "account": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
  "balances_by_chain": {
    "ANY_ADDITIONAL_PROPERTY": {
      "native_token": "text",
      "tokens": {
        "ANY_ADDITIONAL_PROPERTY": "text"
      }
    }
  }
}

Discovery service status

get
/protocols/discovery

Returns adapter discovery statistics and configuration health.

Responses
200

Discovery status

application/json
get
/protocols/discovery
GET /protocols/discovery HTTP/1.1
Host: api.tetrics.io
Accept: */*
200

Discovery status

{
  "total_protocols_discovered": 1,
  "total_protocols_enabled": 1,
  "protocols_by_chain": {
    "ANY_ADDITIONAL_PROPERTY": [
      "text"
    ]
  },
  "health_status": {
    "ANY_ADDITIONAL_PROPERTY": true
  },
  "discovery_stats": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "last_config_reload": 1
}

List supported protocol adapters

get
/protocols

Returns metadata for all registered protocol adapters grouped by chain.

Responses
200

Protocol metadata

application/json
get
/protocols
GET /protocols HTTP/1.1
Host: api.tetrics.io
Accept: */*
200

Protocol metadata

{
  "protocols": [
    {
      "name": "text",
      "chain": "text",
      "version": "text",
      "description": "text",
      "supported_methods": [
        "text"
      ],
      "contract_address": "text",
      "requires_approval": true
    }
  ],
  "protocols_by_chain": {
    "ANY_ADDITIONAL_PROPERTY": [
      "text"
    ]
  },
  "total_protocols": 1
}

Health check

get
/health

Returns service readiness information and adapter health status.

Responses
200

Service is healthy

application/json
get
/health
GET /health HTTP/1.1
Host: api.tetrics.io
Accept: */*
200

Service is healthy

{
  "status": "healthy",
  "service": "tetrics-modernized-api",
  "version": "2.0.0",
  "chains_supported": [
    "ethereum",
    "hyperliquid"
  ],
  "protocols_discovered": 1,
  "discovery_service_status": "active",
  "adapter_health": {
    "ANY_ADDITIONAL_PROPERTY": true
  }
}

Validate a strategy without executing

post
/validate

Validates a strategy configuration without executing it on-chain. This endpoint checks:

  • Protocol method availability

  • Parameter validity

  • Gas estimates

  • Cross-chain compatibility

Authorizations
Body
Responses
200

Validation summary

application/json
post
/validate
POST /validate HTTP/1.1
Host: api.tetrics.io
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 298

{
  "actions": [
    {
      "chain": "Ethereum",
      "protocol": "lido",
      "method": "deposit",
      "params": {
        "amount": "1000000000000000000"
      },
      "value": "1000000000000000000"
    },
    {
      "chain": "Ethereum",
      "protocol": "morpho",
      "method": "supply",
      "params": {
        "market": "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
        "amount": "1000000000000000000"
      }
    }
  ]
}
{
  "valid": true,
  "errors": [
    "text"
  ],
  "warnings": [
    "text"
  ],
  "total_steps": 1,
  "estimated_total_gas": "text"
}

Execute strategy directly

post
/execute/direct

Executes a strategy using the server-controlled executor wallet. Supports both atomic (single transaction) and sequential (multi-transaction) execution modes.

Execution Modes:

  • atomic - All actions bundled into a single transaction (fails atomically if any step fails)

  • sequential - Actions executed one-by-one (can partially succeed)

Note: This endpoint is suitable for testing and development. For production use with user funds, use the /execute endpoint with Permit2 signatures.

Authorizations
Body
namestringRequired
user_addressstring | nullableOptional

Wallet on whose behalf the strategy is executed

execution_modestring | nullableOptional

Execution mode (atomic or sequential)

Responses
200

Execution result

application/json
post
/execute/direct
POST /execute/direct HTTP/1.1
Host: api.tetrics.io
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 370

{
  "name": "Lido Stake and Morpho Supply",
  "execution_mode": "sequential",
  "user_address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
  "actions": [
    {
      "chain": "Ethereum",
      "protocol": "lido",
      "method": "deposit",
      "params": {
        "amount": "1000000000000000000"
      },
      "value": "1000000000000000000"
    },
    {
      "chain": "Ethereum",
      "protocol": "wsteth",
      "method": "wrap",
      "params": {
        "amount": "1000000000000000000"
      }
    }
  ]
}
{
  "execution_id": "text",
  "user_address": "text",
  "success": true,
  "total_gas_used": "text",
  "total_gas_cost": "text",
  "action_results": [
    {
      "protocol": "text",
      "method": "text",
      "chain": "text",
      "success": true,
      "tx_hash": "text",
      "gas_used": "text",
      "gas_price": "text",
      "gas_cost": "text",
      "output_amount": "text",
      "error": "text",
      "execution_order": 1
    }
  ],
  "execution_time_ms": 1,
  "error": "text",
  "fee_collection": {
    "total_fees_collected": {
      "ANY_ADDITIONAL_PROPERTY": "text"
    },
    "fee_transactions": [
      {
        "chain": "text",
        "asset": "text",
        "amount": "text",
        "tx_hash": "text",
        "success": true,
        "error": "text"
      }
    ],
    "collection_success": true,
    "error": "text",
    "gas_compensation": {
      "relayer_address": "text",
      "total_gas_used": "text",
      "gas_price": "text",
      "compensation_amount": "text",
      "tx_hash": "text",
      "success": true,
      "error": "text"
    }
  }
}

Execute user-signed strategy (gasless)

post
/execute

Executes a strategy on behalf of a user using their Permit2/EIP-712 signature. This enables gasless execution where the API pays for gas and the user authorizes token movements via signature.

Flow:

  1. User calls /permit2/signature to generate EIP-712 typed data

  2. User signs the typed data with their wallet

  3. User submits signature + typed data to this endpoint

  4. API executes the strategy and pays for gas

Security: The signature is verified on-chain to ensure only authorized token transfers occur.

Authorizations
Body
namestringRequired
user_addressstringRequired
user_signaturestringRequired

Hex-encoded EIP-712 signature

Responses
200

Execution result

application/json
post
/execute
POST /execute HTTP/1.1
Host: api.tetrics.io
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 480

{
  "name": "text",
  "user_address": "text",
  "user_signature": "text",
  "signed_typed_data": {
    "types": {
      "ANY_ADDITIONAL_PROPERTY": [
        {
          "name": "text",
          "type": "text"
        }
      ]
    },
    "primaryType": "text",
    "domain": {
      "name": "text",
      "version": "text",
      "chainId": "text",
      "verifyingContract": "text"
    },
    "message": {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    }
  },
  "actions": [
    {
      "chain": "Ethereum",
      "protocol": "text",
      "method": "text",
      "params": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      },
      "value": "text",
      "recipient": "text",
      "skip_on_failure": false
    }
  ]
}
{
  "execution_id": "text",
  "user_address": "text",
  "success": true,
  "total_gas_used": "text",
  "total_gas_cost": "text",
  "action_results": [
    {
      "protocol": "text",
      "method": "text",
      "chain": "text",
      "success": true,
      "tx_hash": "text",
      "gas_used": "text",
      "gas_price": "text",
      "gas_cost": "text",
      "output_amount": "text",
      "error": "text",
      "execution_order": 1
    }
  ],
  "execution_time_ms": 1,
  "error": "text",
  "fee_collection": {
    "total_fees_collected": {
      "ANY_ADDITIONAL_PROPERTY": "text"
    },
    "fee_transactions": [
      {
        "chain": "text",
        "asset": "text",
        "amount": "text",
        "tx_hash": "text",
        "success": true,
        "error": "text"
      }
    ],
    "collection_success": true,
    "error": "text",
    "gas_compensation": {
      "relayer_address": "text",
      "total_gas_used": "text",
      "gas_price": "text",
      "compensation_amount": "text",
      "tx_hash": "text",
      "success": true,
      "error": "text"
    }
  }
}

Generate Permit2 signature payload

post
/permit2/signature

Generates EIP-712 typed data for Permit2 token authorization. The user signs this data with their wallet to authorize the strategy execution without requiring on-chain token approvals.

Returns:

  • EIP-712 typed data structure for wallet signing

  • Execution preview showing gas estimates

  • Gas savings compared to traditional approve + execute flow

Use the returned typed_data with wallet signing libraries (e.g., ethers.js signTypedData) and submit the signature to /execute for gasless execution.

Authorizations
Body
user_addressstringRequired
Responses
200

Permit2 signing payload

application/json
post
/permit2/signature
POST /permit2/signature HTTP/1.1
Host: api.tetrics.io
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 196

{
  "user_address": "text",
  "actions": [
    {
      "chain": "Ethereum",
      "protocol": "text",
      "method": "text",
      "params": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      },
      "value": "text",
      "recipient": "text",
      "skip_on_failure": false
    }
  ]
}
{
  "typed_data": {
    "types": {
      "ANY_ADDITIONAL_PROPERTY": [
        {
          "name": "text",
          "type": "text"
        }
      ]
    },
    "primaryType": "text",
    "domain": {
      "name": "text",
      "version": "text",
      "chainId": "text",
      "verifyingContract": "text"
    },
    "message": {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    }
  },
  "execution_preview": "text",
  "gas_estimate": 1,
  "gas_savings_estimate": 1
}

WebSocket connection for real-time updates

get
/ws

Establishes a WebSocket connection for streaming real-time strategy execution updates, transaction receipts, and balance changes.

Message Types:

  • strategy_progress - Step-by-step execution updates

  • transaction_update - Transaction confirmation events

  • balance_update - Wallet balance changes

  • error - Execution errors and warnings

Example Message:

{
  "type": "strategy_progress",
  "data": {
    "execution_id": "abc-123",
    "step": 2,
    "total_steps": 5,
    "protocol": "lido",
    "status": "completed"
  }
}
Responses
101

WebSocket connection established

No content

get
/ws
GET /ws HTTP/1.1
Host: api.tetrics.io
Accept: */*

No content

Last updated