{"openapi":"3.1.0","info":{"title":"layel","version":"1.0.0","description":"Layel: pre-flight checks for AI agents on Base, Ethereum, Arbitrum One and Polygon. Layel Scope (paid, $0.01 per call in USDC on Base via x402): one call checks balances, allowance, nonce, fees and a simulation of the exact transaction, with balances and the simulation read at one pinned block, and returns a signed receipt. Charged only when the consistency checksum passes. Layel Gas (free, Fair Use): current gas price, EIP-1559 fees and a recent fee window. Layel Proof (free): signer address and receipt verification. No API key.","contact":{"url":"https://layel.xyz","email":"hello@layel.xyz"},"termsOfService":"https://layel.xyz/legal#terms","x-guidance":"Call POST /v1/scope ($0.01), Layel Scope, to get a wallet's balances and a simulation of the transaction you are about to send, in one call (set chain to base, ethereum, arbitrum or polygon; default base): native-token balance, optional ERC-20 balance and allowance, nonce and gas, plus success or the decoded revert and a gas estimate. Balances, allowance and the simulation are read at one pinned block; the pending nonce and the priority fee come from the node's head and are flagged in the result. EIP-712 signed receipt included. Facts only: no risk score, no go/no-go verdict. You are charged only when checksumPassed is true; otherwise HTTP 503 and no charge. Also free: GET /v1/gas (Layel Gas) returns the current gas price, EIP-1559 fees and a recent fee window. Full guide: /llms.txt","x-logo":{"url":"https://api.layel.xyz/icon.png","altText":"Layel"}},"x-agentcash-guidance":{"llmsTxtUrl":"https://api.layel.xyz/llms.txt"},"externalDocs":{"description":"Layel documentation: quickstart, errors, paying with x402, receipts","url":"https://layel.xyz/docs"},"servers":[{"url":"https://api.layel.xyz"}],"paths":{"/v1/scope":{"post":{"operationId":"scope","externalDocs":{"description":"Layel Scope: request, response fields, paying with x402","url":"https://layel.xyz/docs#scope"},"summary":"Layel Scope: wallet balances and transaction simulation on Base, Ethereum, Arbitrum One or Polygon in one request.","description":"Read a wallet's native balance and, optionally, one ERC-20 balance and allowance, and simulate one transaction. Balances, allowance and the simulation are read at the same block. One chain per request: base, ethereum, arbitrum or polygon (default base).","security":[],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.01"},"protocols":[{"x402":{}}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"chain":{"type":"string","enum":["base","ethereum","arbitrum","polygon"],"default":"base","description":"Chain to read and simulate on. Defaults to base. Payment is always USDC on Base, whatever chain is read."},"intent":{"type":"string","enum":["transfer","approve","swap","call"],"description":"What the agent is about to do. For transfer and approve the calldata is built for you and simulated; for call and swap your calldata is simulated."},"from":{"type":"string","description":"Wallet address (0x...). Its balances are read and the simulation runs as this address."},"to":{"type":"string","description":"Recipient (transfer) or target contract (call, swap) (0x...)."},"token":{"type":"string","description":"Optional ERC-20 address. Omit for the native token."},"amount":{"type":"string","description":"Atomic units as a decimal string: token units for token intents, wei for a native transfer or call."},"spender":{"type":"string","description":"Spender address (0x...). Required for approve; used for the allowance check and destination code facts."},"data":{"type":"string","description":"Calldata (0x...) for call and swap. Required to simulate a swap. Not accepted for transfer or approve."}},"required":["intent","from"]}}}},"responses":{"200":{"description":"Advisory result with EIP-712 receipt (schema layel-scope/1)","content":{"application/json":{"schema":{"type":"object","properties":{"schema":{"type":"string","description":"Result schema id, layel-scope/1."},"endpoint":{"type":"string"},"chain":{"type":"string","description":"Chain that was read and simulated."},"chainId":{"type":"integer"},"intent":{"type":"string"},"advisoryOnly":{"type":"boolean","description":"Always true. Facts only, no verdict and no risk score."},"checksumPassed":{"type":"boolean","description":"True when the same-block consistency check passed. Payment is settled only then."},"block":{"type":"object","description":"Pinned block: number, hash, timestamp, ageSeconds."},"anomalies":{"type":"array","description":"Concrete findings ordered by severity, each with a code, severity and message.","items":{"type":"object"}},"data":{"type":"object","description":"Balances, allowance, nonce, gas, destination and the simulation result at the pinned block."},"confidence":{"type":"object"},"limitations":{"type":"array","items":{"type":"string"}},"receipt":{"type":"object","description":"EIP-712 signed receipt: message, signature and signer."}},"additionalProperties":true}}}},"402":{"description":"Payment Required"},"409":{"description":"This payment authorization is already in use. Sign a new payment."},"503":{"description":"The consistency checksum failed. Not charged. The body carries the signed receipt (checksumPassed false, amount 0). Retry shortly."}}}},"/v1/gas":{"get":{"operationId":"gas","externalDocs":{"description":"Layel Gas: fields and the max fee rule","url":"https://layel.xyz/docs#gas"},"summary":"Layel Gas: gas price, EIP-1559 fees and recent fee window on base, ethereum, arbitrum or polygon (free, Fair Use)","description":"Get the current gas price on base, ethereum, arbitrum or polygon, one chain per request (default: base). Free under Fair Use (30 requests/minute per IP). Returns the gas price and EIP-1559 fee values (wei and gwei) at the latest block, plus a recent window (default last 20 blocks, up to 200): base fee range, where the current base fee ranks in it, how much it varies, trend and typical priority fees.","security":[],"parameters":[{"name":"chain","in":"query","required":false,"schema":{"type":"string","enum":["base","ethereum","arbitrum","polygon"],"default":"base"}},{"name":"blocks","in":"query","required":false,"description":"Size of the recent window, in blocks.","schema":{"type":"integer","minimum":1,"maximum":200,"default":20}}],"responses":{"200":{"description":"Current gas price and recent window","content":{"application/json":{"schema":{"type":"object","properties":{"schema":{"type":"string","description":"Result schema id, layel-gas/1."},"chain":{"type":"string"},"chainId":{"type":"integer"},"block":{"type":"object","description":"Block the values were read at: number, hash, timestamp, ageSeconds.","properties":{"number":{"type":"integer"},"hash":{"type":"string"},"timestamp":{"type":"integer"},"ageSeconds":{"type":"integer"}}},"gasPrice":{"type":"string","description":"Current gas price in wei (integer string)."},"baseFeePerGas":{"type":["string","null"],"description":"Base fee of the latest block in wei. Null on chains without EIP-1559."},"maxPriorityFeePerGas":{"type":["string","null"],"description":"Suggested priority fee in wei: median of the last 5 blocks, the same tip Layel Scope uses to compute data.gas.estimate. Falls back to the node suggestion if fee history is unavailable. Null when neither is available."},"maxFeePerGas":{"type":["string","null"],"description":"Suggested max fee in wei: 2 x next base fee + maxPriorityFeePerGas (the same rule as Layel Scope data.gas.estimate.maxFeePerGas). Falls back to 2 x baseFeePerGas + the node priority fee if fee history is unavailable. Null when inputs are missing."},"maxFeeRule":{"type":"string","description":"The rule used for maxFeePerGas in this response."},"maxFeeInputs":{"type":"object","description":"The inputs behind maxFeePerGas (maxFeePerGas = 2 x baseFeePerGas + maxPriorityFeePerGas, in wei): baseFeePerGas (string or null), baseFeeKind ('next' or 'current' or null), maxPriorityFeePerGas (string or null), priorityFeeBlocks (number of blocks behind the median tip, or null)."},"gwei":{"type":"object","description":"The same values in gwei (decimal strings, null where the wei value is null).","properties":{"gasPrice":{"type":"string"},"baseFeePerGas":{"type":["string","null"]},"maxPriorityFeePerGas":{"type":["string","null"]},"maxFeePerGas":{"type":["string","null"]}}},"recent":{"type":["object","null"],"description":"Window of the last `blocks` blocks: baseFeePerGas {min, median, max} in wei, currentBaseFeePercentile (0-100, where the current base fee ranks in the window; blocks equal to it count half, so a flat window reads about 50), baseFeeRangePercent (how much the window base fee varies, (max - min) / min in percent; a small value means the percentile says little), nextBaseFeePerGas, baseFeeTrend (rising, falling, flat), maxPriorityFeePerGas {p25, p50, p75} (median across blocks), avgGasUsedRatio, and the same values in gwei. Null when the node cannot provide fee history.","properties":{"blocks":{"type":"integer"},"baseFeePerGas":{"type":"object"},"currentBaseFeePercentile":{"type":"integer"},"baseFeeRangePercent":{"type":["number","null"]},"nextBaseFeePerGas":{"type":"string"},"baseFeeTrend":{"type":"string","enum":["rising","falling","flat","unknown"]},"maxPriorityFeePerGas":{"type":"object"},"avgGasUsedRatio":{"type":["number","null"]},"gwei":{"type":"object"}}}},"additionalProperties":true}}}},"400":{"description":"Unsupported chain or invalid blocks"},"429":{"description":"Fair Use limit reached. Retry after Retry-After."},"502":{"description":"Gas price unavailable. Retry shortly."}}}},"/proof":{"get":{"operationId":"proof","externalDocs":{"description":"Receipts and how to verify them","url":"https://layel.xyz/docs#receipts"},"summary":"Layel Proof: public signer address and receipt verification details (free)","description":"Get the public address that signs Layel Scope receipts, with the receipt schema, verification steps and a sample signed receipt. Free.","security":[],"responses":{"200":{"description":"Proof document","content":{"application/json":{"schema":{"type":"object"}}}}}}}}}