Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API 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.
openapi: 3.2.0
info:
title: TRDEFI Liquidity Badges 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: Badges
description: shields.io endpoint payloads for repository READMEs.
paths:
/api/badge:
get:
tags:
- Badges
operationId: getBadge
summary: shields.io endpoint payload
description: Returns the shields.io `endpoint` schema so a repository README can show a live metric. Consumed as `https://img.shields.io/endpoint?url=`.
parameters:
- name: metric
in: query
schema:
type: string
enum:
- volume30
- volume7
- volume1
- strategies
- makers
- pairs
- chains
default: volume30
responses:
'200':
description: Badge payload
content:
application/json:
schema:
$ref: '#/components/schemas/Badge'
example:
schemaVersion: 1
label: 30-day volume
message: $205.72M
color: orange
cacheSeconds: 300
isError: false
security: []
components:
schemas:
Badge:
type: object
required:
- schemaVersion
- label
- message
properties:
schemaVersion:
type: integer
const: 1
label:
type: string
message:
type: string
color:
type: string
cacheSeconds:
type: integer
isError:
type: boolean
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