API Reference

REST and WebSocket endpoints. Base URL: https://api.defimec.org/v1

Authentication: All requests require Authorization: Bearer <api_key>. Get your API key from your account dashboard.

RPC Health

Probe RPC endpoints for staleness, chain-ID mismatch, and response time before routing transactions.

GET /rpc/health/:chain

Path params: chain — one of solana, base, arbitrum

# Response 200
{
  "ok": true,
  "chain": "base",
  "chainId": 8453,
  "blockNumber": 24561892,
  "blockLag": 0,
  "latencyMs": 84,
  "rpcUrl": "https://mainnet.base.org",
  "probeTs": "2026-03-18T09:12:04Z"
}
# Response 200 (unhealthy — stale)
{
  "ok": false,
  "chain": "base",
  "reason": "block_lag",
  "blockLag": 47,
  "fallbackActivated": true
}

Calldata Decode

Decode raw calldata into human-readable instructions.

POST /decode
# Request body
{
  "chain": "base",
  "data": "0xa9059cbb000000000000000000000000d8dA6BF2...",
  "to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
}

# Response 200
{
  "type": "erc20_transfer",
  "function": "transfer(address,uint256)",
  "to": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  "amount": "500000000",
  "token": {
    "symbol": "USDC",
    "decimals": 6,
    "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
  },
  "raw": "0xa9059cbb000000000000..."
}

EIP-712 Typed Data

Decode and verify EIP-712 typed-data structures before signing. Validates domain separator and chainId field.

POST /decode/eip712
# Request body
{
  "chain": "arbitrum",
  "typedData": {
    "domain": { "name": "Permit2", "chainId": 42161, ... },
    "message": { "spender": "0x...", "value": "1000000" }
  }
}

# Response 200
{
  "valid": true,
  "chainIdMatch": true,
  "declaredChainId": 42161,
  "signingChainId": 42161,
  "domainWarnings": [],
  "messageType": "PermitTransferFrom",
  "humanReadable": "Allow Permit2 to transfer up to 1 USDC"
}

Sign

Route a transaction through the Defimec signing layer. Chain-ID is verified before the Ledger device is invoked.

POST /sign
# Request body
{
  "chain": "base",
  "tx": {
    "to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "data": "0xa9059cbb...",
    "value": "0x0",
    "gas": "0x5208",
    "nonce": "0x12"
  },
  "verify": {
    "chainId": true,
    "rpcHealth": true,
    "calldataDecode": true
  }
}

# Response 200
{
  "signature": "0x...",
  "verified": {
    "chainId": true,
    "rpcHealthy": true,
    "calldataDecoded": true,
    "calldataType": "erc20_transfer"
  },
  "ledgerPath": "m/44'/60'/0'/0/0",
  "signedAt": "2026-03-18T09:15:22Z"
}

Multisig (Treasury)

Coordinate multi-signer approvals across chains. Each signer receives a decoded view of the transaction. Treasury tier only.

POST /multisig/request
# Create a multisig signing request
{
  "chain": "arbitrum",
  "tx": { "to": "0x...", "data": "0x...", "value": "0x0" },
  "signers": ["0xSigner1...", "0xSigner2...", "0xSigner3..."],
  "threshold": 2
}

# Response 200
{
  "requestId": "req_8f2c4a1b9d",
  "status": "pending",
  "signaturesReceived": 0,
  "threshold": 2,
  "decodedTx": { "type": "erc20_transfer", ... }
}

WebSocket events

Connect to wss://api.defimec.org/v1/events for real-time signing and RPC health events.

# Subscribe to RPC health events for all chains
{ "action": "subscribe", "channel": "rpc.health", "chains": ["solana","base","arbitrum"] }

# Incoming event
{
  "event": "rpc.health.changed",
  "chain": "solana",
  "ok": false,
  "reason": "chainid_mismatch",
  "ts": "2026-03-18T09:16:04Z"
}