LayerHop Gas station API
Refuel up to 10 chains with native gas from one transaction (source: Gas.zip). Off unless the deployment sets `GAS_STATION_ENABLED=1`; every route answers `FORBIDDEN` while off. LayerHop takes no fee on refuels.
Refuel up to 10 chains with native gas from one transaction (source: Gas.zip). Off unless the deployment sets `GAS_STATION_ENABLED=1`; every route answers `FORBIDDEN` while off. LayerHop takes no fee on refuels.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/layerhop-com:layerhop-com-gas-station-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Layerhop Com Gas station API
version: 0.1.0
contact:
name: LayerHop
url: https://docs.layerhop.com
description: 'Operations tagged Gas station 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: Gas station
description: 'Refuel up to 10 chains with native gas from one transaction (source: Gas.zip). Off unless the
deployment sets `GAS_STATION_ENABLED=1`; every route answers `FORBIDDEN` while off. LayerHop takes
no fee on refuels.'
paths:
/v1/gas/chains:
get:
tags:
- Gas station
operationId: listGasChains
summary: List gas station chains
description: Chains you can pay from (`inbound`, native token) and refuel (`outbound`), with the per-chain USD range (our $0.50 – $50 caps within the source's own limits). Cached for 5 minutes.
responses:
'200':
description: Chains.
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
type: object
required:
- provider
- ourFeeBps
- maxChains
- chains
properties:
provider:
type: string
const: gaszip
ourFeeBps:
type: integer
description: LayerHop's fee (0).
maxChains:
type: integer
description: Most destinations per refuel (10).
chains:
type: array
items:
$ref: '#/components/schemas/GasStationChain'
'403':
description: '`FORBIDDEN`: the gas station isn''t enabled on this deployment.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
servers:
- url: https://api.layerhop.com
description: Hosted API (production)
- url: http://localhost:8787
description: Local API (`pnpm --filter @layerhop/api dev`)
/v1/gas/quote:
post:
tags:
- Gas station
operationId: quoteGasRefuel
summary: Quote a multi-chain refuel
description: 'One transaction on `srcChain` (paid in its native token) that delivers native gas to every
destination. The source splits one deposit evenly, so every destination takes the same `usd`
(1 to 10 destinations, distinct, not the source chain). The returned `tx` (a call to Gas.zip''s
deposit contract) is checked against the request (contract, destinations from LayerHop''s own
Gas.zip chain-id table, recipient, value; Gas.zip''s native price within 3% of ours)
before it is returned, then simulated with `eth_call` from `sender` (`simulation.ok: false`
usually means not enough balance). `NO_ROUTE` names destinations the source can''t serve right
now. Good for about 60 seconds. At most 30 quotes per IP per minute.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/GasStationQuoteInput'
example:
srcChain: base
sender: '0x2a5b2A8d0E4e8Ff1e83C7cA4d0A4e3B7c0F1a234'
destinations:
- chain: arbitrum
usd: 2
- chain: optimism
usd: 2
- chain: bsc
usd: 2
responses:
'200':
description: The refuel quote and its transaction.
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
$ref: '#/components/schemas/GasStationQuote'
'400':
$ref: '#/components/responses/BadRequest'
'403':
description: '`FORBIDDEN`: the gas station isn''t enabled on this deployment, or the source refuses the address.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
$ref: '#/components/responses/NoRoute'
'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/gas/status/{txHash}:
get:
tags:
- Gas station
operationId: getGasRefuelStatus
summary: Track a refuel
description: The deposit's outbound transfers, per destination chain. `status` is `pending`, `filled` (every destination confirmed), `refunded`, `failed` or `unknown` (not seen yet).
parameters:
- name: txHash
in: path
required: true
description: The deposit transaction.
schema:
type: string
pattern: ^0x[0-9a-fA-F]{64}$
responses:
'200':
description: Refuel status.
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
$ref: '#/components/schemas/GasRefuelStatus'
'400':
$ref: '#/components/responses/BadRequest'
'403':
description: '`FORBIDDEN`: the gas station isn''t enabled on this deployment.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
servers:
- url: https://api.layerhop.com
description: Hosted API (production)
- url: http://localhost:8787
description: Local API (`pnpm --filter @layerhop/api dev`)
/v1/gas/balances:
get:
tags:
- Gas station
operationId: getGasBalances
summary: Native balances on several chains
description: 'The address''s native balance on each chain (up to 11), for watching a refuel land. A chain whose RPC didn''t answer has `error: true`.'
parameters:
- name: address
in: query
required: true
description: EVM address.
schema:
type: string
pattern: ^0x[0-9a-fA-F]{40}$
- name: chains
in: query
required: true
description: Comma-separated chain ids or slugs.
schema:
type: string
example: arbitrum,optimism
responses:
'200':
description: Balances.
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
type: object
required:
- address
- balances
properties:
address:
type: string
balances:
type: array
items:
type: object
required:
- chainId
- token
properties:
chainId:
type: integer
token:
type: string
description: '`0x0000…0000` (native).'
wei:
type: string
pattern: ^\d+$
error:
type: boolean
'400':
$ref: '#/components/responses/BadRequest'
'403':
description: '`FORBIDDEN`: the gas station isn''t enabled on this deployment.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
servers:
- url: https://api.layerhop.com
description: Hosted API (production)
- url: http://localhost:8787
description: Local API (`pnpm --filter @layerhop/api dev`)
components:
schemas:
EvmCall:
type: object
required:
- to
- data
- value
properties:
to:
type: string
data:
type: string
description: Hex calldata.
value:
type: string
pattern: ^\d+$
description: Native value in wei.
GasRefuelStatus:
type: object
required:
- status
- outbound
properties:
status:
type: string
enum:
- pending
- filled
- refunded
- failed
- unknown
outbound:
type: array
items:
type: object
required:
- chainId
properties:
chainId:
type: integer
hash:
type: string
status:
type: string
refund:
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).
GasStationChain:
type: object
required:
- chainId
- name
- symbol
- decimals
- inbound
- outbound
- minUsd
- maxUsd
properties:
chainId:
type: integer
name:
type: string
symbol:
type: string
decimals:
type: integer
inbound:
type: boolean
description: Can pay from this chain.
outbound:
type: boolean
description: Can refuel this chain.
minUsd:
type: number
maxUsd:
type: number
minDepositUsd:
type: number
maxDepositUsd:
type: number
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
GasStationQuote:
type: object
required:
- provider
- srcChainId
- sender
- recipient
- depositWei
- depositUsd
- destinations
- fees
- tx
- simulation
- expiresAt
properties:
provider:
type: string
const: gaszip
srcChainId:
type: integer
sender:
type: string
recipient:
type: string
depositWei:
type: string
pattern: ^\d+$
description: What the sender pays.
depositUsd:
type: number
destinations:
type: array
items:
type: object
required:
- chainId
- name
- symbol
- decimals
- expectedWei
- usd
properties:
chainId:
type: integer
name:
type: string
symbol:
type: string
decimals:
type: integer
expectedWei:
type: string
pattern: ^\d+$
usd:
type: number
seconds:
type: number
fees:
type: object
required:
- ourFeeBps
- providerFeeUsd
properties:
ourFeeBps:
type: integer
providerFeeUsd:
type: number
tx:
$ref: '#/components/schemas/EvmTx'
simulation:
type: object
required:
- ok
properties:
ok:
type: boolean
error:
type: string
expiresAt:
type: integer
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
EvmTx:
type: object
required:
- vm
- chainId
- to
- data
- value
properties:
vm:
type: string
const: evm
chainId:
type: integer
to:
type: string
data:
type: string
description: Hex calldata.
value:
type: string
pattern: ^\d+$
description: Native value in wei.
approval:
$ref: '#/components/schemas/Approval'
extraTxs:
type: array
description: 'Further calls to send from the same wallet after the main transaction, in order. Today only
same-token checkout payments carry one: LayerHop''s fee transfer (an ERC-20 `transfer` to
LayerHop''s fee wallet). Wallets with EIP-5792 `wallet_sendCalls` may batch them with the main
call. Report the main transaction''s hash.
'
items:
$ref: '#/components/schemas/EvmCall'
sandbox:
type: boolean
const: true
description: 'Test mode only: a placeholder that moves no funds. Never broadcast it.'
Approval:
type: object
description: An ERC-20 `approve(spender, amount)` on `token` that must be mined before the main transaction.
required:
- token
- spender
- amount
properties:
token:
type: string
description: ERC-20 contract to call `approve` on.
spender:
type: string
amount:
type: string
pattern: ^\d+$
description: Base units.
GasStationQuoteInput:
type: object
required:
- srcChain
- sender
- destinations
additionalProperties: false
properties:
srcChain:
oneOf:
- type: string
- type: integer
description: Chain to pay from (its native token).
srcToken:
type: string
description: Optional; must be the native token.
sender:
type: string
description: The paying wallet.
recipient:
type: string
description: Who receives the gas (default the sender).
destinations:
type: array
minItems: 1
maxItems: 10
items:
type: object
required:
- chain
- usd
additionalProperties: false
properties:
chain:
oneOf:
- type: string
- type: integer
usd:
type: number
description: USD of gas for this chain; the same for every destination.
responses:
NoRoute:
description: No provider supports the route, or every provider failed (`NO_ROUTE`), or the avoid-lists (`excludeProviders` / `excludeBridges` / `excludeExchanges`) ruled out every route (`ROUTE_EXCLUDED`). When providers were asked, `error.details.errors` says why each one failed.
headers:
x-request-id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: NO_ROUTE
message: No provider returned a quote
requestId: 0d5e1f6a-3b2c-4d1e-8f9a-7b6c5d4e3f21
docsUrl: https://docs.layerhop.com/errors/NO_ROUTE
details:
errors:
- provider: lifi
code: NO_ROUTE
message: 'lifi: No available quotes for the requested transfer'
suggestions:
- kind: dst_token
message: Receive USDC on Ethereum instead
symbol: USDC
srcChain: 1672
srcToken: '0x0000000000000000000000000000000000000000'
amount: '16423889478106962868'
dstChain: 1
dstToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
dstAmount: '10366163'
- kind: via_hub
message: 'Two steps via Arbitrum: to USDC on Arbitrum first, then on to Ethereum'
symbol: USDC
srcChain: 1672
srcToken: '0x0000000000000000000000000000000000000000'
amount: '16423889478106962868'
dstChain: 1
dstToken: '0x0000000000000000000000000000000000000000'
dstAmount: '4323292780391720'
hub:
chainId: 42161
token: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831'
symbol: USDC
decimals: 6
steps:
- srcChain: 1672
srcToken: '0x0000000000000000000000000000000000000000'
amount: '16423889478106962868'
dstChain: 42161
dstToken: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831'
dstAmount: '10320058'
- srcChain: 42161
srcToken: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831'
amount: '10320058'
dstChain: 1
dstToken: '0x0000000000000000000000000000000000000000'
dstAmount: '4323292780391720'
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
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