TRDEFI Demo API
Same-origin helpers that back the public testnet demo. Not general-purpose APIs.
Same-origin helpers that back the public testnet demo. Not general-purpose APIs.
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/trdefi-com:trdefi-com-demo-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: TRDEFI Liquidity Demo API
version: 1.2.0
summary: Read the live non-custodial liquidity catalogue, quote it, and prepare unsigned positions for your own wallet to sign.
description: 'Public, read-first API over the open liquidity catalogue that TRDEFI normalises, plus a **prepare-only write path** for integrators holding a key.
**Non-custodial, strictly.** The API never signs and never broadcasts. `POST /v1/positions` returns *unsigned* transactions that your own wallet signs from your own address. No endpoint accepts a private key or a signing grant.
**Contract.** Every response carries `X-Request-Id`. Every endpoint advertises `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` and `RateLimit-Policy`, on success and on failure. Every error is the same envelope: `{ error: { code, message, requestId, retryable, documentation } }`.
**Money.** Amounts are returned as USD numbers for read models. On-chain amounts are strings in base units with an explicit `decimals`.
**Fees.** Every newly created position carries a 0.05% protocol fee embedded in the signed order data. It is reported in the `fee` object of every prepared position and cannot be removed by the integrator or by us.
**Keys.** Reading needs no key. Preparing needs `Authorization: Bearer trd_live__`, held server-side only. Request one at https://yield.trdefi.com/docs/api#access.
**Stability.** See the deprecation policy at https://yield.trdefi.com/docs/api — path-versioned resources, a published calendar, and a minimum 90-day notice window.'
contact:
name: TRDEFI
url: https://trdefi.com
email: info@trdefi.com
license:
name: All rights reserved
url: https://trdefi.com
x-guidance: 'Start with GET /api/strategies (public, no key). Filter to what you can use,
then GET /api/quote?hash=...&chain=...&amount=... to price a swap against that
position on-chain. Read models return USD numbers; on-chain amounts are
strings in base units and always carry an explicit decimals field.
Writing is prepare-only and costs money. POST /v1/positions opens a maker
position; POST /v1/swaps prepares a taker swap against an existing one.
Both return UNSIGNED transactions for your own wallet to sign - the API never
signs, never broadcasts and never holds a key.
Paid routes answer 402 with the x402 terms when no credential is presented.
Pay with your own wallet and retry with the base64 payload in the
PAYMENT-SIGNATURE header (0.02 USD), or present an API key instead, which
costs nothing.
Before paying for a swap, call it: a strategy that is gated, or an amount the
maker cannot fill, returns a reason and NO transactions rather than a
transaction that is certain to revert.'
servers:
- url: https://yield.trdefi.com
description: Production
security: []
tags:
- name: demo
description: Same-origin helpers that back the public testnet demo. Not general-purpose APIs.
paths:
/api/pilot:
get:
tags:
- demo
operationId: getPilot
summary: Live state of the public testnet demo
description: The maker/taker/fee wallets, the shipped strategy and the swaps observed in a recent block window, on a **test network**. This exists so the public demo page can show a real end-to-end flow. It is **same-origin only** (Origin/Referer must be a TRDEFI page) and carries a tight rate limit. The fee-receiver address is deliberately not returned — only its balance. The same-origin check is a deterrent against casual reuse, not a security boundary.
responses:
'200':
description: Demo state
headers:
X-Request-Id:
$ref: '#/components/headers/RequestId'
RateLimit-Limit:
$ref: '#/components/headers/RateLimitLimit'
RateLimit-Remaining:
$ref: '#/components/headers/RateLimitRemaining'
RateLimit-Reset:
$ref: '#/components/headers/RateLimitReset'
content:
application/json:
schema:
type: object
additionalProperties: true
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
'503':
$ref: '#/components/responses/UpstreamUnavailable'
security: []
/api/balances:
get:
tags:
- demo
operationId: getBalances
summary: Demo wallet balances on a test network
description: Reads USDC / USDT / ETH balances for up to 10 addresses on a **test network**, so the demo page can show live wallet state. Not a general-purpose balance API. **Same-origin only** and rate limited.
parameters:
- name: addresses
in: query
required: true
schema:
type: string
description: Comma-separated EVM addresses, 1–10.
responses:
'200':
description: Balances
content:
application/json:
schema:
type: object
additionalProperties: true
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
security: []
components:
schemas:
Error:
type: object
required:
- error
- code
- requestId
- retryable
properties:
error:
type: string
description: Human-readable message. May change without notice.
code:
type: string
description: Stable, machine-mappable. Branch on this, never on the message.
example: RATE_LIMITED
requestId:
type: string
retryable:
type: boolean
description: True when the same request may be retried after a backoff.
documentation:
type: string
format: uri
description: A link to the definition of this code.
issues:
type: array
description: Structured, client-fixable problems (allowance, balance, chain).
items:
type: object
properties:
type:
type: string
example: INSUFFICIENT_ALLOWANCE
expected:
type: string
actual:
type: string
spender:
type: string
responses:
Forbidden:
description: Origin or scope not allowed — the endpoint is restricted to TRDEFI pages, or the key does not carry the `prepare` scope.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
RateLimited:
description: Rate limit exceeded. `Retry-After` is always present.
headers:
Retry-After:
schema:
type: integer
X-Request-Id:
$ref: '#/components/headers/RequestId'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
code: RATE_LIMITED
message: Rate limit exceeded for stats
requestId: …
retryable: true
documentation: https://yield.trdefi.com/docs/api/errors#rate_limited
UpstreamUnavailable:
description: Our data source is temporarily unavailable. Retry shortly.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
BadRequest:
description: Malformed or missing parameters
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
headers:
RequestId:
description: Unique id for this request. Quote it in support tickets.
schema:
type: string
example: <hex string, echoed per request>
RateLimitLimit:
description: Requests allowed in the current window for this bucket.
schema:
type: integer
example: 120
RateLimitRemaining:
description: Requests remaining in the current window.
schema:
type: integer
example: 119
RateLimitReset:
description: Seconds until the window resets.
schema:
type: integer
example: 42
securitySchemes:
x402:
type: apiKey
in: header
name: PAYMENT-SIGNATURE
description: 'Pay per request instead of holding a key: retry with the base64 x402 payment payload. `PAYMENT-SIGNATURE` is the x402 v2 header; the deprecated v1 `X-PAYMENT` is still accepted. With no credential at all, the prepare endpoints answer a **402** carrying the payment terms in the `PAYMENT-REQUIRED` header and a `bazaar` discovery extension. A settled call returns its receipt in the `PAYMENT-RESPONSE` header.'
bearerAuth:
type: http
scheme: bearer
bearerFormat: trd_live_<keyId>_<secret>
description: An API key issued after review. Held **server-side only** — a key in client-side code is treated as compromised. It can prepare unsigned transactions and read the positions it prepared. It can never sign, broadcast or move value. Request one at https://yield.trdefi.com/docs/api#access