Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Layerhop Com Earn API
version: 0.1.0
contact:
name: LayerHop
url: https://docs.layerhop.com
description: 'Operations tagged Earn across 2 of this provider''s published API definitions: layerhop-com-openapi.yaml, openapi.yaml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api.layerhop.com
description: Hosted API (production)
- url: http://localhost:8787
description: Local API (`pnpm --filter @layerhop/api dev`)
security:
- {}
- ApiKey: []
tags:
- name: Earn
description: 'Fund any app and the stablecoin yield router: where popular apps'' deposits land
(`GET /v1/fund/targets`), a user''s Polymarket bridge address, current USDC / USDT supply rates
across Aave v3, Compound v3, Morpho vaults and Spark (`GET /v1/yields`), and the deposit calls for
the user''s own wallet, simulated before they are returned. Read-only: LayerHop never holds the
funds and never moves them later. These are third-party apps LayerHop doesn''t control.'
paths:
/v1/fund/targets:
get:
tags:
- Earn
operationId: listFundTargets
summary: List fund-an-app targets
description: 'Where a deposit into each supported app lands, and who receives it:
`polymarket` (`kind: bridge-address`): native USDC on Polygon sent to the user''s own Polymarket
bridge address (`POST /v1/fund/polymarket/address`), which credits their Polymarket balance
(minimum $2); `hyperliquid` (`own-account`): USDC to the user''s own address on HyperCore (chain
1337, perps USDC); `aave-v3-base` / `aave-v3-arbitrum` (`vault`): USDC on that chain to the
user''s wallet, then the supply from the wallet (`POST /v1/yields/{id}/deposit`), or in one step
with the destination-calls `aave-v3-supply` action when `oneStep` is true (destination calls
live); `deposit-address` (`custom-address`): any app''s deposit address the user pastes, on the
chain and token that app asks for. Every target has the `risk` text to show before signing.
Public, cached 5 minutes.'
responses:
'200':
description: The targets.
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
$ref: '#/components/schemas/FundTargetsResponse'
example:
destinationCallsLive: false
targets:
- id: polymarket
name: Polymarket
kind: bridge-address
description: USDC to your Polymarket balance (Polymarket converts it to pUSD on Polygon).
dst:
chainId: 137
token: '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359'
symbol: USDC
decimals: 6
minUsd: 2
risk: Polymarket's bridge credits your Polymarket wallet. …
source: https://docs.polymarket.com/trading/bridge/deposit
url: https://polymarket.com
- id: aave-v3-base
name: Aave v3 on Base
kind: vault
description: Supply USDC to Aave v3 on Base and earn its variable supply rate.
dst:
chainId: 8453
token: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
symbol: USDC
decimals: 6
vaultId: aave-v3:8453:usdc
risk: 'Aave is a lending protocol LayerHop doesn''t control: …'
source: https://aave.com/docs/developers/smart-contracts/pool
url: https://app.aave.com
oneStep: false
servers:
- url: https://api.layerhop.com
description: Hosted API (production)
- url: http://localhost:8787
description: Local API (`pnpm --filter @layerhop/api dev`)
/v1/fund/polymarket/address:
post:
tags:
- Earn
operationId: getPolymarketDepositAddress
summary: Get a Polymarket bridge address
description: 'Asks Polymarket''s Bridge API (`POST https://bridge.polymarket.com/deposit`) for the bridge
addresses of a Polymarket wallet and returns them validated: `evm` receives USDC on Polygon (and
Polymarket''s other supported EVM assets) and credits that Polymarket account. Send the user''s own
Polymarket wallet address (shown in their Polymarket profile), not an exchange address. Replies
are cached for a day per wallet; at most 10 lookups per IP per minute (`RATE_LIMITED`).
`PROVIDER_ERROR` when Polymarket is unreachable or answers without a usable address.'
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties: false
required:
- address
properties:
address:
type: string
pattern: ^0x[0-9a-fA-F]{40}$
description: The user's Polymarket wallet address.
example:
address: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
responses:
'200':
description: The bridge addresses.
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
$ref: '#/components/schemas/PolymarketAddresses'
example:
wallet: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
evm: '0xa84ec1f8f461c25ffa5a6f60249c6d531cb2b608'
svm: Gje4vt9gwSzbq1U9vbwgRWuyVfGqYoPrX8f9VZWo6cuQ
'400':
$ref: '#/components/responses/BadRequest'
'429':
$ref: '#/components/responses/TooManyRequests'
'502':
$ref: '#/components/responses/ProviderError'
servers:
- url: https://api.layerhop.com
description: Hosted API (production)
- url: http://localhost:8787
description: Local API (`pnpm --filter @layerhop/api dev`)
/v1/yields:
get:
tags:
- Earn
operationId: listYields
summary: List stablecoin supply rates
description: 'Current supply APYs of a fixed registry of major USDC / USDT vaults, best first: Aave v3
(Ethereum, Base, Arbitrum, Optimism, Polygon; USDT on Ethereum), Compound v3 (Ethereum, Base,
Arbitrum), Morpho vaults (Spark USDC, Gauntlet USDC Prime and Steakhouse USDC on Base; Steakhouse
USDC / USDT on Ethereum) and Spark Savings USDC (Ethereum). Aave, Compound and Spark rates are read
on-chain (`currentLiquidityRate`, `getSupplyRate(getUtilization())`, the Sky Savings Rate); Morpho
APYs come from Morpho''s API (`netApy`: after the curator fee, incl. rewards). Every vault''s
address and deposit were verified against mainnet state. A vault whose rate can''t be read is
listed in `unavailable`. Rates are variable, not a promise. Cached 5 minutes.'
parameters:
- name: asset
in: query
required: false
description: '`USDC` (default) or `USDT`.'
schema:
type: string
enum:
- USDC
- USDT
example: USDC
responses:
'200':
description: The pools.
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
$ref: '#/components/schemas/YieldsResponse'
example:
asset: USDC
updatedAt: 1761502800
source: onchain+morpho-api
unavailable: []
pools:
- id: morpho:8453:gtusdcp
protocol: morpho
name: Gauntlet USDC Prime (Morpho)
chainId: 8453
chain: base
token:
address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
symbol: USDC
decimals: 6
apy: 5.28
apyBase: 5.28
apyReward: 0
tvlUsd: 410867632
depositable: true
deposit:
kind: erc4626-deposit
target: '0xee8f4ec5672f09119b96ab6fb59c27e1b7e44b61'
url: https://app.morpho.org/base/vault/0xeE8F4eC5672F09119b96Ab6fB59C27E1b7e44b61
- id: aave-v3:8453:usdc
protocol: aave-v3
name: Aave v3 USDC
chainId: 8453
chain: base
token:
address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
symbol: USDC
decimals: 6
apy: 5.15
apyBase: 5.15
apyReward: 0
tvlUsd: 192552928
depositable: true
deposit:
kind: aave-v3-supply
target: '0xa238dd80c259a72e81d7e4664a9801593f98d1c5'
url: https://app.aave.com/reserve-overview/?underlyingAsset=0x833589fcd6edb6e08f4c7c32d4f71b54bda02913&marketName=proto_base_v3
'400':
$ref: '#/components/responses/BadRequest'
'502':
$ref: '#/components/responses/ProviderError'
servers:
- url: https://api.layerhop.com
description: Hosted API (production)
- url: http://localhost:8787
description: Local API (`pnpm --filter @layerhop/api dev`)
/v1/yields/{id}/deposit:
post:
tags:
- Earn
operationId: planYieldDeposit
summary: Build a vault deposit
description: 'The calls that deposit `amount` (base units of the vault''s stablecoin) from `owner`''s own wallet
into the vault, for `owner`: an exact-amount `approve` (Ethereum USDT resets its allowance to 0
first), then `supply(asset, amount, owner, 0)` (Aave v3), `supply(asset, amount)` (Compound v3,
credits the sender) or `deposit(amount, owner)` (ERC-4626 vaults). Before they are returned the
calls are simulated read-only with `eth_simulateV1` from `owner`, holding exactly `amount` (state
override): a revert is `CALLS_REVERTED` (400, with the failing call), a simulation that can''t run `PROVIDER_ERROR`. Send them
from `owner` with EIP-5792 `wallet_sendCalls` (one confirmation) where the wallet supports it, or
one by one. Nothing is signed or sent by LayerHop.'
parameters:
- name: id
in: path
required: true
description: Pool id from `GET /v1/yields`.
schema:
type: string
example: aave-v3:8453:usdc
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties: false
required:
- owner
- amount
properties:
owner:
type: string
pattern: ^0x[0-9a-fA-F]{40}$
description: The depositor's wallet (sends the calls and receives the position).
amount:
type: string
pattern: ^[1-9]\d*$
description: Base units of the vault's stablecoin.
example:
owner: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
amount: '100000000'
responses:
'200':
description: The simulated calls.
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
$ref: '#/components/schemas/YieldDepositPlan'
example:
vault: aave-v3:8453:usdc
chainId: 8453
token: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
amount: '100000000'
owner: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045'
calls:
- to: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
data: 0x095ea7b3…
value: '0'
- to: '0xa238dd80c259a72e81d7e4664a9801593f98d1c5'
data: 0x617ba037…
value: '0'
simulation:
ok: true
gasUsed: '263500'
leftover: '0'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'502':
$ref: '#/components/responses/ProviderError'
servers:
- url: https://api.layerhop.com
description: Hosted API (production)
- url: http://localhost:8787
description: Local API (`pnpm --filter @layerhop/api dev`)
components:
schemas:
FundTarget:
type: object
required:
- id
- name
- description
- kind
- risk
- source
- url
properties:
id:
type: string
enum:
- polymarket
- hyperliquid
- aave-v3-base
- aave-v3-arbitrum
- deposit-address
name:
type: string
description:
type: string
kind:
type: string
enum:
- bridge-address
- own-account
- vault
- custom-address
description: '`bridge-address`: the route pays the app''s per-user address; `own-account`: the user''s own address on `dst`; `vault`: route to the user''s wallet, then deposit into `vaultId`; `custom-address`: an address the user pastes.'
dst:
type: object
description: Where the route lands (absent for `custom-address`).
required:
- chainId
- token
- symbol
- decimals
properties:
chainId:
type: integer
token:
type: string
symbol:
type: string
decimals:
type: integer
vaultId:
type: string
description: '`vault`: the pool id for `POST /v1/yields/{id}/deposit`.'
minUsd:
type: number
description: Smallest deposit the app processes.
risk:
type: string
description: Shown before the user signs.
source:
type: string
description: The app's own docs for its deposits.
url:
type: string
oneStep:
type: boolean
description: '`vault` only: bridge + supply on arrival in one transaction (destination calls live).'
PolymarketAddresses:
type: object
required:
- wallet
- evm
properties:
wallet:
type: string
description: The Polymarket wallet (lowercased).
evm:
type: string
description: 'Bridge address for EVM chains (lowercased): the recipient of a route into USDC on Polygon.'
svm:
type: string
description: Bridge address on Solana.
YieldDepositPlan:
type: object
required:
- vault
- chainId
- token
- amount
- owner
- calls
- simulation
properties:
vault:
type: string
chainId:
type: integer
token:
type: string
amount:
type: string
description: Base units.
owner:
type: string
calls:
type: array
items:
type: object
required:
- to
- data
- value
properties:
to:
type: string
data:
type: string
value:
type: string
simulation:
type: object
required:
- ok
- gasUsed
properties:
ok:
type: boolean
const: true
gasUsed:
type: string
leftover:
type: string
Error:
type: object
description: Every non-2xx response has this body.
required:
- error
properties:
error:
type: object
required:
- code
- message
- requestId
- docsUrl
properties:
code:
$ref: '#/components/schemas/ErrorCode'
message:
type: string
description: Human-readable detail. Do not parse it.
requestId:
type: string
format: uuid
description: Same value as the `x-request-id` header.
docsUrl:
type: string
format: uri
description: Error catalog page, `https://docs.layerhop.com/errors/{code}`.
details:
type: object
description: 'Extra structured data, only on some errors. `NO_ROUTE` (and `AMOUNT_TOO_SMALL` /
`AMOUNT_TOO_LARGE` decided from the providers'' answers) on a quote carry `errors`: why
each provider returned no quote, the same entries a successful response lists in `errors`.
`AMOUNT_TOO_SMALL` on a quote may also carry the route''s minimum (D-036): `minAmount`,
`minAmountUsd`, `minAmountApprox`. `NO_ROUTE` on a live quote (and `UNSUPPORTED_CHAIN`
into a route-restricted chain such as Blast) may carry `suggestions` (D-053).
'
properties:
errors:
type: array
items:
$ref: '#/components/schemas/ProviderError'
suggestions:
type: array
maxItems: 4
description: '`NO_ROUTE` / `UNSUPPORTED_CHAIN` on a live quote: alternatives that quoted, best first (D-053).'
items:
$ref: '#/components/schemas/RouteSuggestion'
minAmount:
type: string
pattern: ^\d+$
description: '`AMOUNT_TOO_SMALL`: smallest input known to quote on this route, base units of `srcToken`.'
minAmountUsd:
type: number
description: '`AMOUNT_TOO_SMALL`: `minAmount` in USD, when the token has a price.'
minAmountApprox:
type: boolean
description: '`AMOUNT_TOO_SMALL`: `true` when `minAmount` was found by probing larger amounts ($10 / $25 / $50), so the true minimum is at most this; `false` when a provider reported it.'
ErrorCode:
type: string
description: Stable error code. Each has a page at `https://docs.layerhop.com/errors/{code}`.
enum:
- INVALID_PARAMS
- UNSUPPORTED_CHAIN
- UNSUPPORTED_TOKEN
- AMOUNT_TOO_SMALL
- AMOUNT_TOO_LARGE
- CALLS_REVERTED
- LAUNCH_IMAGE_INVALID
- NO_ROUTE
- ROUTE_EXCLUDED
- QUOTE_NOT_FOUND
- QUOTE_EXPIRED
- ORDER_NOT_FOUND
- PROVIDER_ERROR
- PROVIDER_TIMEOUT
- RATE_LIMITED
- QUOTA_EXCEEDED
- UNAUTHORIZED
- FORBIDDEN
- ADDRESS_SANCTIONED
- NOT_FOUND
- CONFLICT
- GASLESS_PENDING
- GASLESS_FAILED
- MARKET_UNAVAILABLE
- LIMIT_ORDER_REJECTED
- INTERNAL
ProviderError:
type: object
description: A provider that failed while the request as a whole succeeded.
required:
- provider
- code
- message
properties:
provider:
$ref: '#/components/schemas/ProviderId'
code:
$ref: '#/components/schemas/ErrorCode'
message:
type: string
YieldsResponse:
type: object
required:
- asset
- updatedAt
- source
- pools
- unavailable
properties:
asset:
type: string
enum:
- USDC
- USDT
updatedAt:
type: integer
description: Unix seconds.
source:
type: string
pools:
type: array
items:
$ref: '#/components/schemas/YieldPool'
unavailable:
type: array
items:
type: string
description: Pool ids whose rate couldn't be read this time.
YieldPool:
type: object
required:
- id
- protocol
- name
- chainId
- chain
- token
- apy
- apyBase
- apyReward
- tvlUsd
- depositable
- deposit
- url
properties:
id:
type: string
description: '`<protocol>:<chainId>:<slug>`, stable.'
protocol:
type: string
enum:
- aave-v3
- compound-v3
- morpho
- spark
name:
type: string
chainId:
type: integer
chain:
type: string
token:
type: object
required:
- address
- symbol
- decimals
properties:
address:
type: string
symbol:
type: string
enum:
- USDC
- USDT
decimals:
type: integer
apy:
type: number
description: Percent, e.g. 4.12. Variable.
apyBase:
type: number
apyReward:
type: number
tvlUsd:
type:
- number
- 'null'
description: Assets in the vault (stablecoins at $1).
depositable:
type: boolean
deposit:
type: object
required:
- kind
- target
properties:
kind:
type: string
enum:
- aave-v3-supply
- comet-supply
- erc4626-deposit
target:
type: string
description: The contract approved and called.
url:
type: string
description: The vault on the protocol's own site.
RouteSuggestion:
description: 'An alternative to a route that returned no quote (D-053). `dst_token`: same payment, another
destination token. `src_token`: same destination token, paid with another source token worth the
same. `via_hub`: two signed steps through `hub` (`steps[0]` then `steps[1]`, each its own quote,
order and signature); the top-level fields describe the whole trip.
'
allOf:
- $ref: '#/components/schemas/RouteLeg'
- type: object
required:
- kind
- message
properties:
kind:
type: string
enum:
- dst_token
- src_token
- via_hub
message:
type: string
description: Short text for a button, e.g. "Receive USDC on Ethereum instead".
symbol:
type: string
description: 'The token that changed: the new source or destination token, or the hub token.'
hub:
type: object
description: '`via_hub` only: the token between the two steps.'
required:
- chainId
- token
- symbol
- decimals
properties:
chainId:
type: integer
token:
type: string
symbol:
type: string
decimals:
type: integer
steps:
type: array
description: '`via_hub` only: the two legs in order.'
minItems: 2
maxItems: 2
items:
$ref: '#/components/schemas/RouteLeg'
ProviderId:
type: string
description: 'Liquidity provider. Loaded by default: `jupiter`, `relay`, `debridge`, `zerox`, `kyberswap`, `lifi`, `mayan`,
`blast-native` (Blast''s canonical bridge: ETH on Ethereum → ETH on Blast only, no LayerHop fee).
`across` (Across Protocol, cross-chain EVM ↔ EVM), `baltex` (Baltex exchanges and DEX swaps), `routefun`
(Route, same-chain), `bebop` (Bebop RFQ and Aggregation, same-chain), `near-intents` (NEAR Intents 1Click),
`thorchain` and `chainflip` (native BTC and other non-EVM routes) `layerhop-solver` (LayerHop''s own solver: USDC between Base,
Arbitrum and OP Mainnet, filled from our inventory) and `layerhop-router` (LayerHop''s own same-chain
router on Robinhood Chain and Berachain) are built but not loaded by default.
`odos` is shut down; `mock` exists only in local
development (`LAYERHOP_ENABLE_MOCK=1`). `sandbox` serves every request made with an `lh_test_` key.
`direct` is a plain token transfer, used by checkout when the payer already holds the settlement token.
'
enum:
- jupiter
- relay
- debridge
- mayan
- zerox
- kyberswap
- odos
- lifi
- blast-native
- across
- baltex
- routefun
- bebop
- near-intents
- thorchain
- chainflip
- layerhop-router
- layerhop-solver
- mock
- sandbox
- direct
FundTargetsResponse:
type: object
required:
- targets
- destinationCallsLive
properties:
targets:
type: array
items:
$ref: '#/components/schemas/FundTarget'
destinationCallsLive:
type: boolean
RouteLeg:
type: object
description: One quotable leg, in the same terms as a quote request. Amounts are base units.
required:
- srcChain
- srcToken
- amount
- dstChain
- dstToken
properties:
srcChain:
type: integer
description: Source chain id.
srcToken:
type: string
description: 'Source token address or mint (native coin: the zero address; SOL: the system program id).'
amount:
type: string
pattern: ^\d+$
description: Input in base units of `srcToken`.
dstChain:
type: integer
description: Destination chain id.
dstToken:
type: string
dstAmount:
type: string
pattern: ^\d+$
description: Estimated output in base units of `dstToken` (from the check quote; scaled when served from cache).
responses:
ProviderError:
description: The upstream provider failed (`PROVIDER_ERROR`).
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: PROVIDER_ERROR
message: api.relay.link 500
requestId: 0d5e1f6a-3b2c-4d1e-8f9a-7b6c5d4e3f21
docsUrl: https://docs.layerhop.com/errors/PROVIDER_ERROR
NotFound:
description: The resource does not exist or belongs to another account (`NOT_FOUND`).
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: NOT_FOUND
message: API key not found
requestId: 0d5e1f6a-3b2c-4d1e-8f9a-7b6c5d4e3f21
docsUrl: https://docs.layerhop.com/errors/NOT_FOUND
BadRequest:
description: 'Invalid request (`INVALID_PARAMS`, `UNSUPPORTED_CHAIN`, `UNSUPPORTED_TOKEN`,
`AMOUNT_TOO_SMALL`, `AMOUNT_TOO_LARGE`).
'
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: INVALID_PARAMS
message: 'amount: amount must be an integer string in base units'
requestId: 0d5e1f6a-3b2c-4d1e-8f9a-7b6c5d4e3f21
docsUrl: https://docs.layerhop.com/errors/INVALID_PARAMS
TooManyRequests:
description: 'Over your rate limit (`RATE_LIMITED`): the key''s `rateLimitRpm`, or `ANON_RATE_LIMIT_RPM` per IP
without a key. Wait `retry-after` seconds.
'
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
retry-after:
description: Seconds until a request will be accepted.
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: RATE_LIMITED
message: Rate limit of 120 requests/minute exceeded; retry in 1s
requestId: 0d5e1f6a-3b2c-4d1e-8f9a-7b6c5d4e3f21
docsUrl: https://docs.layerhop.com/errors/RATE_LIMITED
headers:
RequestId:
description: Unique id for this request. Quote it when you report a problem.
schema:
type: string
format: uuid
securitySchemes:
ApiKey:
type: apiKey
in: header
name: x-api-key
description: 'Optional. An `lh_live_…` key from the dashboard attributes requests and orders to your account
and raises your rate limit (per key, default 120 requests/minute; without a key the limit is
per IP). An invalid or revoked key is rejected with `UNAUTHORIZED`. If your account has an
active partner profile, the key selects your partner fee and allows `integratorFeeBps`.
An `lh_test_…` key switches every request to **test mode**: quotes come from the `sandbox`
provider (priced from live USD prices), built transactions are placeholders that move no funds
(`tx.sandbox: true`), and reported orders run a simulated lifecycle (pending, then filled in about
10 seconds) with webhooks sent to your test endpoints only. Amounts ending in `4001` refund,
`4002` fail and `4004` return `NO_ROUTE`. Test and live data never mix: a quote, order or
webhook of one mode is invisible to the other.
'
Session:
type: apiKey
in: cookie
name: lh_session
description: 'Dashboard session cookie set by `POST /v1/auth/verify` (HttpOnly, Secure, SameSite=Lax,
7 days). Auth and Dashboard routes only.
'
AdminBearer:
type: http
scheme: bearer
description: Operator `ADMIN_TOKEN`. Admin routes only.
AdminSession:
type: apiKey
in: cookie
name: lh_admin
description: Owner sign-in cookie set by `POST /v1/admin/login` (12 hours). Admin routes only.
x-refined-from:
- layerhop-com-openapi.yaml
- openapi.yaml