> Agents can also search and read this documentation through its [MCP server](https://docs.yifi.io/~gitbook/mcp).

# Introduction

On-chain, off-chain, and private liquidity. Three liquidity rails, one API.

### About YiFi Swap <a href="#r12" id="r12"></a>

**YiFi Swap is an non-custodial multi-rail swap aggregator.**

Each request is routed across on-chain DEXs, off-chain CEX exchange partners, and dedicated private routes. Depending on the rail selected, you can prioritize by best pricing, execution time, or on-chain privacy.

### Why use YiFi Swap&#x20;

* **Multi-chain liquidity**: Tap into deep liquidity across EVM, Solana, Tron, Bitcoin and 150+ chains. See Supported chains.
* **Non-custodial throughout.** Funds stay in the user's wallet on DEX routes, or pass one-to-one through an exchange partner on CEX and private routes. YiFi never holds them.
* **Monetization built in.** Earn a revenue share on every attributed swap, with a configurable fee and attribution by API key or referral ID. See Fees and Partner Portal.
* **Distribution beyond the web**. The same rails run in web, mobile, and Telegram surfaces, not only in the browser.

### Who YiFi Swap is for

{% columns %}
{% column %}
**Designed For**

* Wallets, apps, and bots that want to embed swapping and bridging through one integration
* Partners who want to earn a revenue share on the swap flow they bring
* Products whose users value on-chain privacy
  {% endcolumn %}

{% column %}
**Not Intended For**

* Custody, accounts, or managed balances&#x20;
* Circumventing laws, sanctions, or platform restrictions
* Obfuscating the proceeds of crime or laundering funds
  {% endcolumn %}
  {% endcolumns %}

{% hint style="info" %}
YiFi does not operate its own exchange and does not hold user funds. It maintains no balances and is not a counterparty to any trade – every swap is executed by the underlying provider in the route.&#x20;
{% endhint %}


# How it works

Select, quote, confirm, track. The same simple flow across every rail.

## How it works

> Pick what you're swapping from and to. YiFi finds the best route and walks you through it.

### The basic flow

{% stepper %}
{% step %}

#### **Select a source and destination**

Any of supported 25,000+ tokens, on the same chain or across 100+ chains.
{% endstep %}

{% step %}

#### Review the quote

Rate, expected output, fees, and estimated time, compared across every connected provider.
{% endstep %}

{% step %}

#### **Confirm**

Sign with your wallet, or send to the deposit address shown, depending on the route.
{% endstep %}

{% step %}

#### Track it

Watch progress until the funds land at the destination.
{% endstep %}
{% endstepper %}

What happens after you confirm depends on which rail the quote uses.

### On-chain swaps (DEX)

For swaps and bridges that settle through DEXs, your funds stay in your own wallet until you sign.

1. Select your tokens and enter an amount.
2. Approve the token if it's your first time swapping it.
3. Review the live estimate: output, gas fees.
4. Sign the transaction in your wallet.&#x20;

{% hint style="info" %}
Same-chain swaps settle immediately; cross-chain routes may take a few minutes as they bridge.
{% endhint %}

### Off-chain swaps (CEX)

For the widest coverage and no gas, YiFi can route through a CEX exchange partner instead.

1. Select your tokens and enter an amount – no wallet connection required.
2. Review the quote and get a deposit address.
3. Send funds to that address from any wallet or exchange.
4. The provider completes the swap and sends the output to your destination address. Track status in the UI.

### Private swaps

For a route that's harder to link on-chain, use **Private** or **Stealth** modes. Same basic flow as above, with an extra hop in between – see [Private Swaps](https://docs.yifi.io/swap-types/private-swaps) for how the two options differ.

{% hint style="info" %}
Every floating quote is indicative. The final amount can shift with market movement, so always check the live estimate on the confirmation screen before you send or sign.
{% endhint %}

### Three rails comparison

| Parameter             | On-chain (DEX)        | Off-chain (CEX)       | Private               |
| --------------------- | --------------------- | --------------------- | --------------------- |
| **Custody**           | Non-custodial         | Custodial during swap | Custodial during swap |
| **Wallet connection** | Required              | Not required          | Not required          |
| **User pays gas**     | Yes                   | No                    | No                    |
| **Coverage**          | EVM, Solana, Tron     | 150+ (incl. non-EVM)  | 150+ (incl. non-EVM)  |
| **Privacy**           | On-chain, transparent | Provider's hot-wallet | Untraceable on-chain  |

### Key benefits

* **Route comparison.** Every quote is checked against all connected on-chain, off-chain, and private providers.
* **No wallet needed on some routes.** Off-chain and private routes work without connecting a wallet or holding gas.
* **Full quote transparency.** See expected output, time, and fees before you confirm – nothing hidden.
* **Cross-chain in one flow.** Swapping and bridging combine automatically when source and destination are on different chains.

{% hint style="success" icon="star" %}
YiFi Swap moves your capital between assets and chains. Once it's where you want it, you can put it to work in YiFi Earn – swapping and yield are two separate steps by design.
{% endhint %}

### Fees and pricing

* **Network (gas) fees** go to the blockchain, not to YiFi – only on on-chain routes.
* **Provider fees** vary by route and are set by the underlying provider.
* **YiFi service fee** applies across rails.

See [Fees](https://docs.yifi.io/economy-and-integration/fees) for the full breakdown.

### Attribution

To earn on the flow, every quote and order must be attributed to your partner account – by API key or a referral ID. See Partner Portal.


# Architecture Overview

How YiFi's routing engine connects on-chain, off-chain, and private liquidity behind one API.

## Architecture

> The routing engine that compares CEX, DEX, and private liquidity, then orchestrates execution through one API.

{% hint style="info" %}
This page describes the Swap routing engine. It lives in the Developer Hub alongside API Reference and is aimed at integrators, not end users – for the product-facing explanation, see How it works.&#x20;
{% endhint %}

### System architecture

YiFi sits between your application and every liquidity source it supports. It queries providers, ranks the results, and orchestrates execution through whichever one wins the route.

```mermaid
graph TB
    A[User] --> B[Your application]
    B --> C[YiFi Swap API]
    C --> D{Routing engine}
    D -->|On-chain route| E[DEX aggregators]
    D -->|Off-chain route| F[CEX exchange partners]
    D -->|Private route| G[Partner exchanges, two-leg]
    E --> H[Recipient wallet]
    F --> H
    G --> H
```

### Key components

#### 1. Your application

Integrates with YiFi through:

* **REST API** – direct HTTP calls for full control over quoting, order creation, and status tracking.
* **Widget** – an embeddable swap interface for a minimal-integration path.

See API Reference.

#### 2. Routing engine

The core YiFi Swap orchestration layer.

* Queries all connected providers across the three rails for a given request.
* Ranks routes by expected output, fees, and estimated time.
* Builds the transaction (on-chain) or deposit instruction (off-chain / private) for the selected route.
* Tracks order state through to settlement and exposes it via the status endpoint.

#### 3. On-chain DEX aggregation

Non-custodial execution through audited smart contracts; same-chain swaps are atomic, cross-chain routes are multi-step.

#### 4. Off-chain CEX exchange partners

One-to-one deposit-and-forward execution; no wallet connection or gas required from the user.

#### 5. Private routing

Two-leg execution through partner exchanges with an intermediate hop. See [Private Swaps](https://docs.yifi.io/swap-types/private-swaps).

#### 6. Recipient wallet&#x20;

Funds are sent to the address the user specifies – a standard receiving wallet address.

### Routing strategies

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><strong>DEX Routes</strong></td><td>Transparent, non-custodial, atomic on same chain</td><td></td></tr><tr><td><strong>CEX Routes</strong></td><td>No wallet or gas, widest coverage</td><td></td></tr><tr><td><strong>Private Routes</strong></td><td>Untraceable on-chain. No wallet connection required.</td><td></td></tr></tbody></table>

Each strategy can be requested independently through the API – see [API Reference](https://claude.ai/swap/api-reference.md) for the relevant endpoints.


# On-chain Swaps

Fully on-chain execution through audited smart contracts — fast, transparent, and non-custodial.

## On-chain Swaps

> Swap or bridge any supported token through audited routers – your funds never leave your control.

### What is an on-chain swap?

An on-chain swap is the most direct way to trade: execution happens entirely through smart contracts, and YiFi never takes possession of your funds at any point.

Rather than routing you to a single DEX, YiFi aggregates across on-chain route builders – [on-chain providers](https://docs.yifi.io/coverage/providers#providers) –  comparing routes across DEXs, bridges, and cross-chain aggregators to find the best available output for your pair and amount.

### **Core features**

* **Best available rate.** Routes are compared across every connected [on-chain builder](https://docs.yifi.io/coverage/providers#on-chain-providers) before you sign, rather than checking one DEX at a time.
* **Fully non-custodial.** Every swap is enforced by a smart contract and settles directly between your wallet and the liquidity source.
* **Fee transparency.** Network gas and provider fees are factored into the quoted output before you sign – no surprises after the fact.
* **EVM, Solana and multiple L1 coverage.** On-chain routing spans EVM networks, Solana and Layer 1 blockchains; see [Coverage](https://docs.yifi.io/coverage/chains-soon) for the live, queryable list.&#x20;

### How it works

{% stepper %}
{% step %}
**Request a quote**

Enter your source and destination tokens and an amount. YiFi queries connected on-chain route builders and returns the best available route.
{% endstep %}

{% step %}
**Approve, if needed**

First-time swaps of a given token may require a one-time token approval.
{% endstep %}

{% step %}
**Sign transaction calldata**

Confirm the transaction in your wallet. Same-chain swaps settle atomically; cross-chain routes execute as a multi-step bridge-and-swap sequence.
{% endstep %}

{% step %}
**Delivery**

The destination token arrives in your wallet on the target chain.
{% endstep %}
{% endstepper %}

### Who it's for

**Good fit for:**

* Traders who want the best available rate and lowest slippage
* Users who want the fastest path for a same-chain or cross-chain move
* Anyone who wants 100% on-chain, smart-contract-verifiable execution

**Not the best fit for:**

* Privacy-focused users – on-chain swaps are fully public and traceable (use [Private Swaps](https://docs.yifi.io/swap-types/private-swaps) instead)
* Users who'd rather not connect a wallet or sign a transaction (use the [off-chain rail](https://docs.yifi.io/swap-types/off-chain-swaps) instead)

### **On-chain Swaps –** Summary at a glance

* **Privacy:** Low – fully public and verifiable on-chain.
* **Speed:** Fast – typically seconds to a few minutes, depending on chain and route.
* **Custody:** Non-custodial throughout.
* **Best for:** Best-rate execution with full on-chain transparency.

### Integrating

On-chain routes are quoted and executed through the same lifecycle as the other rails (quote → order → status). See the private routing endpoints in the API Reference.


# Off-chain Swaps

Swap without connecting a wallet – send to a deposit address and let a partner exchange handle the rest.

## Off-chain Swaps

> No wallet connection, no gas, no contract approvals – just send to a deposit address.

### What is an off-chain swap?

An off-chain swap replaces the usual "connect wallet and sign" flow with a manual deposit: YiFi gives you a [off-chain provider's](https://docs.yifi.io/coverage/providers#off-chain-providers) one-time deposit address, you send your tokens there from any source, and a partner exchange handles the conversion and delivers the output to your destination address.

### **Core features**

* **No wallet connection or signing.** No "Approve" or "Sign" transaction – you never expose a wallet connection or a contract permission.
* **Widest coverage.** Because execution runs through exchange partners rather than on-chain liquidity, this rail reaches the broadest set of assets and chains, including non-EVM networks that on-chain routing can't serve.
* **Middle-ground privacy.** Breaks the direct on-chain contract link between your wallet and the destination – more private than an on-chain swap, though less than [Private Swaps](https://docs.yifi.io/swap-types/private-swaps).
* **One-to-one, non-custodial.** Your funds are briefly held by the exchange partner during the swap – never pooled, and never held by YiFi. See Core Concepts.

### How it works

{% stepper %}
{% step %}
**Initiate**

Choose your source and destination tokens and get a temporary deposit address.
{% endstep %}

{% step %}
**Deposit**

Send your tokens to that address from any wallet, exchange, or hardware device.
{% endstep %}

{% step %}
**Exchange**

Once received, the exchange partner converts your tokens to the destination asset.
{% endstep %}

{% step %}
**Delivery**

The output is sent directly to the recipient address you specified.
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
Send only the exact asset and amount the quote specifies, from a source you control, and within the quote's time window — deposits outside those parameters may not be processed correctly.
{% endhint %}

### Who it's for

**Good fit for:**

* Users who'd rather not connect a wallet or approve a contract
* Swaps from cold storage, hardware wallets, or exchange balances
* Cross-chain and non-EVM pairs that on-chain routing can't reach

**Not the best fit for:**

* Privacy-focused users who need more than a broken contract link – see [Private Swaps](https://docs.yifi.io/swap-types/private-swaps)
* Users who want fully on-chain, contract-verifiable execution – see [On-chain Swaps](https://docs.yifi.io/swap-types/on-chain-swaps)

### Off-chain Swaps – Summary at a glance

* **Privacy:** Moderate – breaks the direct on-chain link; no contract interaction.
* **Speed:** A few minutes, depending on the exchange partner and network confirmations.
* **Custody:** Non-custodial at the platform level – funds pass one-to-one through the exchange partner.
* **Best for:** No-wallet-connect swaps with the widest asset and chain coverage.

### Integrating

Off-chain routes are quoted and executed through the same lifecycle as the other rails (quote → order → status). See the private routing endpoints in the API Reference.


# Private Swaps

Swap Crypto Privately. No KYC. No Trace. A dedicated rail for reducing the on-chain link between where your funds start and where they land.

Private Swaps are a dedicated rail for users who want to reduce the on-chain linkability between their source and destination addresses.&#x20;

YiFi offers two separately branded routes. Both run as a **two-leg** flow through [off-chain](https://docs.yifi.io/swap-types/off-chain-swaps) partner exchanges with an intermediate hop.&#x20;

> Swap without linking your source and destination wallets.

### The two private modes

#### Private (XMR-hop)

Two-leg routing through partner exchanges with an intermediate hop in **Monero**. The XMR leg adds a cryptographic privacy layer between the incoming and outgoing legs.

```mermaid
graph LR
    A[Your wallet] -->|Leg 1: source asset| B[Partner exchange A]
    B -->|Converts internally to XMR| C[Monero network hop]
    C -.->|Sender, receiver, amount not visible on public ledger| D[Partner exchange B]
    D -->|Converts to destination asset| E[Destination wallet]
```

#### Stealth (stable-hop)

Two-leg routing through partner exchanges with an intermediate hop in a **stablecoin**. This trades the cryptographic XMR layer for price stability during the swap and remains transparent on-chain.

```mermaid
graph LR
    A[Your wallet] -->|Leg 1: source asset| B[Partner exchange A hot wallet]
    B -->|Random chain + stablecoin, chosen per swap| C{1 of ~20 chains<br/>1 of ~5 stablecoins}
    C --> D[Partner exchange B hot wallet]
    D -->|Converts to destination asset| E[Destination wallet]
```

### Private vs. Stealth

| Parameter                        | Private (XMR-hop)                                          | Stealth (stable-hop)                                                 |
| -------------------------------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
| Intermediate hop                 | Monero                                                     | Stablecoin                                                           |
| Privacy source                   | Cryptographic (stealth addresses, ring signatures, RingCT) | Probabilistic (randomized chain + coin)                              |
| Price exposure during hop        | XMR volatility                                             | Minimal (pegged)                                                     |
| On-chain transparency of the hop | Opaque                                                     | Transparent [(probabilistic barrier](#stable-hop-privacy-explained)) |
| Typical execution time           | Slightly longer. Up to 15 min                              | Faster. Avg 3 min                                                    |

### How privacy actually works

#### **XMR hop privacy explained**

The exchange happens between two partner exchanges, with Monero as the intermediate asset. Your source asset is converted into XMR at the first partner, moved across the Monero network, then converted from XMR into your destination asset at the second partner.

What makes this stronger than randomization alone is that the middle leg is **cryptographically opaque by protocol design**, not just hard to correlate.&#x20;

Monero combines three mechanisms on every transaction:&#x20;

1. **stealth addresses** (a unique one-time address is generated for each transfer, so the recipient's real address never appears on-chain),
2. **ring signatures** (the true sender is mixed in with a set of decoys, so no single sender can be identified),&#x20;
3. and **RingCT** (the transfer amount is encrypted, not published). Seeing any of that data requires the transaction's private view key — something the two exchange partners don't expose externally. So even if an observer held records from both partners at once, the Monero leg itself doesn't hand them the sender, receiver, or amount to line up.

#### **Stable hop privacy explained**

The exchange takes place between the hot wallets of two different exchange partners. Funds from the first leg settle into a partner's hot wallet (belonging to any of our off-chain providers), then move out on the second leg through one of roughly 20 supported chains, in one of 5 stablecoins – chosen at random for that swap.

The randomization is what does the work here, not any property of the stablecoin itself. Unlike the XMR leg, this hop is fully public – an observer can see both transfers on-chain. What breaks the link is that they can't predict, from watching the first leg, which specific combination of provider, chain, and stablecoin the second leg will use. As our network of off-chain integrations grows, this combinatorics pool expands, creating an even larger matrix of possibilities.

This is a probabilistic barrier, not a cryptographic one – a determined observer with enough correlating data (timing, amount patterns) has a better chance against this "Stable hop" than against the XMR hop.

{% hint style="info" %}
**Reduced linkability, not anonymity.** Both modes make it materially harder to connect a source and destination wallet – they are not an anonymity guarantee. Each leg is a one-to-one swap through a partner exchange, under that partner's own terms. See [Privacy & Compliance](https://claude.ai/chat/privacy-and-compliance.md).&#x20;
{% endhint %}

### **Private Swaps – Summary at a glance**

* **Privacy:** High on the XMR hop (cryptographic), Moderate on the Stealth hop (probabilistic) – reduced linkability, not anonymity.
* **Speed:** Moderate – two-leg execution, XMR hop typically takes 5-20 min, while Stealth only 2-5 min.
* **Custody:** Non-custodial at the platform level – funds pass one-to-one through partner exchanges on each leg.
* **Best for:** Breaking the on-chain link between source and destination when privacy matters more than speed.

### Integrating

Private routes are quoted and executed through the same lifecycle as the other rails (quote → order → status), with an additional query parameter on the quote request selecting the mode and intermediate coin. See the private routing endpoints in the [API Reference](https://claude.ai/chat/api-reference.md).


# Floating vs Fixed (soon)


# Chains (soon)


# Providers

The three rails YiFi Swap routes across, and the providers behind each.

### On-chain (DEX aggregation)

* **Cross-chain routes** are multi-step and **not** atomic; they combine bridging and swapping across networks.
* **MEV and front-running protection** is available on this rail (for example via CoW Swap), which matters for larger trades.
* **Token approvals** are resolved per route, including intermediate contracts used by some aggregators and explicit allowance-spender handling where required.

#### On-chain providers

* **LI.FI**
* **Rango Exchange**

### Off-chain (CEX aggregation)

* **Widest coverage.** The broadest range of assets and chains, including non-EVM networks.
* **No wallet connection, no gas** required from the user, which lowers the barrier for embedded and non-DeFi surfaces.

#### Off-chain providers

* **Quickex**
* **ChangeNow**
* **SwapGate**
* **SimpleSwap**
* **Changelly**
* **ChangeHero**
* **FixedFloat**

{% hint style="info" %}
Because off-chain routes involve a third-party exchanger, that provider may run its own KYC and impose its own limits. See [KYC Labels](#r6s).
{% endhint %}

### Private

Two Off-chain providers are used – one per exchange leg.

* **Private (XMR-hop)** – an intermediate hop in Monero.
* **Stealth (stable-hop)** – a stablecoin hop, removing volatility.

See [Private Swaps](https://docs.yifi.io/swap-types/private-swaps) to learn more of how it work under the hood.

### KYC Labels <a href="#r6s" id="r6s"></a>

Some routes, particularly off-chain (CEX), pass through providers that may run their own identity verification. To help users choose, the interface can display a KYC Label indicating the verification regime a given provider applies on its own side.

#### What a KYC Label is <a href="#r6u" id="r6u"></a>

* An informational indicator of the identity-verification regime a provider is expected to apply.
* Attached per provider, so users can weigh a route before selecting it.

and what KYC label is not:

* **It is not a guarantee.** A provider can change its process, request documents, or apply verification at its own discretion.
* **It is not YiFi performing KYC.** YiFi Swap does not itself run identity verification or collect KYC data from users.
* **It is not advice** or an endorsement of any provider.

#### Where KYC happens <a href="#r76" id="r76"></a>

When a user transacts through an off-chain provider, the relationship is directly with that provider under its own terms. That provider, not YiFi, may perform KYC: request documents, impose limits, and freeze, delay, reject, or reverse a transaction.

On-chain (DEX) routes are non-custodial and generally do not involve provider-side KYC, though users remain responsible for their own legal and regulatory compliance.

{% hint style="info" %}
**KYC Labels are indicative only**. Always direct users to the selected provider's own terms for the authoritative verification requirements. YiFi's overall compliance approach is described in the [AML/KYC Compliance](https://app.notion.com/legal/aml-kyc-compliance.md) policy.
{% endhint %}

### Provider risk

Routing across third-party providers carries risks the integrator should surface to users:

* **Smart-contract / router risk** on the on-chain rail – third-party routers can contain bugs or be exploited.
* **Off-chain provider risk** – an exchanger may require KYC and can freeze, delay, or reject a transaction under its own terms.
* **Execution risk** – quotes are indicative and the final outcome depends on slippage, route availability, and network or bridge conditions.


# Partners Portal

Earn commissions by integrating YiFi Swap or referring users, and manage your payouts from a single dashboard.

## Partners Portal

The Partners Portal is your dashboard for earning and withdrawing commissions from YiFi Swap. Whether you embed our API in your own product or share a referral link, every attributed swap earns you a share of the trading fee.

{% hint style="info" %}
For the exact fee split and how commissions are calculated, see the [Fees](https://docs.yifi.io/economy-and-integration/fees) page. This page focuses on how to access and use the Partners Portal.&#x20;
{% endhint %}

### Who it is for

The portal supports **two account types**, chosen at registration:

<table data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>👤 Individual</strong></td><td>Creators, KOLs, community members. </td><td><ul><li>1 APY Key</li><li>No team members.</li><li>Monetization only through referral links</li></ul></td></tr><tr><td><strong>🏛️ Company</strong></td><td>Integrators, wallets, dApps, exchanges. </td><td><ul><li>up to 3 API Keys</li><li>May invite team members</li><li>Monetize through API keys  and referral links</li></ul></td></tr></tbody></table>

An Individual account works with the affiliate program only.&#x20;

A Company account additionally unlocks company details, team management, and API keys for programmatic swap attribution.

### Two ways to monetize

#### 1. API integration (Partner)

Embed YiFi Swap in your product and pass your [API key](https://docs.yifi.io/api-reference/base-url) with every swap request. Swaps created through your key are attributed to your account, and you earn a share of the fee on each one.

This path is available to **Company** accounts.

#### 2. Referral links (Affiliate)

Share a referral link. When a user swaps after arriving through your link, you earn a share of the fee on their swaps.

This path is available to **both** account types.

{% hint style="warning" %}
A single swap earns through one attribution channel only. If a swap carries both an API key and a referral code from the **same** account, the referral commission is skipped. Attribution never stacks on itself.
{% endhint %}

### Getting started

{% stepper %}
{% step %}

### Create an account

Register with your email and choose **Individual** or **Company**. If someone referred you, enter their referral code during sign-up.
{% endstep %}

{% step %}

### Verify your email

We send a six-digit code to your email address. Enter it to activate your account.&#x20;
{% endstep %}

{% step %}

### Add a payout wallet

Add at least one wallet address to your whitelist. Payouts are only ever sent to whitelisted addresses. Supported chains: EVM, Bitcoin, Solana, Tron.
{% endstep %}

{% step %}

### Start earning

Create an API key (Company) or a Referral link (both types), and integrate or share it.&#x20;
{% endstep %}
{% endstepper %}

### Portal sections

#### Personal

Manage your name, Telegram handle, email, and password. Email and password changes are confirmed with a code sent to your current email address.

{% hint style="danger" %}
Changing your email locks withdrawals for 24 hours as an anti-fraud measure.
{% endhint %}

#### Company

Available to Company accounts. Edit company details (name, website, category, country), manage your team, and maintain company payout wallets.

Team members are invited by email. Roles determine permissions: an **owner** can edit company data, manage the team, and manage wallets, while a **member** has read access to the relevant sections.

#### API Keys

<figure><img src="https://3921316857-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvZFrAn3SYQFXqu06JybP%2Fuploads%2F6319DTbpr4t9yTNkavxB%2Fapi-keys.png?alt=media&amp;token=e3e08c68-89f4-4874-ac15-94e0e30531e2" alt=""><figcaption></figcaption></figure>

Available to Company accounts. Create up to five keys, label them, and enable or disable them individually.

Pass your key in the request header when creating a swap:

```http
x-api-key-partner: <your-api-key>
```

{% hint style="danger" %}
The full API key is shown **once**, at the moment you create it. Store it securely. If you lose it, you must generate a new key. The portal only ever displays a short prefix afterwards, so you can tell your keys apart.&#x20;
{% endhint %}

#### Affiliate

<figure><img src="https://3921316857-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvZFrAn3SYQFXqu06JybP%2Fuploads%2FMHBMWqGNfRdqJjlbHDUv%2Faffiliate-codes-and-links.png?alt=media&amp;token=c746c382-8518-4117-8473-c456314a3944" alt=""><figcaption></figcaption></figure>

Create referral links, each with its own label and unique code, and track performance per link: clicks, sign-ups, conversions, and earnings.

A referral link looks like this:

```
https://yifi.io/?ref=<your-code>
```

You can create multiple links to attribute different campaigns or channels separately.

#### History

<figure><img src="https://3921316857-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvZFrAn3SYQFXqu06JybP%2Fuploads%2FU40RmAgRoNmJli7Oh7VS%2Forders-history.png?alt=media&amp;token=6f89c1f7-916c-4d3d-8dce-45e46a91a171" alt=""><figcaption></figcaption></figure>

A unified list of every swap attributed to your account, from both API keys and referral links. Filter by status, source, provider, date range, or search term, and export the results to CSV.

Each record shows the provider, source, tokens and amounts sent and received, USD volume, transaction hashes, commission, and status.

#### Withdrawal

<figure><img src="https://3921316857-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvZFrAn3SYQFXqu06JybP%2Fuploads%2Fchfd16GmvgHbKUEW57G4%2Fbalance-fees-breakdown.png?alt=media&amp;token=4a6c9b99-d588-42aa-ac44-5de7012ab84a" alt=""><figcaption></figcaption></figure>

Review your balance, broken down by coin, and request payouts.

Withdrawals are reviewed and settled manually. A request moves through these states:

| Status         | Meaning                                             |
| -------------- | --------------------------------------------------- |
| **Pending**    | Request received, awaiting review                   |
| **Processing** | Payout is being sent on-chain                       |
| **Completed**  | Funds sent; a transaction hash is attached          |
| **Failed**     | Request could not be completed; a note explains why |

{% hint style="info" %}
Part of your commission may be paid in the original swap token rather than a stablecoin. Token prices fluctuate and can affect your total USD balance, so we recommend withdrawing regularly to limit exposure.
{% endhint %}

#### Withdrawal requirements

Before a withdrawal request is accepted, all of the following must be true:

* Your withdrawable balance is above $50 equivalent.
* Your email has not been changed in the last 24 hours.
* The destination wallet was added more than 24 hours ago.
* You have no other pending withdrawal.

These conditions protect your funds against unauthorized access.

### FAQ

<details>

<summary><strong>Can I be both a Partner and an Affiliate?</strong> </summary>

Yes. A Company account can hold API keys and referral links at the same time. Each swap is attributed to a single channel, and a swap is never credited twice to the same account.

</details>

<details>

<summary><strong>How is my commission calculated?</strong></summary>

Commission is a share of YiFi's trading fee, calculated on swap volume and normalized to USDT. See [Fees](https://docs.yifi.io/economy-and-integration/fees) for the exact figures.

</details>

<details>

<summary><strong>Which networks can I receive payouts on?</strong></summary>

Whitelisted wallets support EVM, Bitcoin, Solana, and Tron. When requesting a withdrawal you choose the receive coin and network.

</details>

<details>

<summary><strong>Why was my referral code rejected at sign-up?</strong> </summary>

The code did not match an existing referral link. Check for typos, or ask your referrer to confirm the code.

</details>

&#x20;


# Fees

How YiFi Swap fees are composed

### Type of fees

A swap can involve up to three cost components, depending on the rail:

| Component             | Set by                   | Rate            |
| --------------------- | ------------------------ | --------------- |
| **Network (gas) fee** | The blockchain network   | Current gas fee |
| **Provider fee**      | The third-party provider | 0.2% to 0.5%    |
| **YiFi service fee**  | Configured per partner   | 0% to 0.4%      |

Network fees are paid to the blockchain, not to YiFi or route provider. Provider spreads, bridge fees, and external aggregator fees are set by third parties and are outside YiFi's control. The YiFi service fee is the configurable partner-facing fee described below.

### What the partner earns

* **Revenue share.** Partners receive a **50% revenue share** on every swap attributed to them.
* **Configurable fee.** The partner-facing fee is configurable up to **0.2% (20 bps)** in absolute terms.
* **Attribution.** The share is routed to the partner that the swap is attributed to – by **referral ID** or **API key**. Without attribution, no partner share accrues.

The service fee splits between YiFi and the attributed partner according to the configured share. Partner balances, history, and withdrawals are managed in the Partner Portal.

{% hint style="info" %}
Exact fee configuration and revenue-share terms are set during partner onboarding. See the Partner Portal for managing your fee and attribution settings.
{% endhint %}


# YiFi Swap Terms of Use

YiFi Swap is a non-custodial software interface that aggregates and compares quotes for swapping and bridging digital assets

*This summary is provided for your convenience only. It is not legally binding, is not a substitute for the full Swap Terms below, and does not modify them. If there is any difference between this summary and the full Terms, the full Terms govern.*

**What YiFi Swap is.** YiFi Swap is a non-custodial software interface that aggregates and compares quotes for swapping and bridging digital assets across independent third-party providers. It routes through **on-chain providers** that use their own smart-contract routers (for example LI.FI and Rango) and through **off-chain providers or exchangers**. It is infrastructure: it helps you find a route and build a transaction, which **you** then sign from **your own** wallet, or which you complete with the relevant off-chain provider directly.

**What YiFi Swap is&#x20;*****not*****.**

* It is **not** a bank, exchange, money-services business, broker or custodian.
* It does **not** take custody of your assets. We never hold your funds, private keys or seed phrase, and we cannot move your assets.
* It does **not** offer yield, returns or any investment product – there is no APY, no strategy and no investment component. It is a routing and information tool.
* It does **not** itself perform KYC or identity verification. Some off-chain providers **do** run their own KYC on their side. To help you, the interface labels the indicative KYC level of each provider, but those labels are informational only.
* We do **not** create, control, audit or operate the on-chain routers or the off-chain providers we route to.

**Key risks you accept.**

* **Smart-contract / router risk.** On-chain routers are built and run by third parties. They can contain bugs, can be exploited or hacked, and can fail. You can lose your funds, and we are not liable for that.
* **Off-chain provider risk.** When you transact with an off-chain provider, your relationship is with that provider under its own terms; it may require KYC, may freeze, delay or reject a transaction, and we are not responsible for its conduct.
* **Execution risk.** Quotes are indicative; the actual outcome may differ due to slippage, price movement, failed routes, network conditions, or bridge delays or failures.
* **Eligibility risk.** The Service is not available in Restricted Jurisdictions, and individual providers may impose their own additional restrictions and KYC that you must check and comply with yourself.
* **Irreversibility.** Blockchain transactions are generally irreversible.

**Your responsibility.** You verify each route and quote before signing, you keep your wallet secure, you comply with the terms of any provider you use, and you remain responsible for your own legal, tax and regulatory compliance.

### Terms of Use

These Terms of Use and any terms incorporated herein (the “**Terms**” or “**Swap Terms**“) apply to your (“**user**“, “**you**“) use of the **YiFi Swap** service available at <https://yifi.io/swap>, including the technology and integrated platform therein, as well as any related applications (including, without limitation, mobile applications) (the “**Swap Service**“), which are operated and maintained by yifi.io (“**Yifi.io**“, “**We**” or “**Us**“). We provide you with the opportunity to use the Swap Service subject to these Terms.

* Yifi.io is owned by Exchangeify Corp., registration number 155777159, registered address: 55 Building, 21st Floor, Office 3, Panama City, Republic of Panama.
* Certain services may be provided by our other operating companies or by the operating companies of our partners.

### 1. Acceptance, Enforcement and Amendments

1.1. These Swap Terms constitute a binding agreement between Yifi.io and you from the moment you access the Swap Service. By accessing or using the Swap Service, you confirm that you have fully read, understood and accepted these Swap Terms prior to use, and that you meet the eligibility requirements in Section 7.

1.2. You agree that these Swap Terms may be updated, supplemented or modified from time to time at the sole discretion of Yifi.io. If you do not read and fully accept these Swap Terms, you must not use or continue using the Swap Service. Your continued use after changes take effect constitutes acceptance of the amended Terms.

### 2. Key Definitions

Unless the context requires otherwise, the following words and expressions shall have the meanings assigned to them below:

“**Platform**“, “**Platform Services**” means the websites, applications, services, interfaces or tools of Yifi.io through which the Swap Service is made available.

“**Platform Website**” means the website located at <https://yifi.io/>, where the Yifi.io interface is hosted or available.

“**Website Administration**” means the authorized employees managing the Website on behalf of Yifi.io.

“**Swap Service**” means the YiFi Swap interface and related functionality that aggregates and compares swap/bridge quotes and assists Users in selecting a route and constructing or initiating a transaction.

“**User**” means any person using the Swap Service.

“**Digital Assets**” means a digital representation of value (including “cryptocurrency”, “virtual currency”, “digital currency”, “crypto-token”, “token”, “crypto-asset” or “digital commodity”), such as Bitcoin or Ether, based on a cryptographic protocol of a computer network, which may be centralized or decentralized, open-source or closed-source, and used as a medium of exchange and/or store of value.

“**On-Chain Provider**” means a third-party protocol, aggregator or router that executes swaps or bridges on-chain through its own smart contracts, developed, deployed, controlled and operated by parties other than Yifi.io.

“**Off-Chain Provider**” means a third-party exchanger or service that processes swaps or transfers off-chain or through its own systems, which may operate its own compliance procedures.

“**Provider**” means an On-Chain Provider or an Off-Chain Provider.

“**Router Contract**” means the smart-contract infrastructure used by an On-Chain Provider to route and execute transactions.

“**KYC Label**” means an informational indicator displayed in the interface intended to reflect the indicative identity-verification regime applied by a given Provider on its own side.

“**Restricted Jurisdiction**” and “**Restricted Person**” have the meanings given in Section 7.

### 3. Description of the Swap Service

3.1. The Swap Service is a decentralized software interface (dApp) that provides Users with a tool to search for, compare and select available options for swapping and bridging digital assets offered by third-party Providers. The Swap Service is an **informational and technical aggregation and routing tool** of an infrastructural nature. It is not a financial institution, bank, exchange, money-services business, broker or financial service provider, and it does not provide financial, investment, legal or tax advice or any offer. All information presented (including, without limitation, exchange rates and quotes) is for informational purposes only, is generated automatically based on data from public sources, and shall not be construed as advice or an offer.

3.2. Through the Swap interface, the Swap Service:

* aggregates and displays quote and rate information obtained from third-party Providers;
* provides automated route-comparison and transaction-routing logic;
* enables the technical construction and submission, signed by the User, of transactions to the Router Contracts of selected On-Chain Providers; and
* where applicable, directs the User to, or facilitates initiation of, a transaction with a selected Off-Chain Provider under that provider’s own process.

3.3. All swap and bridge operations are executed **exclusively by third-party Providers and their smart contracts or systems**. The Swap Service does not take custody of assets, does not participate in settlement, does not manage or provide liquidity, and does not set or influence the final execution price. The Swap Service offers no yield and no investment product.

3.4. You acknowledge that swap and bridge results depend on factors outside Yifi.io’s control, including market conditions, slippage, route availability, network characteristics, bridge timing and finality, and potential vulnerabilities or failures of third-party Router Contracts or Provider systems.

### 4. Nature of the Swap Service – Infrastructure and Routing Only

4.1. The Swap Service is **non-custodial** and **infrastructural** in character. Quotes, rates, route rankings and KYC Labels displayed in the interface are **informational only**, are generated automatically from external sources, are indicative, may change, and do **not** constitute advice, a recommendation, an endorsement, a solicitation or an offer.

4.2. Yifi.io is **not your broker, intermediary, agent, custodian or counterparty** to any swap or bridge. By selecting a route, you enter directly and at your own risk into a relationship with the relevant Provider; Yifi.io is not a party to that relationship.

### 5. Non-Custodial Status and User Control

The Swap Service is strictly non-custodial. This means:

* We never request, receive, or store private keys, seed phrases, passwords or any other wallet-access credentials.
* We have no access to your Digital Assets and cannot initiate, sign or broadcast any on-chain transaction without your explicit electronic signature (confirmation).
* For on-chain routes, all transactions are initiated, signed and broadcast to the blockchain exclusively by your own wallet software.
* For off-chain routes, your assets are handled by the relevant Off-Chain Provider under its own terms; Yifi.io does not take custody of them at any point.
* You bear full and exclusive responsibility for the security of your wallet, devices and credentials, and for verifying transaction and route details before signing or proceeding.

### 6. Relationship with On-Chain Providers, Router Contracts and Off-Chain Providers

6.1. The Swap Service acts as an independent interface and technological layer that facilitates your interaction with autonomous protocols and routers developed, deployed, controlled and operated by third parties, including decentralized exchanges (DEXs), bridges, liquidity aggregators and off-chain exchangers. We are not a party to, and assume no responsibility for, the relationship between you and any Provider.

6.2. **On-chain routers – “as is”, not audited.** The Swap Service routes transactions through Router Contracts operated by On-Chain Providers. You acknowledge and agree that:

* such Router Contracts are **developed, deployed and controlled by third parties** and are **not created, controlled or audited by Yifi.io**;
* the Swap Service is provided on an “**as is**” and “**as available**” basis with respect to these contracts; and
* **Yifi.io is not responsible or liable for any bug, defect, error, exploit, hack, vulnerability, malfunction, failure or other incorrect behaviour** of any Router Contract or related on-chain infrastructure, including any resulting loss of your assets.

6.3. **Off-chain providers – separate relationship and their own KYC.** Where you transact through an Off-Chain Provider:

* your relationship is **directly with that provider under its own terms of service and policies**;
* that provider may, on its own side and under its own rules, perform KYC verification, request documents, impose limits, and freeze, delay, reject or reverse a transaction; and
* Yifi.io does not control, and is not responsible or liable for, the conduct, custody, solvency, processing, compliance decisions or KYC of any Off-Chain Provider.

6.4. **KYC Labels.** The interface may display KYC Labels indicating the indicative verification regime of Off-Chain Provider. KYC Labels are provided as a convenience and for information only; they are based on external information, may be inaccurate or out of date, and do not constitute a representation, warranty or guarantee by Yifi.io as to the Provider’s actual practices or compliance status. The applicable requirements are always those set by the relevant Provider.

6.5. You acknowledge and agree that:

* all transactions initiated through the Swap interface are executed by third-party Providers and their smart contracts or systems;
* the Swap Service does not control or guarantee liquidity, uninterrupted operation, solvency or financial stability of any Provider;
* the Swap Service is not responsible for the functionality, security, economic logic or legality of any third-party smart contract or system;
* the Swap Service does not guarantee the accuracy, completeness or timeliness of displayed data (including quotes, rates and KYC Labels) sourced from external Providers and data providers; and
* the Swap Service is not responsible for the acts or omissions of administrators, developers or operators of third-party Providers.

By interacting through the Swap interface, you directly and at your own risk enter into relationships with third-party Providers. The Swap Service is not a party to such relationships and bears no responsibility for their consequences.

6.6. **Provider terms and restrictions.** Each Provider sets its own terms, eligibility criteria, KYC and geographic and other restrictions, which may differ from and be broader than those of Yifi.io and may change without notice. We do not reproduce or maintain those terms inside these Swap Terms. Where reasonably practicable, a link to the relevant Provider’s terms is made accessible in the interface. **You are solely responsible for reviewing and complying with the terms of any Provider before transacting**, and you accept the consequences of any non-compliance, which are governed by that Provider’s terms.

### 7. Eligibility, Representations and Restricted Jurisdictions

7.1. To use the Swap Service you must connect a compatible cryptocurrency wallet that is under your exclusive control (for on-chain routes) and have full legal capacity to enter into these Terms.

7.2. By accessing and using the Swap Service, you represent and warrant that you are not located in, and are not a citizen or resident of, the United States of America, any country subject to sanctions imposed by the United Nations, the U.S. Office of Foreign Assets Control (OFAC), or the European Union, or any Restricted Jurisdiction defined in Clause 7.3 of these terms.

7.3. **Consolidated Restricted Jurisdictions.** The Swap Service is not offered to, and may not be used by, persons connected with the following categories (each a “**Restricted Jurisdiction**” or, for list-based designations, a “**Restricted Person**“). This consolidated list is intended to cover the principal restrictions applied across the underlying Providers; it is reviewed and may be updated from time to time:

* **Comprehensively Sanctioned Territories** – countries and territories subject to comprehensive sanctions or embargoes, including, without limitation, Cuba, Iran, North Korea (DPRK), Syria, the Crimea, Donetsk, Luhansk, Zaporizhzhia and Kherson regions of Ukraine.
* **Crypto-Prohibited Jurisdictions** – countries in which dealing in, or the circulation of, cryptocurrency or digital assets is directly prohibited under applicable law, including, without limitation, the People’s Republic of China and Algeria (and other such jurisdictions as may apply from time to time).
* **Sanctioned Persons (list-based)** – any person, entity or wallet that appears on, is owned or controlled by, or acts on behalf of a person on, any applicable sanctions list, including, without limitation, the OFAC Specially Designated Nationals and Blocked Persons (SDN) List, and equivalent UN, EU or UK lists. Yifi.io reserves the right to restrict or refuse access where such a person is identified.

7.4. Yifi.io does not operate in, and does not target, Restricted Jurisdictions, and reserves the right to determine the markets and jurisdictions in which it makes the Swap Service available, and to restrict or refuse access at any time. You are responsible for ensuring that your use of the Swap Service is lawful in your jurisdiction; technical accessibility of the interface is not a representation that such use is lawful. Selected Providers may apply further or different restrictions on their side, governed by their own terms.

7.5. You further represent, agree and warrant that you will not violate any laws, agreements, third-party rights, or commit any tortious acts when accessing or using the Swap Service, and that you bear sole responsibility for your actions and/or omissions in connection with your use of the Swap Service. Without limiting the foregoing, you represent, agree and warrant that:

* you have full legal capacity to enter into contracts under applicable law;
* you are not located in, under the control of, or a citizen or resident of any Restricted Jurisdiction, and you are not a Restricted Person;
* you have not previously been suspended or prohibited from using the Swap Service;
* the use of the Swap Service is not prohibited in your country;
* you do not use the Swap Service for fraudulent, deceptive, or any other unlawful purposes, including but not limited to money laundering, terrorist financing, sanctions evasion, illegal gambling or other illegal activities;
* you use only crypto assets obtained from lawful sources when using the Swap Service;
* you do not provide false, inaccurate or misleading information;
* you do not engage in any actions intended to cause harm to Yifi.io or to other users or service providers;
* you comply with these Terms and all applicable laws;
* you use the Swap Service solely for personal purposes and do not act on behalf of third parties;
* you acknowledge that Yifi.io is not your broker, intermediary, agent, advisor, or fiduciary, and that no information provided by Yifi.io constitutes advice;
* you do not attempt to modify, decompile, reverse engineer or otherwise disassemble the software, the Website or the Swap Service;
* you do not use robots, spiders, crawlers, scrapers or other automated means to access the Swap Service, unless such tools are provided by Yifi.io;
* you do not circumvent content-filtering mechanisms or attempt to access any sections or features to which you do not have authorized access;
* you do not develop third-party applications that interact with the Swap Service without our prior written consent;
* you do not frame, wrap or otherwise enclose Yifi.io’s trademarks, logos or other content;
* you do not copy, reproduce, distribute or otherwise use Yifi.io’s content except as expressly permitted under these Terms;
* you do not remove or alter copyright notices or other proprietary markings;
* you consent to receive all communications, documents, notices and disclosures related to your use of the Swap Service in electronic form;
* you understand and accept that delays in the provision of the Swap Service may occur;
* you do not use proxies, VPNs or other software to conceal your IP address; and
* you do not encourage or induce third parties to engage in any conduct prohibited by these Terms.

### 8. Right to Restrict Access and Enforcement

8.1. Yifi.io reserves the right, at its sole discretion and without prior notice or disclosure of reasons, to restrict, suspend, condition or terminate any User’s access to all or part of the Swap Service, including where Yifi.io reasonably believes that a User is a Restricted Person, is connected with a Restricted Jurisdiction, has breached these Terms or applicable law, or presents a legal, regulatory, security or reputational risk.

8.2. For these purposes, Yifi.io may operate access-control and blocklisting measures, including blocking or restricting by **wallet address, account/login identifier, and User-Agent or device/browser characteristics**, and may, as an additional protective layer, implement IP-based restrictions.

8.3. We aim to protect our users from fraudulent and scam activities in the crypto space. It is possible that certain crypto assets are intended for unlawful seizure, or are deemed fraud, scam, or any other activity recognized by law as illegal and/or non-compliant with applicable regulations. We reserve the right, at our sole discretion, to prohibit and terminate any access or functionality involving such crypto assets through the Swap Service without prior notice and without disclosing the reason once it becomes known to us. YOU RELEASE Yifi.io FROM ANY CLAIMS, DEMANDS, AND DAMAGES, WHETHER DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL, OR OF ANY OTHER KIND, INCLUDING, WITHOUT LIMITATION, LOSS OR FORFEITURE OF PROFITS, ARISING FROM ANY ACTIONS TAKEN UNDER THIS SECTION OR OTHERWISE ARISING OUT OF OR RELATED TO THE PROHIBITION OR TERMINATION OF ANY ACCESS OR FUNCTIONALITY INVOLVING ANY CRYPTO ASSET.

8.4. Yifi.io may refuse service without providing any explanation or disclosure of reasons. Any restriction under this Section does not give rise to any liability of Yifi.io, and you release Yifi.io from any claim arising out of or relating to any such restriction, suspension or termination.

### 9. Compliance and AML

9.1. The Swap Service is non-custodial and does not itself collect personal data for the purpose of identity verification. **Yifi.io does not perform KYC verification of Users** for the Swap Service, does not take custody of assets, and does not execute transactions on Users’ behalf; accordingly, it does not assume independent verification obligations in respect of the Swap Service.

9.2. KYC verification and other compliance checks may be performed by third-party Providers – in particular Off-Chain Providers – on their own side, at their discretion and under their own rules. Such checks are outside Yifi.io’s control.

9.3. Yifi.io’s compliance approach, the categories of Restricted Jurisdictions, the role of third-party Provider KYC, and the allocation of verification responsibilities are described in greater detail in the separate [Yifi.io AML Compliance Policy](https://docs.yifi.io/legal-swap/aml-compliance-policy). You agree to use only assets derived from lawful sources and not to use the Swap Service for money laundering, terrorist financing, sanctions evasion or any other unlawful purpose.

### 10. Fees and Taxes

10.1. You agree to pay all applicable fees for use of the Swap Service, as displayed in the Swap Service’s interface.

10.2. All applicable fees charged by Yifi.io are displayed to you in the interface prior to signing and submitting the transaction, or prior to proceeding with a Provider.

10.3. You acknowledge that additional fees may apply when interacting with third-party Providers, including but not limited to provider/exchanger spreads and fees, bridge fees and fees charged by external aggregators. Such fees are set by third parties and are not controlled by Yifi.io.

10.4. To execute transactions on blockchain networks, you pay network fees (gas fees), the amount of which is determined by the relevant blockchain network and does not depend on the Swap Service.

10.5. The Swap Service does not charge hidden or undisclosed fees. All applicable charges by Yifi.io are displayed prior to confirmation. Yifi.io reserves the right to change the structure and amount of its service fees; current information is always available in the interface.

10.6. You are solely responsible for determining which taxes, if any, apply to the payments you make or receive, and for collecting, reporting and remitting such taxes to the appropriate tax authority. You agree that Yifi.io is not responsible for determining whether any taxes apply to your use of the Swap Service, or for collecting, reporting or remitting any taxes arising from any transaction or use of the Swap Service. You acknowledge that we, as required by applicable law, may provide you with additional documents or records necessary for calculating your tax obligations.

### 11. Third-Party Content and Services

11.1. For the purposes of these Terms, “**Third-Party Content**” means content provided by third parties, including, without limitation, links to such parties’ web pages, which may be presented through the Swap Service. “**Third-Party Service**” means any platform or network in which crypto assets are owned by you or you are the beneficial owner, and which is operated or maintained by a third party outside of the Swap Service.

11.2. You may be charged by a third-party service provider. Yifi.io is not responsible for payment of any third-party services. You bear sole responsibility for the use of third-party services and agree to comply with all terms applicable to any such third-party services.

11.3. YOU RELEASE Yifi.io FROM ANY AND ALL DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL OR ANY OTHER DAMAGES OF ANY KIND, INCLUDING, WITHOUT LIMITATION, LOSS OF USE, LOSS OF PROFITS, LOSS OF DATA OR ASSETS, WHETHER ARISING UNDER CONTRACT, TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE, ARISING OUT OF OR IN ANY WAY RELATED TO THE INVALIDITY OR BREACH OF ANY PROVISION OF THIS SECTION.

11.4. When using the Swap Service, you may access Third-Party Content. We do not control, endorse or accept responsibility for any Third-Party Content (unless explicitly stated otherwise by us), including, without limitation, content that may be misleading, incomplete, inaccurate, offensive, obscene or otherwise objectionable. Any business dealings or correspondence with such third parties are conducted solely between you and the third parties. We are not responsible for any loss or damage incurred as a result of any such dealings, and you acknowledge that your use of Third-Party Content and interactions with third parties is at your own risk.

### 12. Intellectual Property

12.1. All of our intellectual property assets (“**IP**“), including, without limitation, all copyrights, trademarks, patents, service marks, trade names, software code, icons, logos, symbols, layouts, trade secrets, buttons, color schemes and graphics, are protected under local and international intellectual property laws and agreements.

12.2. We hereby grant you a limited, non-exclusive, non-transferable and non-sublicensable license to access and use our IP solely for your personal use.

12.3. Under no circumstances may you modify, adapt, reproduce, distribute or use any materials for commercial purposes, including text, graphics, videos, audio, software code, user-interface design or logos.

12.4. The license granted under this Section is automatically terminated if we suspend or terminate your access to the Swap Service.

12.5. If you upload or share with us any feedback, suggestions, ideas or other information or materials (“**Content**“), you hereby automatically grant us a worldwide license to use such Content. We may use it for marketing or any other purposes at our discretion.

### 13. Indemnification

13.1. **Third-Party Claims.** You agree to fully indemnify and hold us harmless from and against any and all claims, demands, actions, suits, proceedings, disputes, allegations or investigations brought by any third party, governmental authority or industry association, as well as all liabilities, losses (both actual and consequential), damages (including any direct or indirect losses, loss of profits or loss of reputation), costs and expenses, including without limitation all interest, penalties and reasonable legal and other professional fees and expenses (“**Losses**“), arising out of or in connection with: (a) your access to or use of the Swap Service; (b) your breach or alleged breach of these Terms or any documents incorporated by reference; (c) your violation of any applicable law; (d) your infringement of the rights of any third party; or (e) your interaction with any Provider or other third party.

13.2. **Waiver of Claims.** You hereby irrevocably and unconditionally agree to release us from any claims or demands (and waive any rights you may have now or in the future against us in connection with any Losses you may suffer) arising directly or indirectly out of or in connection with any dispute you may have with any other person, user or third party relating to the Swap Service or the subject matter of these Terms.

### 14. Disclaimers and Limitation of Liability

14.1. Except as expressly provided by us in writing, the Swap Service is provided on an “as is” and “as available” basis. WE EXPRESSLY DISCLAIM, AND YOU WAIVE, ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT WITH RESPECT TO THE SWAP SERVICE, INCLUDING ANY INFORMATION, CONTENT AND MATERIALS CONTAINED THEREIN. We do not warrant that the Swap Service, any quote or any route will be accurate, available, uninterrupted, secure or error-free.

14.2. **Smart-contract risk acknowledged.** You expressly acknowledge that interacting with on-chain Router Contracts is risky and that you may lose some or all of the assets involved in a transaction. **You accept and assume the smart-contract risk.** To the maximum extent permitted by law, Yifi.io is not liable for any loss of your assets arising from any exploit, vulnerability, bug, failure or other behaviour of any Router Contract, On-Chain Provider, bridge, oracle or related infrastructure.

14.3. **Off-chain provider risk.** To the maximum extent permitted by law, Yifi.io is not liable for any act, omission, delay, freeze, rejection, reversal, custody, insolvency or compliance decision of any Off-Chain Provider, or for any loss arising from your relationship with such a provider.

14.4. Except as required by law, UNDER NO CIRCUMSTANCES SHALL Yifi.io, OUR DIRECTORS, OFFICERS, MEMBERS, EMPLOYEES OR AGENTS BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL, EXEMPLARY, PUNITIVE OR ANY OTHER DAMAGES OF ANY KIND, INCLUDING, WITHOUT LIMITATION, LOSS OF USE, LOSS OF PROFITS, LOSS OF DATA OR ASSETS, WHETHER ARISING UNDER CONTRACT, TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE, ARISING OUT OF OR IN ANY WAY RELATED TO THE USE OF OR INABILITY TO USE THE SWAP SERVICE, INCLUDING, WITHOUT LIMITATION, ANY DAMAGES CAUSED BY OR ARISING FROM ANY USE OF ANY INFORMATION OBTAINED FROM Yifi.io, OR ARISING FROM ERRORS, OMISSIONS, INTERRUPTIONS, INACCURACIES, DEFECTS, VIRUSES, DELAYS IN OPERATION OR TRANSMISSION, OR ANY FAILURE OF PERFORMANCE DUE TO FORCE MAJEURE, COMMUNICATION FAILURES, THEFT, DESTRUCTION OR UNAUTHORIZED ACCESS TO Yifi.io RECORDS, PROGRAMS OR SERVICES.

14.5. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL THE AGGREGATE LIABILITY OF Yifi.io (INCLUDING OUR DIRECTORS, OFFICERS, MEMBERS, EMPLOYEES AND AGENTS), UNDER ANY THEORY, WHETHER IN CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, ARISING FROM OR RELATING TO THE USE OR INABILITY TO USE THE SWAP SERVICE OR THESE TERMS, EXCEED THE FEES PAID BY YOU TO Yifi.io FOR THE SWAP SERVICE DURING THE THREE (3) MONTHS IMMEDIATELY PRECEDING THE DATE OF THE EVENT GIVING RISE TO SUCH LIABILITY.

### 15. Risk Disclosures

15.1. You acknowledge and agree that your access to and use of the Swap Service is entirely at your own risk.

15.2. You acknowledge that the use of the Internet and blockchain technologies involves certain technical and operational risks, including, without limitation, hardware failures, software malfunctions, Internet connectivity issues and errors in the operation of decentralized networks. Yifi.io shall not be liable for any failures, errors, data corruption or delays arising from such factors.

15.3. You understand and accept the risks associated with the use of smart contracts and decentralized protocols, including, without limitation: execution risk (quotes are indicative and the actual result may differ due to slippage, price movement, partial fills, failed routes or rejected transactions); smart-contract / router risk (Router Contracts may contain vulnerabilities and may be exploited or fail); bridge risk (cross-chain bridges carry additional risk of delay, loss or failure to finalise); off-chain provider risk (including KYC requirements, freezes, delays and provider insolvency); data risk; and the irreversible nature of blockchain transactions. Yifi.io does not guarantee the correct, secure or uninterrupted operation of third-party Providers.

15.4. Yifi.io shall not be liable for: failures, delays or errors at the blockchain-network level; network congestion or increased fees; hard forks, protocol upgrades or other changes in network operation; or temporary or permanent unavailability of underlying blockchain infrastructure. Such circumstances are considered force majeure and are beyond the control of the Swap Service.

### 16. Governing Law and Dispute Resolution

16.1. **Governing Law.** These Terms are governed by and construed in accordance with the laws of the Republic of Panama, without regard to any conflict-of-laws or choice-of-law rules.

16.2. **Claim Notice.** In the event of any dispute or claim that you have against Yifi.io or in any way relating to these Terms, you agree to first contact Yifi.io and attempt to resolve the claim by providing written notice of your claim (“**Notice**“) via email: <legal@yifi.io>.

16.3. **Arbitration Referral.** If you and Yifi.io are unable to reach a settlement of the claim within thirty (30) days of receipt of such Notice, either party may submit the dispute to binding arbitration as set forth below.

16.4. **Dispute Resolution.** Any disputes, disagreements, differences or claims between you and Yifi.io (and/or any of its Affiliates) arising out of or relating to: (a) these Terms, including their existence, validity, subject matter, interpretation, performance, breach, negotiation, termination, enforceability or consequences of invalidity; (b) your relationship with Yifi.io (and/or any of its Affiliates) as a user (whether claims are based in contract, tort, statute, fraud, misrepresentation or any other legal theory, and whether they arise during or after termination of these Terms); and (c) any dispute concerning non-contractual obligations arising out of or in connection with these Terms or your relationship with Yifi.io (and/or any of its Affiliates), shall be submitted for consideration and finally resolved by arbitration administered by **the Arbitration Centre of the Chamber of Commerce, Industries and Agriculture of Panama (CeCAP), under its Arbitration Rules** in effect at the commencement of the arbitration. The arbitral decision shall be final and binding. The arbitration provisions set forth in this Section shall survive the termination of these Terms.

16.5. **Arbitration Details.** You and we agree that: the governing law of this provision shall be **the laws of the Republic of Panama**; the place (seat) of arbitration shall be **Panama City, Panama**; the arbitration shall be conducted in English; unless otherwise agreed, the number of arbitrators shall be one (1), and such arbitrator shall have appropriate legal and technological expertise; and if you and we do not agree on the appointment of an arbitrator within fifteen (15) business days of submitting the dispute to arbitration, the arbitrator shall be appointed by **CeCAP**.

16.6. **Limitation Period.** Any claim you bring in connection with these Terms must be filed in arbitration strictly within one (1) year from the date such claim arises; otherwise, the claim shall be considered irrevocably time-barred.

16.7. **Individual Arbitration.** You agree that any dispute arising in connection with these Terms is private between you and Yifi.io, and shall be resolved exclusively on an individual basis and shall not be treated as a class arbitration, class action or any other representative proceeding.

16.8. **Severability.** If any part of this provision is found to be unenforceable or unlawful for any reason: only the unenforceable or unlawful provision shall be severed; severance shall not affect the remainder of this Section or the ability of the parties to enforce arbitration of any remaining claims on an individual basis; and if any claims must be pursued on a class, collective, consolidated or representative basis, such claims shall be submitted to a competent civil court rather than arbitration, and proceedings regarding such claims shall be stayed pending the resolution of any individual claims in arbitration.

16.9. **Confidentiality.** The parties agree that the arbitration shall be confidential. The fact of arbitration, the existence or content of any claim, all documents and information exchanged or submitted, and any submissions, orders or decisions issued during the arbitration, shall be kept confidential, and neither party shall disclose any of the foregoing to any third party, except to the arbitral tribunal, the parties, their attorneys, experts, witnesses, accountants and auditors, insurers and reinsurers, and any other persons necessary to conduct the arbitration. Notwithstanding the foregoing, a party may disclose such confidential information if: written consent is obtained from the other party; required by applicable law or by any competent regulatory authority or court order; in connection with initiating, pursuing or defending any bona fide legal action to enforce or challenge any arbitral award; or to the extent the relevant information becomes publicly available other than as a result of a breach of these Terms.

16.10. **Survival of Confidentiality.** The confidentiality obligation contained in this Section shall survive the termination of these Terms and the completion or suspension of any arbitration commenced under these Terms.

### 17. Privacy

17.1. In connection with your use of the Swap Service, Yifi.io may collect, store and process personal data. Such collection and processing are governed by the applicable [Yifi.io Privacy Policy](https://docs.yifi.io/legal-swap/privacy-policy), which is incorporated into these Terms by reference. By using the Swap Service, you acknowledge that you have read the [Privacy Policy](https://docs.yifi.io/legal-swap/privacy-policy) and agree to its terms.

### 18. Miscellaneous

18.1. These Terms constitute the entire agreement and supersede all prior and contemporaneous agreements between the parties regarding the Swap Service.

18.2. Our failure or delay in exercising any right, power or privilege under these Terms shall not operate as a waiver of such right, power or privilege.

18.3. The invalidity or unenforceability of any provision of these Terms shall not affect the validity or enforceability of any other provision, all of which shall remain in full force and effect.

18.4. We may amend these Terms from time to time. The “Last updated” date reflects the latest version, and your continued use of the Swap Service after changes take effect constitutes acceptance of the amended Terms.

<br>


# YiFi API Terms of Use

YiFi API Developer Terms of Use govern your access to the application programming interfaces, software development kits, widgets, data feeds, sample code and related documentation

These API / Developer Terms of Use (the “**API Terms**” or “**Terms**“) govern your access to and use of the application programming interfaces, software development kits, widgets, data feeds, sample code and related documentation made available by yifi.io for the **YiFi Earn** and **YiFi Swap** products, including the interfaces documented at [https://docs.yifi.io/docs/swap/api-reference/](https://docs.yifi.io/docs/swap/api-reference/base-url) and <https://docs.yifi.io/docs/earn/api-reference/> (together, the “**API**“).

These API Terms are public and apply to every person or entity that accesses or uses the API (“**Developer**“, “**you**“). They apply in addition to the Terms of Use of the YiFi Earn service and the YiFi Swap service (the “**Service Terms**“) and the Yifi.io [AML Compliance Policy](https://docs.yifi.io/legal-swap/aml-compliance-policy) and [Privacy Policy](https://docs.yifi.io/legal-swap/privacy-policy), each of which is incorporated by reference. If you use the API on behalf of an organisation, you represent that you are authorised to bind that organisation, and “you” refers to that organisation.

Yifi.io is owned by Exchangeify Corp., registration number 155777159, registered address: 55 Building, 21st Floor, Office 3, Panama City, Republic of Panama (“**Yifi.io**“, “**We**“, “**Us**“).

By accessing or using the API, or by generating or using an API Key, you confirm that you have read, understood and accepted these API Terms. If you do not agree, you must not access or use the API.

### 1. Definitions

“**API**” has the meaning given above and includes the YiFi Earn API and the YiFi Swap API, together with all endpoints, SDKs, widgets, data, and Documentation.

“**API Key**” means any credential, token, secret or identifier issued by or on behalf of Yifi.io that enables access to the API.

“**Application**” means any product, service, website, application or system operated by you that integrates with or calls the API.

“**Documentation**” means the technical documentation, specifications, usage guides and policies published by Yifi.io for the API, including at the URLs referenced above, as updated from time to time.

“**End User**” means any person who uses, or interacts with, your Application.

“**Services**” means the YiFi Earn service and the YiFi Swap service as described in their respective Service Terms.

“**Digital Assets**“, “**Protocol**“, “**Provider**“, “**Restricted Jurisdiction**” and “**Restricted Person**” have the meanings given in the applicable Service Terms.

### 2. License and Access

2.1. Subject to your continuous compliance with these API Terms, Yifi.io grants you a limited, non-exclusive, non-transferable, non-sublicensable, revocable license to access and use the API solely to develop, test and operate your Application and to integrate the Services into your Application in accordance with the Documentation.

2.2. The license does not transfer any ownership rights. All rights not expressly granted are reserved by Yifi.io.

2.3. Yifi.io may make available different access tiers, environments (such as test and production), features, quotas or commercial terms. Access to certain features (including the Partner API, higher quotas, affiliate or revenue-share arrangements, or commercial use beyond any free tier) may require a separate written agreement with Yifi.io (a “**Partner Agreement**“).

### 3. API Keys and Security

3.1. You are responsible for obtaining and safeguarding your API Keys. API Keys are confidential, are issued to you only, and must not be shared, sold, sublicensed or disclosed to any third party.

3.2. You are fully responsible for all activity that occurs under your API Keys, whether or not authorised by you. You must promptly notify Yifi.io of any actual or suspected unauthorised use or compromise of your API Keys.

3.3. Yifi.io may rotate, suspend or revoke API Keys at any time, including for security, legal, compliance or operational reasons.

### 4. Acceptable Use and Restrictions

4.1. You must use the API only as permitted by these API Terms and the Documentation, and in compliance with all applicable laws. You must not, and must not permit any third party to:

* exceed, circumvent or interfere with any rate limit, quota, throttling, authentication or access control;
* access the API by any means other than the documented interfaces, or scrape, crawl or harvest data other than through the API as documented;
* reverse engineer, decompile or disassemble the API or attempt to derive source code, except to the extent such restriction is prohibited by law;
* resell, redistribute, sublicense or commercially exploit the API or any data obtained through it other than as an integrated part of your Application, or build or assist in building a competing product, index or aggregated data set;
* introduce malware, conduct penetration testing without prior written consent, or otherwise disrupt or compromise the integrity, security or performance of the API or the Services;
* misrepresent the source of, or remove or alter any attribution, proprietary notices or markings in, any API output;
* use the API to facilitate any unlawful, fraudulent, deceptive, infringing or harmful activity; or
* use the API in or for the benefit of any Restricted Jurisdiction or Restricted Person, or to provide access to the Services to any such jurisdiction or person.

4.2. Yifi.io may monitor your use of the API to verify compliance, ensure stability, and improve the API and the Services.

### 5. Rate Limits and Availability

5.1. Your use of the API is subject to the rate limits, quotas and fair-use parameters set out in the Documentation or otherwise communicated to you. Yifi.io may set, change, throttle or enforce such limits at its discretion.

5.2. The API is provided on an “as is” and “as available” basis. Yifi.io does not guarantee any level of availability, uptime, latency, throughput or performance unless expressly agreed in a Partner Agreement. Yifi.io may modify, suspend, deprecate or discontinue the API or any of its features, endpoints or versions at any time, and will use reasonable efforts to provide advance notice of material breaking changes through the Documentation or other channels.

### 6. Nature of the API and the Services

6.1. The API is a non-custodial, informational and technical interface. Yifi.io does not take custody of, hold or control any Digital Assets, does not have access to private keys, and does not execute transactions on behalf of you or any End User. All transactions are initiated and signed by the relevant wallet holder, or executed by independent third-party Protocols and Providers.

6.2. **YiFi Earn API.** Data exposed by the YiFi Earn API (including yield/APY figures and risk scores) is generated automatically from external on-chain and third-party data sources, is indicative and informational only, and **does not constitute investment advice, a recommendation, a rating, a solicitation or an offer**. It is subject to change and is not a guarantee of any result.

6.3. **YiFi Swap API.** The YiFi Swap API provides routing, quote and execution-construction functionality across third-party liquidity sources (including DEX, CEX, private liquidity and bridges). Quotes and routes are indicative, are generated automatically, and may differ from actual execution due to slippage, market movement, route availability and network conditions.

6.4. **Third parties “as is”.** The Services route to, and rely on, autonomous third-party Protocols, smart contracts, routers and Providers that are developed, deployed and controlled by third parties and are **not created, controlled or audited by Yifi.io**. Yifi.io is not responsible or liable for any bug, exploit, hack, vulnerability, failure, depeg, insolvency, delay or other behaviour of any such third party, including any resulting loss of assets.

### 7. Developer Obligations Toward End Users

7.1. You are solely responsible for your Application, including its design, security, content, and its compliance with all applicable laws. You act as an independent operator and not as an agent of Yifi.io.

7.2. You must maintain your own terms of service and privacy policy with your End Users, and must not represent that Yifi.io is responsible for, or a party to, your relationship with your End Users.

7.3. You must accurately present to your End Users, and must not alter or omit, the informational nature and risk character of the data and functionality obtained through the API, including (where applicable) that yield/APY and risk scores are informational and not advice, that interactions involve third-party smart contracts and Providers on an “as is” basis, and that transactions may be irreversible.

7.4. You must not use the API to offer the Services, or enable access, in any Restricted Jurisdiction or to any Restricted Person, and you must implement reasonable measures consistent with the [AML / Compliance Policy](https://docs.yifi.io/legal-swap/aml-compliance-policy) to prevent such access.

### 8. Compliance

8.1. You are responsible for your own regulatory status and for any licensing, registration, KYC, AML/CTF, consumer-protection, tax and other obligations applicable to your Application and your End Users. You must review and comply, and ensure your End Users are directed to review and comply, with the terms, rules and policies of any platform, Protocol or Provider through which an operation is performed.

### 9. Data and Privacy

9.1. Yifi.io may collect and process technical and usage data relating to your access to the API (such as request metadata, identifiers, IP address, and performance data) for security, analytics, billing, abuse prevention and improvement purposes, as described in the [Privacy Policy](https://docs.yifi.io/legal-swap/privacy-policy).

9.2. As between the parties, you are responsible for any personal data of your End Users that you collect or process, and for providing all required notices and obtaining all required consents. You must not send Yifi.io any End-User personal data except as strictly necessary to use the API and as permitted by the Documentation and applicable law.

### 10. Fees

10.1. Yifi.io may offer the API under a free tier and/or on a metered or commercial basis. Yifi.io reserves the right to introduce, change or remove fees, quotas and access tiers at its discretion, with notice through the Documentation or other channels.

10.2. Commercial use beyond any published free tier, the Partner API, and any affiliate or revenue-share arrangement are governed by a separate Partner Agreement. In the event of a conflict between these API Terms and a signed Partner Agreement, the Partner Agreement prevails for the matters it expressly addresses.

### 11. Intellectual Property and Brand

11.1. The API, the Documentation, the Services, and all related software, content, trademarks, logos and other intellectual property are owned by Yifi.io or its licensors and are protected by applicable laws. Except for the limited license expressly granted, no rights are granted to you.

11.2. You may refer to Yifi.io, YiFi Earn and YiFi Swap solely to truthfully describe your integration, in accordance with any brand guidelines provided by Yifi.io. You must not use Yifi.io’s marks in a manner that implies endorsement, partnership or sponsorship beyond the actual integration, or that disparages Yifi.io.

11.3. If you provide feedback, suggestions or ideas regarding the API, you grant Yifi.io a worldwide, perpetual, irrevocable, royalty-free license to use them for any purpose without obligation to you.

### 12. Disclaimers

12.1. THE API, THE DOCUMENTATION AND ALL DATA AND OUTPUT ARE PROVIDED ON AN “AS IS” AND “AS AVAILABLE” BASIS. TO THE MAXIMUM EXTENT PERMITTED BY LAW, Yifi.io EXPRESSLY DISCLAIMS ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, ACCURACY, AND UNINTERRUPTED OR ERROR-FREE OPERATION.

12.2. You assume all risk arising from your use of the API and the operation of your Application, including any reliance on indicative data, any interaction with third-party Protocols, smart contracts and Providers, and any loss of Digital Assets.

### 13. Limitation of Liability

13.1. TO THE MAXIMUM EXTENT PERMITTED BY LAW, Yifi.io AND ITS DIRECTORS, OFFICERS, MEMBERS, EMPLOYEES AND AGENTS SHALL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY OR PUNITIVE DAMAGES, OR FOR ANY LOSS OF PROFITS, REVENUE, DATA, GOODWILL OR DIGITAL ASSETS, ARISING OUT OF OR RELATING TO THE API OR THESE API TERMS, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE) OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

13.2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE AGGREGATE LIABILITY OF Yifi.io ARISING OUT OF OR RELATING TO THE API OR THESE API TERMS SHALL NOT EXCEED THE GREATER OF (A) THE TOTAL FEES PAID BY YOU TO Yifi.io FOR ACCESS TO THE API DURING THE THREE (3) MONTHS IMMEDIATELY PRECEDING THE EVENT GIVING RISE TO THE CLAIM, OR (B) ONE HUNDRED U.S. DOLLARS (USD 100).

### 14. Indemnification

14.1. You agree to indemnify and hold harmless Yifi.io and its directors, officers, employees, agents and affiliates from and against any claims, demands, proceedings, liabilities, losses, damages, costs and expenses (including reasonable legal fees) arising out of or in connection with: (a) your access to or use of the API; (b) your Application and your relationship with your End Users; (c) your breach of these API Terms or any incorporated terms; (d) your violation of any applicable law; or (e) your infringement of any third-party right.

### 15. Suspension and Termination

15.1. Yifi.io may suspend, restrict or terminate your access to the API at any time, with or without notice, including for actual or suspected breach of these API Terms, security or legal risk, non-payment, or discontinuation of the API.

15.2. You may stop using the API at any time. Upon termination, the license in Section 2 ends, you must cease all use of the API, stop using and delete any API Keys and cached non-public data, and remove the integration from your Application. Sections that by their nature should survive (including IP, disclaimers, limitation of liability, indemnification, and dispute resolution) survive termination.

### 16. Changes to these API Terms

16.1. We may amend these API Terms from time to time at our sole discretion. The “Last updated” date reflects the latest version. Your continued access to or use of the API after changes take effect constitutes acceptance of the amended Terms.

### 17. Governing Law and Dispute Resolution

17.1. These API Terms are governed by the laws of the Republic of Panama, without regard to conflict-of-laws rules.

17.2. Any dispute arising out of or relating to these API Terms shall first be notified in writing to Yifi.io at <legal@yifi.io> and, if not resolved within thirty (30) days, shall be finally resolved by binding individual arbitration administered by **the Arbitration Centre of the Chamber of Commerce, Industries and Agriculture of Panama (CeCAP) under its Arbitration Rules**, with the governing law of this provision being **the laws of the Republic of Panama**, the place (seat) of arbitration being **Panama City, Panama**, conducted in English before one (1) arbitrator. The parties waive any right to class or representative proceedings. Any claim must be brought within one (1) year of arising. Notwithstanding the foregoing, Yifi.io may seek injunctive or equitable relief in any jurisdiction. The arbitration shall be confidential.

### 18. Miscellaneous

18.1. These API Terms, together with the documents incorporated by reference and any applicable Partner Agreement, constitute the entire agreement between you and Yifi.io regarding the API.

18.2. You may not assign these API Terms without Yifi.io’s prior written consent; Yifi.io may assign them freely. Nothing in these API Terms creates any partnership, joint venture, agency or employment relationship between the parties.

18.3. Our failure to exercise any right is not a waiver. If any provision is held invalid or unenforceable, the remaining provisions remain in full force and effect.

<br>


# AML Compliance Policy

*This summary is provided for your convenience only. It is not legally binding and does not replace the full Policy below. If there is any difference between this summary and the full Policy, the full Policy governs.*

* **We don’t verify your identity.** Yifi.io is just an aggregator – a non-custodial software interface. We never hold your funds, we don’t execute transactions for you, and we don’t collect personal data to identify you. Because there is nothing we hold or settle on your behalf, we don’t run our own KYC or AML checks on users.
* **You deal directly with third parties.** Every operation is carried out by you, from your own wallet, directly with independent protocols, providers and exchangers. The actual swap, bridge, deposit or yield happens on their side, not ours.
* **Verification may happen on the provider’s side.** Some third parties (especially off-chain exchangers) run their own KYC and AML controls under their own rules – they may request documents, set limits, or block a transaction. Where applicable, this is indicated in the interface (for example, KYC labels shown for Swap providers); otherwise, review the provider’s or protocol’s own terms before you transact.
* **You stay responsible for compliance.** You must use funds from lawful sources, comply with the laws that apply to you, and check the rules of any platform, protocol or provider you use.

This AML Policy (the “**Policy**“) describes the approach of yifi.io (“**Yifi.io**“, “**We**“, “**Us**“) to anti-money-laundering (“**AML**“) and counter-terrorist-financing (“**CTF**“) matters in connection with the **YiFi Earn** and **YiFi Swap** services and any related interfaces and applications (each a “**Service**” and together the “**Services**“). This Policy forms part of, and is incorporated by reference into, the Terms of Use of each Service.

Yifi.io is owned by Exchangeify Corp., registration number 155777159, registered address: 55 Building, 21st Floor, Office 3, Panama City, Republic of Panama.

By accessing or using the Services, you acknowledge that you have read and accepted this Policy. If you do not agree with it, you must not use the Services.

### 1. Nature of the Services – Non-Custodial and Non-Intermediary

1.1. The Services are **non-custodial software interfaces** of an informational and technical nature. Yifi.io does not hold, store, control, pool, transfer or otherwise take custody of any User funds or Digital Assets at any point, does not have access to Users’ private keys or wallets, and cannot initiate, sign or reverse any transaction.

1.2. Yifi.io does not act as a bank, exchange, money-services business, broker, custodian, intermediary or counterparty. It does not execute transactions on Users’ behalf and does not exercise any discretion over User assets. All transactions are initiated and signed by the User from the User’s own wallet, or are executed by independent third-party protocols, providers and exchangers.

1.3. Accordingly, Yifi.io does **not itself conduct identification (KYC), customer due diligence, source-of-funds verification or independent transaction-level AML/CTF screening** of Users, and does not assume independent verification obligations in respect of the Services.

### 2. Role of Third Parties

2.1. The Services aggregate and provide access to independent third-party protocols, smart contracts, on-chain routers, liquidity aggregators and off-chain providers and exchangers (collectively, “**Third Parties**“). All settlement, custody and execution occur on the side of such Third Parties.

2.2. Third Parties act independently and under their own terms, policies and procedures. You acknowledge and agree that a Third Party may, on its own side and at its own discretion or as required by applicable law:

* require identity verification (KYC) and request documents or other information;
* carry out its own AML/CTF controls, including transaction monitoring, wallet and address screening, sanctions screening, risk scoring and similar measures;
* impose limits, request additional information, or decline, delay, freeze, reverse or block a transaction; and
* refuse to provide its services to a particular User.

2.3. Such requirements and controls are determined and applied entirely by the relevant Third Party. Yifi.io does not control, instruct, perform or take responsibility for the KYC, AML/CTF or compliance decisions of any Third Party.

### 3. Restricted Jurisdictions and Sanctions

3.1. The Services are not offered to, and may not be used by, persons connected with:

* countries and territories subject to comprehensive sanctions or embargoes;
* jurisdictions where dealing in or the circulation of cryptocurrency or digital assets is directly prohibited under applicable law; and
* any person, entity or wallet that appears on, is owned or controlled by, or acts on behalf of a person on, any applicable sanctions list (including, without limitation, the OFAC Specially Designated Nationals and Blocked Persons (SDN) List and equivalent UN, EU or UK lists).

The consolidated list of restricted jurisdictions is set out in the Terms of Use of each Service and is reviewed and may be updated from time to time.

3.2. Yifi.io does not operate in, and does not target, restricted jurisdictions, and reserves the right to determine the markets and jurisdictions in which the Services are made available.

3.3 The maximum amount of the refund fee, according to the monitoring rules, should not exceed $100.

### 4. User Responsibilities

4.1. You are solely responsible for ensuring that your use of the Services, and of any Third Party accessed through them, is lawful in your jurisdiction and complies with all applicable laws, including AML/CTF and sanctions requirements.

4.2. **Before carrying out any operation, you must independently review and comply with the terms, rules and policies of the relevant platform, protocol, provider or exchanger** through which the operation is to be performed, including any identification (KYC), AML/CTF, eligibility and geographic requirements they may apply.

4.3. You represent and warrant that you use only Digital Assets derived from lawful sources, that you do not act on behalf of any sanctioned or restricted person, and that you will not use the Services for money laundering, terrorist financing, sanctions evasion, fraud or any other unlawful purpose.

### 5. Right to Restrict Access

5.1. Where Yifi.io reasonably believes that a User is a restricted or sanctioned person, is connected with a restricted jurisdiction, has breached the Terms of Use or this Policy, or presents a legal, regulatory, security or reputational risk, Yifi.io reserves the right, at its sole discretion and without prior notice or disclosure of reasons, to restrict, suspend, condition or terminate access to all or part of the Services.

5.2. For these purposes, Yifi.io may apply access-control and blocklisting measures, including by wallet address, account/login identifier and User-Agent or device characteristics, and may implement IP-based restrictions as an additional measure.

### 6. Changes to this Policy

6.1. We may amend this Policy from time to time at our sole discretion. The “Last updated” date reflects the latest version, and your continued use of the Services after changes take effect constitutes acceptance of the amended Policy.


# Privacy Policy

This Privacy Policy applies to all personal data of Users that the Yifi.io Service and any related applications

### 1. Introduction

1.1. This PRIVACY POLICY (“Policy”) applies to all personal data of Users that the Yifi.io Service and any related applications (including, without limitation, mobile applications) (the “Service”) may receive from Users during their use of the Service.

The Service is owned by Exchangeify Corp., registration number 155777159, registered at 55 Building, 21st Floor, Office 3, Panama City, Republic of Panama.

1.2. Use of the Service constitutes the User’s unconditional consent to this Policy and to the terms of data collection and processing set forth herein; if the User does not agree with these terms, they should refrain from using the Service. By using the Service, you accept the terms of this Policy and our Terms of Use, and you consent to the collection, use, disclosure, and storage of your information as described in this Policy. If you have not already done so, please also review the Terms of Use. The Terms of Use contain provisions that limit our liability to you and require the resolution of any disputes with us on an individual basis, rather than as a class or representative action. **IF YOU DO NOT AGREE WITH ANY PART OF THIS PRIVACY POLICY OR OUR TERMS OF USE, PLEASE DO NOT USE THE SERVICE.**

### 2. Terms and Definitions

2.1. **Personal Data** – any information directly or indirectly relating to a specific or identifiable individual (data subject), including standard data automatically received by the HTTP server when accessing the Service and subsequent User actions (host IP address, User operating system type, website pages visited by the User, etc.).

2.2. **Terms of Use** – an agreement between the User and the Operator containing all necessary and material terms for using the Service, providing access to the Service, and the User’s use of the Service, whereby this Policy is an integral part of the Terms of Use.

2.3. **User** (data subject, User) – an individual who visits, downloads, or otherwise uses the Service, regardless of whether they actually use the Service’s features.

2.4. **Operator** – Exchangeify Corp., registration number 155777159, registered at 55 Building, 21st Floor, Office 3, Panama City, Republic of Panama, which manages the Service and owns the Service.

2.5. **Services** means the YiFi Earn service and the YiFi Swap service as described in their respective Service Terms.

2.6. **Cookies** – small text files, usually consisting of letters and numbers, that are stored on your computer or mobile device when visiting websites. When you revisit these websites, cookies allow the Service to recognize the User’s device. Cookies cannot read data from your hard drive and do not have access to cookies set by other websites. Cookies are not used for tracking Users or for marketing purposes.

2.7. **Destruction of Personal Data** – actions resulting in the impossibility of determining the ownership of personal data by a specific User without excessive financial and organizational costs.

2.8. **Processing of Personal Data** – any action (operation) or set of actions (operations) performed with personal data using automated means or without them, including collection, recording, systematization, accumulation, storage, clarification (updating, modification), retrieval, use, transfer (distribution, provision, access), depersonalization, blocking, deletion, destruction of personal data and other actions for the purpose of complying with the Terms of Use and providing access to the Service.

### 3. General Provisions

3.1. This Policy regulates the processing of personal data in the interaction between the Operator and the User in connection with the use of the Service.

3.2. The Service adheres to the principle of “Data protection by Design” and minimizes the collection and processing of User data.

3.3. This Policy is developed in accordance with the requirements of:

3.3.1. Applicable legislation, including the laws of the jurisdictions where the Operator’s companies are registered;

3.3.2. Agreements concluded by the Operator;

3.3.3. Other regulatory documents, taking into account modern requirements in the field of personal data protection.

3.4. This Policy is published on the Service’s website.

### 4. Categories of Personal Data Processed

4.1. The Operator may process the following User data when the User utilizes the “YiFi Earn” and “YiFi Swap” Services:

* IP address of the device used to access the Service, operating system information, access time, location;
* Type and version of the browser used;
* Transaction history conducted on the Service;
* Cookie data;
* Data about content posted on the Service, and data regarding User activity on the Service;
* Email addresses;
* Full name, given names, or pseudonyms.

4.2. The Service does not process personal data that directly identifies the User, including:

* Physical residential or location addresses;
* Phone numbers;
* Passport or other identification documents.

4.3. Registration, account creation, or identity verification is not required to access the core functionality of the Services. To operate, the Services process certain data strictly necessary to construct, route, and execute the on-chain transactions that the User independently signs (for example, public wallet addresses). Such data does not directly identify a User by name. However, because a public wallet address and the associated on-chain activity may, in combination with other information available to us (such as IP address or on-chain analytics), render the User identifiable, this data constitutes personal data. We process it in accordance with this Policy and with applicable data-protection law, including Law 81 of March 26, 2019 of the Republic of Panama.

4.4. The Service is non-custodial and does not store private keys, seed phrases, or confidential User credentials. All digital assets remain fully under the control of Users through their own wallet software.

4.5. Our Services are not intended to be accessed or used by children, minors or persons who are not of legal age. If you are a parent or guardian and you have reason to believe your child or ward has provided us with their personal data without your consent, please contact us.

### 5. Purposes of Personal Data Processing

5.1. Personal data of Users obtained during the use of the Service may be processed solely for the purposes of the Service’s operation, namely:

* Providing the functionalities of the Service;
* Collecting and analyzing statistical data on the operation of the Service;
* Improving the performance and functionality of the Service;
* Complying with applicable legal requirements;
* Analyzing and enhancing the Service’s performance;
* Ensuring the security of the product website;
* Modeling, reporting, assessment, risk monitoring, research of current or new products, and identifying potential clients;
* Fulfilling obligations in order to track suspicious activity, monitor compliance with the Terms of Use, and prevent fraud and other offenses.

5.2. The processing of personal data is limited to achieving specific, pre-determined, and lawful purposes. Processing of personal data incompatible with the purposes for which it was collected is not permitted.

5.3. The Operator may assign the processing of User personal data to third parties only with the User’s consent, in accordance with applicable law and/or within the framework of an agreement with the User.

5.4. When personal data processing is assigned to a third party, the Operator must define the list of actions (operations) with personal data that the third party will perform, as well as the purposes of processing, and obligate the third party to maintain the confidentiality of personal data and ensure its security during processing; requirements for the protection of processed personal data must also be established.

5.5. When User personal data is transferred, access is granted only to specially authorized persons, and such persons are entitled to access only those personal data necessary for the performance of their official duties.

### 6. Methods of Processing

6.1. The Operator collects and processes your personal data based on and in connection with the performance of the Terms of Use.

6.2. In the course of processing personal data, the Operator performs the following actions: collection, recording, systematization, accumulation, storage, clarification (updating, modification), retrieval, use, transfer (distribution, provision, access), depersonalization, blocking, deletion, destruction of information and other actions for the purpose of complying with the Terms of Use and providing access to the Service.

6.3. Personal data is stored on electronic media.

### 7. User Rights

7.1. The User has the right to:

* Access information about personal data processed by the Operator, including information on the purposes and methods of processing;
* Request the Operator to correct or clarify personal data;
* Request notification of all persons to whom incorrect or incomplete personal data was previously provided;
* Receive information from the Operator about third parties to whom the Operator has transferred personal data;
* Receive information from the Operator on the procedures for processing their personal data within the Operator’s authority and according to the procedures adopted by the Operator;
* Receive personal data provided to the Operator in a structured, commonly used, and machine-readable format, and transfer such data to other operators;
* Request the deletion and/or destruction of all or part of their personal data, impose restrictions on the processing of their personal data, and withdraw consent to the processing of personal data;
* Claim compensation for damages caused as a result of unlawful processing of personal data;
* File a complaint with a supervisory authority if they believe that the processing of their personal data violates applicable data protection laws.

7.2. The User must bear in mind that the deletion of personal data or withdrawal of consent to data processing may result in the partial or complete inability to use the functionalities of the Service.

### 8. Information on Personal Data Protection Requirements

8.1. In processing personal data, the Operator takes necessary legal, organizational, and technical measures and ensures their implementation to protect personal data from unauthorized or accidental access, destruction, alteration, blocking, copying, provision, dissemination of personal data, as well as from other unlawful actions concerning personal data.

8.2. The Service undertakes to protect User information with the same care as it protects its own data and network.

8.3. The Service employs various security measures to help keep User information safe. However, the Service cannot guarantee that these measures will prevent all attempts to circumvent privacy or security settings on its website and application, whether due to unforeseen circumstances or unlawful actions. Accordingly, the Service provides no express or implied warranties that such access can be completely prevented.

### 9. Confidentiality

9.1. The Operator undertakes to keep any confidential information obtained in its possession strictly confidential and takes all necessary measures to ensure the confidentiality of such information and to prevent its unlawful disclosure or unauthorized use.

### 10. Cookie Policy

10.1. The Operator uses cookies when the User visits the Service. This section explains what these technologies are, why the Service uses them, and the rights of Users regarding control over their use.

10.2. Cookies are small text files, usually consisting of letters and numbers, that are stored on your computer or mobile device when visiting websites. When you revisit these websites, cookies allow the Service to recognize the User’s device. Cookies cannot read data from your hard drive and do not have access to cookies set by other websites.

10.3. The Service uses cookies solely to ensure the proper functioning of the Service, including:

* Maintaining the User’s wallet connection;
* Saving the selected interface theme.

Cookies are not used for tracking Users or for marketing purposes.

10.4. **Cookie Management.** The User may configure their browser to block or delete cookies; however, this may limit the functionality of the Service, including preventing proper wallet connection and interface display.

### 11. Destruction of Personal Data

11.1. The destruction of the User’s personal data is carried out in the following cases:

11.1.1. Upon achieving the purposes of their processing or if the need to achieve such purposes is lost, within a period not exceeding thirty (30) days from the date the purpose of personal data processing is achieved, unless otherwise provided by an agreement to which the User is a party, or by another agreement between the Operator and the User;

11.1.2. In the case of unlawful processing of personal data, or upon lawful withdrawal of personal data, within a period not exceeding ten (10) business days from the date such fact is identified;

11.1.3. Upon the expiration of the personal data retention period established in accordance with applicable law and the Operator’s organizational and administrative documents, including the withdrawal of the User’s consent to personal data processing;

11.1.4. Upon receipt of an order from an authorized body for the protection of data subjects’ rights or a court decision;

11.1.5. The parties acknowledge and agree that the Operator may, at its discretion, destroy copies of personal data, including in the event of unauthorized access to personal data by third parties.

### 12. Transfer to Third Parties

12.1. The Service operates as a non-custodial interface and aggregator and does not take custody or control of Users’ funds. The Service does not transfer identity documents or KYC identifiers to third parties, because it does not collect them. However, in order to operate, the Service does transfer personal data — namely public wallet addresses, IP addresses, and other technical connection data — to the recipients described below. As stated in clause 4.3, such data does not identify a User by name but nonetheless may constitute personal data.

12.2. When a User performs operations through the Service, the public address of their wallet is automatically transmitted to:

* Third-party blockchain protocols, including decentralized exchanges (DEX), lending, staking, yield protocols, and external aggregators;
* RPC providers and technical nodes facilitating the Platform’s interaction with blockchain networks.

12.3. Each such recipient acts as an independent data controller, operator. Each processes data under its own privacy policy and terms, over which we have no control and for which we accept no responsibility. Certain of these transfers are an inherent technical requirement of blockchain infrastructure and are necessary to execute the transaction the User has requested.

12.4. Off-chain exchange providers may, at their sole discretion, require identity verification (KYC/AML) directly from the User as a condition of completing a transaction. Any such identity or verification data is collected and processed by that provider as an independent controller, and not by us; we do not request, receive, store, or process it. We recommend that Users review the privacy policy and terms of any third-party provider before transacting.

12.5. Yifi.io provides a partner-level API and related tools that allow third parties to integrate the Services into their own products, as governed by the Partner Agreement. Where the Service is accessed through a partner integration, data about the partner’s end Users flows to us to render the aggregation and yield-tracking functionality. In that scenario:

* The end user is a User of the partner’s application; the partner is responsible for its own privacy disclosures to its end Users and for establishing any legal basis required for the integration;
* Where data received through the widget is used to construct or route a transaction, it is onward-transferred to the same categories of recipients described in this section, and the partner is responsible for disclosing this onward transfer to its end users;
* We process end-user data received through partner integrations solely to provide, secure, and improve the integrated functionality.

### 13. Cross-Border Transfer of Personal Data

13.1. The User consents to the cross-border transfer of personal data to the territory of other countries for the processing of personal data at the location of the copyright holder for the purposes specified in Section 5 of this Policy.

13.2. The Operator may carry out cross-border transfers of personal data to countries that both do and do not ensure reliable protection of the rights of data subjects, for the purposes specified in Section 5 of this Policy.

13.3. Before initiating a cross-border transfer of personal data, the Operator must ensure that the foreign country to which the personal data is to be transferred provides reliable protection of the rights of data subjects.

13.4. Cross-border transfer of personal data to territories of foreign countries that do not meet the above requirements may be carried out only with the User’s written consent to the cross-border transfer of their personal data and/or under an agreement to which the User and the Operator are parties.

13.5. The Operator undertakes to take reasonable efforts to ensure that third parties receiving access to personal data through cross-border transfers implement the necessary technical and administrative measures to protect the transferred personal data.

### 14. User Requests

14.1. Users have the right to send their requests to the Operator by email: <legal@yifi.io> regarding the use of personal data.

14.2. The Operator undertakes to review and respond to the User’s request within thirty (30) days from the date of receipt.

14.3. All correspondence received by the Operator from Users (written or electronic communications) is confidential information and shall not be disclosed without the User’s written consent. Personal data and other information about the User submitting the request may not be used without the User’s explicit consent for any purposes other than responding to the request, except in cases explicitly provided for by law.

### 15. Third-Party Resources

15.1. The Operator may place links to third-party websites on the Service, which may redirect Users to such third-party resources. The Operator is not responsible for the collection, processing, or deletion of User personal data by such third parties, or for the content of these websites. For more information, please refer to the privacy policies of the respective third parties, available via these links.

### 16. Retention Specifics

16.1. We retain personal data only for as long as necessary to fulfil the purposes described in this Policy, in accordance with the principles of purpose limitation and proportionality (data minimization).

16.2. Because the core functionality of the Service is non-custodial and account-free, the volume of data we retain is limited. In particular:

* On-chain data (including public wallet addresses) exists permanently and publicly on the relevant blockchains and is outside our control; we cannot alter, block, or delete data recorded on a blockchain. Any copies or indexes of such data that we hold for the operation of the Service are retained only for the periods stated below.
* Technical and connection data (IP address, device and browser information, access time, location, cookie data) is retained only for as long as needed to operate, secure, and measure the Service, and for the shorter of the period required to fulfil the relevant purpose or the period required by applicable law.
* Geo-screening records are retained for the period necessary to evidence compliance with sanctions and applicable legal requirements.
* Email address is retained until you withdraw consent or request deletion, or until it is no longer needed for the purpose for which it was provided.
* Cookie data is retained for the periods set out in our Cookie notice / the lifetime of the relevant cookie.

16.3. We will delete personal data when its storage no longer has a legal basis, when it has not been (or is no longer) authorized, or when the retention period has expired.

16.4. We keep personal data accurate and up to date to the extent it remains under our control. Users may request rectification, updating, deletion (cancellation), or blocking of their personal data as described in the “User Rights” section.

### 17. Final Provisions

17.1. The period of processing of personal data processed by the Operator shall be equal to the period of fulfillment of the Operator’s obligations or until the withdrawal of consent by the User or the termination of the Operator’s activities.

17.2. Withdrawal of consent is carried out by the User or their representative by sending a written statement to the Operator, drafted in free form, in such a way that it allows reliable identification of the person who signed and submitted the statement, as well as the basis of the representative’s authority. The statement must be sent to the following email address: <legal@yifi.io>.

<br>


# Base URL

| Environment | Origin                |
| ----------- | --------------------- |
| Production  | `https://api.yifi.io` |

All documented routes are under `/v1`. Interactive docs: `/api/docs`.


# Authentication

Public catalog, quote, pair, swap and transaction endpoints **do not require a JWT or API key**.

Optional header **`x-api-key-partner`** on `POST /v1/swap` only:

* omitted → anonymous order
* valid key → order is attributed to the partner (`partnerId`) and appears in Partner Portal `/v1/orders`
* invalid key → `401` with `error.code` `INVALID_API_KEY` (or the code returned by partner verification)

There is no Bearer/JWT guard on this service.


# Engine names

| In query / body (`type`, `engine`) | In responses (`engine`, `engineSupport`, `availableEngines`) |
| ---------------------------------- | ------------------------------------------------------------ |
| `cex`                              | `off-chain`                                                  |
| `dex`                              | `on-chain`                                                   |
| `private`                          | `private`                                                    |

`GET /v1/quote?type=` also accepts `all` and comma-separated combinations (`cex,dex`, `cex,dex,private`). Default when `type` is omitted: **`cex`**.

Network identifiers in query/body must match **`GET /v1/chains` → `chains[].id`** (canonical slug, case-insensitive). Token tickers are matched case-insensitively.


# Typical flow

1. `GET /v1/chains` and `GET /v1/tokens` — catalog
2. `GET /v1/pairs` — confirm a concrete direction (all four sides required)
3. `GET /v1/pairs/search` — list counterpart tokens for one side
4. `GET /v1/quote` — rates; each item has `rateId` (Redis snapshot, **5 minutes**) and optional provider `quoteId`
5. `POST /v1/swap` — create the order; pass `rateId` to lock the shown quote; store `transactionId` + `accessToken`
6. `GET /v1/transactions/{id}` — poll status (`id` is the YiFi UUID from step 5)
7. `POST /v1/transactions/{provider}/dex/set-deposit-hash?access_token=` — after the user broadcasts a DEX deposit (once)


# Errors

Unhandled exceptions and `HttpException` bodies are wrapped as:

```json
{ "success": false, "error": { "code": "STRING", "message": "…", "requestId": "…", "timestamp": "ISO-8601", "details": {} } }
```

`details` is present only on some 4xx errors. `X-Request-Id` is always set on the response (generated if the client did not send `x-request-id`).

Unknown query/body fields are rejected (`forbidNonWhitelisted`). Validation failures use HTTP 400.


# Caching (server-side)

| Data                                                           |
| -------------------------------------------------------------- |
| Quote result (`GET /v1/quote`)                                 |
| Rate snapshot referenced by `rateId`                           |
| Pair lookup (`GET /v1/pairs`, `GET /v1/pairs/search` coin set) |
| Token / chain catalogs                                         |


# Chains

Supported blockchain networks (`GET /v1/chains`)

## List supported chains

> All cached networks, sorted by popularity then name. \`id\` is the canonical \*\*slug\*\* used as \`network\` / \`networkFrom\` / \`fromNetwork\` on other endpoints. \`aliases\` are etalon names (not accepted as \`GET /v1/tokens?network=\`). Empty cache → \`{ chains: \[] }\`. No query parameters.

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"tags":[{"name":"Chains","description":"Supported blockchain networks (`GET /v1/chains`)"}],"servers":[{"url":"https://api.yifi.io","description":"Production"},{"url":"https://api-dev.yifi.io","description":"Development / Staging"}],"paths":{"/v1/chains":{"get":{"description":"All cached networks, sorted by popularity then name. `id` is the canonical **slug** used as `network` / `networkFrom` / `fromNetwork` on other endpoints. `aliases` are etalon names (not accepted as `GET /v1/tokens?network=`). Empty cache → `{ chains: [] }`. No query parameters.","operationId":"getChains","parameters":[],"responses":{"200":{"description":"List of supported chains","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChainsListApiResponseDto"}}}},"500":{"description":"Failed to fetch chains","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}}},"summary":"List supported chains","tags":["App","Chains"]}}},"components":{"schemas":{"ChainsListApiResponseDto":{"type":"object","properties":{"chains":{"type":"array","items":{"$ref":"#/components/schemas/ChainItemApiDto"}}},"required":["chains"]},"ChainItemApiDto":{"type":"object","properties":{"id":{"type":"string","description":"Canonical slug. Use this value as `network`, `networkFrom`, `fromNetwork`, etc."},"name":{"type":"string","description":"Human-readable network name"},"chainId":{"type":"number","nullable":true},"status":{"type":"string","enum":["active","inactive","maintenance"]},"supportedEngines":{"type":"array","items":{"type":"string"}},"aliases":{"type":"array","items":{"type":"string"}},"nativeToken":{"type":"string"},"blockTime":{"type":"string","nullable":true},"providers":{"type":"object","description":"Liquidity provider slugs keyed by engine category","additionalProperties":true},"explorerUrl":{"type":"string"},"logoUrl":{"type":"object","nullable":true},"memoNeeded":{"type":"boolean","description":"Whether transfers on this chain require a memo/tag (derived from active coins with extraId)."}},"required":["id","name","chainId","status","supportedEngines","aliases","nativeToken"]}}}}
```


# Providers

Active liquidity providers and engine breakdown (`GET /v1/providers`)

## List liquidity providers

> Active CEX exchangers (\`engine: off-chain\`), active DEX exchangers (\`on-chain\`), and a single \`private\` provider when the private task queue is configured.\
> \
> \`id\` is the slug used as \`provider\` on quote/swap. Inactive exchangers are omitted. \`status\` on each item is always \`active\` for this catalog.\
> \
> \`aggregatedFrom\` / \`breakdown\` count those engine groups. KYC and legal fields are inherited from the admin provider catalog when a match exists.

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"tags":[{"name":"Providers","description":"Active liquidity providers and engine breakdown (`GET /v1/providers`)"}],"servers":[{"url":"https://api.yifi.io","description":"Production"},{"url":"https://api-dev.yifi.io","description":"Development / Staging"}],"paths":{"/v1/providers":{"get":{"description":"Active CEX exchangers (`engine: off-chain`), active DEX exchangers (`on-chain`), and a single `private` provider when the private task queue is configured.\n\n`id` is the slug used as `provider` on quote/swap. Inactive exchangers are omitted. `status` on each item is always `active` for this catalog.\n\n`aggregatedFrom` / `breakdown` count those engine groups. KYC and legal fields are inherited from the admin provider catalog when a match exists.","operationId":"getProviders","parameters":[],"responses":{"200":{"description":"Provider catalog plus engine counts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AggregatorInfoResponseDto"}}}},"500":{"description":"Failed to fetch aggregator info","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}}},"summary":"List liquidity providers","tags":["Aggregator","Providers"]}}},"components":{"schemas":{"AggregatorInfoResponseDto":{"type":"object","properties":{"providers":{"description":"Active liquidity providers","type":"array","items":{"$ref":"#/components/schemas/AggregatorProviderDto"}},"totalProviders":{"type":"number","description":"Total number of providers in the response"},"aggregatedFrom":{"description":"Engine categories represented in the catalog","type":"array","items":{"type":"string"}},"breakdown":{"type":"object","description":"Count of providers per engine type"}},"required":["providers","totalProviders","aggregatedFrom","breakdown"]},"AggregatorProviderDto":{"type":"object","properties":{"id":{"type":"string","description":"Provider slug used in quote and swap requests"},"name":{"type":"string","description":"Display name of the provider"},"logoUrl":{"type":"object","description":"Provider logo URL","nullable":true},"engine":{"type":"string","description":"Swap engine for this provider","enum":["on-chain","off-chain","private"]},"status":{"type":"string","description":"Current operational status","enum":["active","inactive","maintenance"]},"kycLevel":{"type":"number","description":"KYC level inherited from the provider: 0 = No KYC, 1 = Rare KYC, 2 = Regular KYC","enum":[0,1,2]},"kycLevelName":{"type":"string","description":"KYC level display name"},"legal":{"description":"Provider legal documents (Terms of Use, etc.)","type":"array","items":{"$ref":"#/components/schemas/ProviderLegalDocumentDto"}},"description":{"type":"string","description":"Provider description for the public catalog"}},"required":["id","name","engine","status"]},"ProviderLegalDocumentDto":{"type":"object","properties":{"docName":{"type":"string","description":"Document title"},"docLink":{"type":"string","description":"Official document URL"}},"required":["docName","docLink"]}}}}
```


# Tokens

Token catalog with search and filters (`GET /v1/tokens`)

## List supported tokens

> Token catalog from the coins cache, sorted by internal popularity (not exposed on the item).\
> \
> \*\*Pagination:\*\* if \*\*neither\*\* \`limit\` nor \`offset\` is sent, the handler returns \*\*all\*\* matching tokens. The JSON still includes \`limit: 20\` and \`offset: 0\` in that case — those fields do not mean the list was sliced. If either \`limit\` or \`offset\` is sent, results are sliced (\`limit\` default 20, max 100).\
> \
> \- \`network\` — must equal \`GET /v1/chains\` → \`id\` (slug), case-insensitive. Aliases (\`ERC20\`, display names) are \*\*not\*\* accepted on this query. Unknown slug → empty list.\
> \- \`engine\` — \`cex\` keeps tokens with \`engineSupport\` containing \`off-chain\`; \`dex\` keeps \`on-chain\`. There is no \`private\` filter.\
> \- \`supportsFixedRate\` — boolean (\`true\`/\`1\` / \`false\`/\`0\`).\
> \- \`search\` — ranked match on ticker, name, contract address; extra terms can resolve a network alias inside the search string. Can be combined with \`network\`.

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"tags":[{"name":"Tokens","description":"Token catalog with search and filters (`GET /v1/tokens`)"}],"servers":[{"url":"https://api.yifi.io","description":"Production"},{"url":"https://api-dev.yifi.io","description":"Development / Staging"}],"paths":{"/v1/tokens":{"get":{"description":"Token catalog from the coins cache, sorted by internal popularity (not exposed on the item).\n\n**Pagination:** if **neither** `limit` nor `offset` is sent, the handler returns **all** matching tokens. The JSON still includes `limit: 20` and `offset: 0` in that case — those fields do not mean the list was sliced. If either `limit` or `offset` is sent, results are sliced (`limit` default 20, max 100).\n\n- `network` — must equal `GET /v1/chains` → `id` (slug), case-insensitive. Aliases (`ERC20`, display names) are **not** accepted on this query. Unknown slug → empty list.\n- `engine` — `cex` keeps tokens with `engineSupport` containing `off-chain`; `dex` keeps `on-chain`. There is no `private` filter.\n- `supportsFixedRate` — boolean (`true`/`1` / `false`/`0`).\n- `search` — ranked match on ticker, name, contract address; extra terms can resolve a network alias inside the search string. Can be combined with `network`.","operationId":"getTokens","parameters":[{"name":"search","required":false,"in":"query","description":"Search by ticker, name, contract address, or network alias inside the query string (e.g. `usdt trc`).","schema":{"type":"string"}},{"name":"network","required":false,"in":"query","description":"Filter by canonical chain **`id`** (slug) — must match `/v1/chains[].id` exactly ignoring case (e.g. `ETH`, `BTC`). Aliases such as `ERC20` or network names alone are **not** accepted here.","schema":{"type":"string"}},{"name":"supportsFixedRate","required":false,"in":"query","description":"Filter to tokens that support fixed-rate exchanges","schema":{"type":"boolean"}},{"name":"engine","required":false,"in":"query","description":"Filter by supported swap engine:\n\n- `cex` – off-chain CEX providers\n\n- `dex` – on-chain DEX aggregators","schema":{"type":"string","enum":["cex","dex"]}},{"name":"limit","required":false,"in":"query","description":"Page size (1–100). Applied only when `limit` or `offset` is present. If both are omitted, **all** matches are returned.","schema":{"minimum":1,"maximum":100,"type":"number"}},{"name":"offset","required":false,"in":"query","description":"Pagination offset. Applied only when `limit` or `offset` is present.","schema":{"minimum":0,"type":"number"}}],"responses":{"200":{"description":"Paginated token list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenListApiResponseDto"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}}},"summary":"List supported tokens","tags":["App","Tokens"]}}},"components":{"schemas":{"TokenListApiResponseDto":{"type":"object","properties":{"tokens":{"type":"array","items":{"$ref":"#/components/schemas/PublicTokenItemApiDto"}},"totalTokens":{"type":"number","description":"Number of token objects in this response page (matches `tokens.length`)"},"limit":{"type":"number","description":"Page size for this response"},"offset":{"type":"number","description":"Pagination offset"},"total":{"type":"number","description":"Total tokens matching filters before pagination"}},"required":["tokens","totalTokens","limit","offset","total"]},"PublicTokenItemApiDto":{"type":"object","properties":{"uuid":{"type":"string","description":"Internal coin UUID (used by workflows; not required on public query params)"},"network":{"type":"string","description":"Canonical chain slug (`GET /v1/chains` → `id`)"},"ticker":{"type":"string","description":"Token ticker"},"name":{"type":"string","description":"Display name"},"supportsFixedRate":{"type":"boolean","description":"Whether any catalogued route supports a fixed rate for this asset"},"contractAddress":{"type":"object","description":"Contract address; `null` for native coins","nullable":true},"engineSupport":{"description":"Engines that support this token: `on-chain` (DEX), `off-chain` (CEX), and sometimes `private`","type":"array","items":{"type":"string"}},"logoUrlCoin":{"type":"string","description":"Token logo URL"},"regexAddress":{"type":"string","description":"JavaScript regex source used to validate addresses of this asset (`receiveAddress` / `refundAddress` on swap)"},"explorerAddressUrl":{"type":"string","description":"Block-explorer URL template for an address"},"explorerTransactionUrl":{"type":"string","description":"Block-explorer URL template for a transaction"},"decimals":{"type":"object","nullable":true,"description":"Token decimals"},"logoUrlsNetwork":{"type":"object","nullable":true,"description":"Network / chain logo URL"},"coingeckoCoinId":{"type":"object","nullable":true,"description":"CoinGecko coin id (`bitcoin`, `ethereum`, `usd-coin`)"},"currentPriceUsd":{"type":"object","nullable":true,"description":"Spot price in USD from CoinGecko (numeric string)"}},"required":["uuid","network","ticker","name","supportsFixedRate","contractAddress"]}}}}
```


# Pairs

Exact pair metadata and counterpart-token search (`GET /v1/pairs`, `GET /v1/pairs/search`)

## Search available exchange pairs

> Returns metadata for \*\*one exact direction\*\*. All four query fields are required: \`fromToken\`, \`fromNetwork\`, \`toToken\`, \`toNetwork\`.\
> \
> Each pair includes \`availableEngines\` (\`on-chain\` / \`off-chain\` / \`private\`), provider slugs, \`minAmount\` and \`maxAmount\` (\`"0"\` when the catalog has no max).\
> \
> Unknown token/network combinations that still pass validation return \`{ tokenPairs: \[], totalPairs: 0 }\` (\`200\`), not \`404\`.\
> \
> Successful lookups are cached for 5 minutes. To list counterpart tokens for a single side, use \`GET /v1/pairs/search\`.

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"tags":[{"name":"Pairs","description":"Exact pair metadata and counterpart-token search (`GET /v1/pairs`, `GET /v1/pairs/search`)"}],"servers":[{"url":"https://api.yifi.io","description":"Production"},{"url":"https://api-dev.yifi.io","description":"Development / Staging"}],"paths":{"/v1/pairs":{"get":{"description":"Returns metadata for **one exact direction**. All four query fields are required: `fromToken`, `fromNetwork`, `toToken`, `toNetwork`.\n\nEach pair includes `availableEngines` (`on-chain` / `off-chain` / `private`), provider slugs, `minAmount` and `maxAmount` (`\"0\"` when the catalog has no max).\n\nUnknown token/network combinations that still pass validation return `{ tokenPairs: [], totalPairs: 0 }` (`200`), not `404`.\n\nSuccessful lookups are cached for 5 minutes. To list counterpart tokens for a single side, use `GET /v1/pairs/search`.","operationId":"getPairs","parameters":[{"name":"fromToken","required":true,"in":"query","description":"Source token ticker. Must be provided together with `fromNetwork`.","schema":{"type":"string"}},{"name":"fromNetwork","required":true,"in":"query","description":"Source chain slug (`GET /v1/chains` → `id`)","schema":{"type":"string"}},{"name":"toToken","required":true,"in":"query","description":"Target token ticker. Must be provided together with `toNetwork`.","schema":{"type":"string"}},{"name":"toNetwork","required":true,"in":"query","description":"Target chain slug (`GET /v1/chains` → `id`)","schema":{"type":"string"}}],"responses":{"200":{"description":"Matching token pairs (often 0 or 1) with engines and limits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenPairsResponseDto"}}}},"400":{"description":"Missing required field or unknown query parameter","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"408":{"description":"`WORKFLOW_TIMEOUT` (20s pair workflow)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"500":{"description":"`TOKEN_PAIRS_ERROR` or workflow failure","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}}},"summary":"Search available exchange pairs","tags":["Aggregator","Pairs"]}}},"components":{"schemas":{"TokenPairsResponseDto":{"type":"object","properties":{"tokenPairs":{"description":"List of token pairs","type":"array","items":{"$ref":"#/components/schemas/TokenPairDto"}},"totalPairs":{"type":"number","description":"Total number of token pairs found"}},"required":["tokenPairs","totalPairs"]},"TokenPairDto":{"type":"object","properties":{"fromToken":{"type":"string","description":"Source token ticker"},"fromNetwork":{"type":"string","description":"Source chain slug"},"toToken":{"type":"string","description":"Target token ticker"},"toNetwork":{"type":"string","description":"Target chain slug"},"availableEngines":{"description":"Available engines for this pair","type":"array","items":{"type":"string"}},"providers":{"description":"Provider IDs supporting this pair","type":"array","items":{"type":"string"}},"minAmount":{"type":"string","description":"Minimum exchange amount"},"maxAmount":{"type":"string","description":"Maximum exchange amount"}},"required":["fromToken","fromNetwork","toToken","toNetwork","availableEngines","providers","minAmount","maxAmount"]}}}}
```

## Search available counterpart tokens for a pair

> Paginated counterpart tokens for building a pair picker. Response shape matches \`GET /v1/tokens\`.\
> \
> \*\*How filters are applied (no 400 for a lone ticker/network):\*\*\
> \
> \- \`fromToken\` \*\*and\*\* \`fromNetwork\` both set → tokens you can \*\*receive\*\* (the \`to\` side of catalog pairs). Optional \`toNetwork\` further restricts those counterparts.\
> \- \`toToken\` \*\*and\*\* \`toNetwork\` both set → tokens you can \*\*send\*\* (the \`from\` side). Optional \`fromNetwork\` further restricts those counterparts.\
> \- Only one side of a pair (\`fromToken\` without \`fromNetwork\`, etc.) is treated as \*\*not set\*\*.\
> \- \*\*Neither complete side\*\* → the counterpart set is empty (\`tokens: \[]\`, \`total: 0\`). This endpoint does \*\*not\*\* dump the full catalog.\
> \
> \`search\` ranks within the counterpart set (ticker / name / address). Default page: \`limit=20\`, \`offset=0\`. Coin-set cache TTL: 5 minutes.

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"tags":[{"name":"Pairs","description":"Exact pair metadata and counterpart-token search (`GET /v1/pairs`, `GET /v1/pairs/search`)"}],"servers":[{"url":"https://api.yifi.io","description":"Production"},{"url":"https://api-dev.yifi.io","description":"Development / Staging"}],"paths":{"/v1/pairs/search":{"get":{"description":"Paginated counterpart tokens for building a pair picker. Response shape matches `GET /v1/tokens`.\n\n**How filters are applied (no 400 for a lone ticker/network):**\n\n- `fromToken` **and** `fromNetwork` both set → tokens you can **receive** (the `to` side of catalog pairs). Optional `toNetwork` further restricts those counterparts.\n- `toToken` **and** `toNetwork` both set → tokens you can **send** (the `from` side). Optional `fromNetwork` further restricts those counterparts.\n- Only one side of a pair (`fromToken` without `fromNetwork`, etc.) is treated as **not set**.\n- **Neither complete side** → the counterpart set is empty (`tokens: []`, `total: 0`). This endpoint does **not** dump the full catalog.\n\n`search` ranks within the counterpart set (ticker / name / address). Default page: `limit=20`, `offset=0`. Coin-set cache TTL: 5 minutes.","operationId":"searchPairs","parameters":[{"name":"fromToken","required":false,"in":"query","description":"Source token ticker. Used only when `fromNetwork` is also set; otherwise ignored.","schema":{"type":"string"}},{"name":"fromNetwork","required":false,"in":"query","description":"Source chain slug. Used only when `fromToken` is also set; otherwise ignored.","schema":{"type":"string"}},{"name":"toToken","required":false,"in":"query","description":"Target token ticker. Used only when `toNetwork` is also set; otherwise ignored.","schema":{"type":"string"}},{"name":"toNetwork","required":false,"in":"query","description":"Target chain slug. Used only when `toToken` is also set; otherwise ignored.","schema":{"type":"string"}},{"name":"search","required":false,"in":"query","description":"Search by ticker or token name within the results","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Number of results per page. Maximum 100.","schema":{"minimum":1,"maximum":100,"default":20,"type":"number"}},{"name":"offset","required":false,"in":"query","description":"Pagination offset","schema":{"minimum":0,"default":0,"type":"number"}}],"responses":{"200":{"description":"Paginated counterpart tokens","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenListApiResponseDto"}}}},"400":{"description":"Invalid pagination or unknown query parameter","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"408":{"description":"`WORKFLOW_TIMEOUT` (20s pair workflow)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"500":{"description":"`TOKEN_PAIRS_ERROR` or workflow failure","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}}},"summary":"Search available counterpart tokens for a pair","tags":["Aggregator","Pairs"]}}},"components":{"schemas":{"TokenListApiResponseDto":{"type":"object","properties":{"tokens":{"type":"array","items":{"$ref":"#/components/schemas/PublicTokenItemApiDto"}},"totalTokens":{"type":"number","description":"Number of token objects in this response page (matches `tokens.length`)"},"limit":{"type":"number","description":"Page size for this response"},"offset":{"type":"number","description":"Pagination offset"},"total":{"type":"number","description":"Total tokens matching filters before pagination"}},"required":["tokens","totalTokens","limit","offset","total"]},"PublicTokenItemApiDto":{"type":"object","properties":{"uuid":{"type":"string","description":"Internal coin UUID (used by workflows; not required on public query params)"},"network":{"type":"string","description":"Canonical chain slug (`GET /v1/chains` → `id`)"},"ticker":{"type":"string","description":"Token ticker"},"name":{"type":"string","description":"Display name"},"supportsFixedRate":{"type":"boolean","description":"Whether any catalogued route supports a fixed rate for this asset"},"contractAddress":{"type":"object","description":"Contract address; `null` for native coins","nullable":true},"engineSupport":{"description":"Engines that support this token: `on-chain` (DEX), `off-chain` (CEX), and sometimes `private`","type":"array","items":{"type":"string"}},"logoUrlCoin":{"type":"string","description":"Token logo URL"},"regexAddress":{"type":"string","description":"JavaScript regex source used to validate addresses of this asset (`receiveAddress` / `refundAddress` on swap)"},"explorerAddressUrl":{"type":"string","description":"Block-explorer URL template for an address"},"explorerTransactionUrl":{"type":"string","description":"Block-explorer URL template for a transaction"},"decimals":{"type":"object","nullable":true,"description":"Token decimals"},"logoUrlsNetwork":{"type":"object","nullable":true,"description":"Network / chain logo URL"},"coingeckoCoinId":{"type":"object","nullable":true,"description":"CoinGecko coin id (`bitcoin`, `ethereum`, `usd-coin`)"},"currentPriceUsd":{"type":"object","nullable":true,"description":"Spot price in USD from CoinGecko (numeric string)"}},"required":["uuid","network","ticker","name","supportsFixedRate","contractAddress"]}}}}
```


# Quote

Live rates across CEX, DEX and private routes (`GET /v1/quote`)

## Get swap quote

> Returns live quotes for a token pair and amount.\
> \
> \*\*Response shape\*\*\
> \
> \- \`bestQuote\` — array with \*\*one\*\* item (the winner) or \`\[]\` when nothing is available.\
> \- \`allQuotes\` — remaining quotes. When \`sort\` is not \`fastest\`, private v1/v2 winners that were not the global best are placed first; the rest stay in source order after ranking.\
> \
> \*\*\`type\` (engine filter)\*\* — comma-separated, case-insensitive. Default \*\*\`cex\`\*\*.\
> \
> \- \`cex\` — CEX / off-chain providers (\`getRatesForPairWorkflow\` on the CEX queue)\
> \- \`dex\` — DEX aggregators (started only when the DEX task queue is configured)\
> \- \`private\` — two-rail private routes (\`getPrivateQuoteWorkflow\`; intermediary token is not disclosed)\
> \- \`all\` — CEX + DEX + private\
> \- combinations such as \`cex,dex\` or \`cex,dex,private\`\
> \
> \*\*Ranking (\`sort\`)\*\*\
> \
> \- \`best\` \*(default)\* — highest \`rate\`; \`bestQuote\[0].label\` is \`"best price"\`\
> \- \`fastest\` — lowest parsed \`estimatedTime\`; label is \`"fastest"\`\
> \- \`noKyc\` — CEX/DEX quotes with \`kycLevel === 0\` only, then ranked by rate. Aliases: \`nokyc\`, \`no-kyc\`, \`no\_kyc\`\
> \
> \*\*Other filters\*\*\
> \
> \- \`xmrOnly=true\` — keep only private \`version=v1\` (XMR hop). Ignored when \`type\` does not include private.\
> \- \`excludeProviders\` — comma-separated slugs; CEX/DEX will not request those providers.\
> \- \`slippage\` — percent \`0.1–1\`, default \`0.5\` when omitted (applied on the server before workflows).\
> \- \`addressFrom\` / \`addressTo\` — forwarded to CEX/DEX quote workflows for providers that need them.\
> \
> Each quote gets a fresh \`rateId\` (UUID) stored in Redis for \*\*5 minutes\*\*. Pass it as \`rateId\` on \`POST /v1/swap\`. The HTTP response itself is cached for \*\*30 seconds\*\*; \`rateId\` values are still regenerated on every call.\
> \
> Unknown tickers/networks → \`404\` \`COIN\_NOT\_FOUND\`. No successful quotes after filtering → \`404\` \`NO\_QUOTES\_AVAILABLE\`. If every source times out with no quotes, the handler returns \`{ bestQuote: \[], allQuotes: \[] }\` (\`200\`) instead of \`408\`.

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"tags":[{"name":"Quote","description":"Live rates across CEX, DEX and private routes (`GET /v1/quote`)"}],"servers":[{"url":"https://api.yifi.io","description":"Production"},{"url":"https://api-dev.yifi.io","description":"Development / Staging"}],"paths":{"/v1/quote":{"get":{"description":"Returns live quotes for a token pair and amount.\n\n**Response shape**\n\n- `bestQuote` — array with **one** item (the winner) or `[]` when nothing is available.\n- `allQuotes` — remaining quotes. When `sort` is not `fastest`, private v1/v2 winners that were not the global best are placed first; the rest stay in source order after ranking.\n\n**`type` (engine filter)** — comma-separated, case-insensitive. Default **`cex`**.\n\n- `cex` — CEX / off-chain providers (`getRatesForPairWorkflow` on the CEX queue)\n- `dex` — DEX aggregators (started only when the DEX task queue is configured)\n- `private` — two-rail private routes (`getPrivateQuoteWorkflow`; intermediary token is not disclosed)\n- `all` — CEX + DEX + private\n- combinations such as `cex,dex` or `cex,dex,private`\n\n**Ranking (`sort`)**\n\n- `best` *(default)* — highest `rate`; `bestQuote[0].label` is `\"best price\"`\n- `fastest` — lowest parsed `estimatedTime`; label is `\"fastest\"`\n- `noKyc` — CEX/DEX quotes with `kycLevel === 0` only, then ranked by rate. Aliases: `nokyc`, `no-kyc`, `no_kyc`\n\n**Other filters**\n\n- `xmrOnly=true` — keep only private `version=v1` (XMR hop). Ignored when `type` does not include private.\n- `excludeProviders` — comma-separated slugs; CEX/DEX will not request those providers.\n- `slippage` — percent `0.1–1`, default `0.5` when omitted (applied on the server before workflows).\n- `addressFrom` / `addressTo` — forwarded to CEX/DEX quote workflows for providers that need them.\n\nEach quote gets a fresh `rateId` (UUID) stored in Redis for **5 minutes**. Pass it as `rateId` on `POST /v1/swap`. The HTTP response itself is cached for **30 seconds**; `rateId` values are still regenerated on every call.\n\nUnknown tickers/networks → `404` `COIN_NOT_FOUND`. No successful quotes after filtering → `404` `NO_QUOTES_AVAILABLE`. If every source times out with no quotes, the handler returns `{ bestQuote: [], allQuotes: [] }` (`200`) instead of `408`.","operationId":"getQuote","parameters":[{"name":"tickerFrom","required":true,"in":"query","description":"Source token ticker","schema":{"type":"string"}},{"name":"networkFrom","required":true,"in":"query","description":"Source chain **`id`** — must match `/v1/chains[].id` (canonical slug, case-insensitive). Required.","schema":{"type":"string"}},{"name":"tickerTo","required":true,"in":"query","description":"Target token ticker","schema":{"type":"string"}},{"name":"networkTo","required":true,"in":"query","description":"Target chain **`id`** — must match `/v1/chains[].id` (canonical slug, case-insensitive). Required.","schema":{"type":"string"}},{"name":"amount","required":true,"in":"query","description":"Amount to exchange in source token units. Minimum `0.00000001`.","schema":{"minimum":1e-8,"type":"number"}},{"name":"type","required":false,"in":"query","description":"Engine filter. Default `cex`. Values: `cex`, `dex`, `private`, `all`, or comma-separated combinations (`cex,dex`). Case-insensitive.","schema":{"type":"string"}},{"name":"slippage","required":false,"in":"query","description":"Slippage tolerance in percent. Range `0.1–1`. Default `0.5`.","schema":{"default":0.5,"type":"number"}},{"name":"addressFrom","required":false,"in":"query","description":"Sender wallet address for providers that require it in quote requests.","schema":{"type":"string"}},{"name":"addressTo","required":false,"in":"query","description":"Recipient wallet address for providers that require it in quote requests.","schema":{"type":"string"}},{"name":"xmrOnly","required":false,"in":"query","description":"If true, only private v1 (XMR hop) quotes are returned. Ignored when `type` does not include private.","schema":{"default":false,"type":"boolean"}},{"name":"sort","required":false,"in":"query","description":"Quote ranking: `best` (highest rate), `fastest` (lowest estimated time), `noKyc` (kycLevel 0 only, then by rate). Default `best`.","schema":{"default":"best","type":"string","enum":["best","fastest","noKyc"]}},{"name":"excludeProviders","required":false,"in":"query","description":"Comma-separated provider slugs to skip. CEX/DEX will not request rates from these providers.","schema":{"type":"array","items":{"type":"string"}}}],"responses":{"200":{"description":"Best quote (0–1 items) and remaining provider quotes. Empty arrays when no source returned a quote (including global timeout).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteResponseDto"}}}},"400":{"description":"`INVALID_PARAMS` / `INVALID_AMOUNT` or class-validator errors (missing tickers/networks, amount ≤ 0, slippage out of range, unknown query fields)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"404":{"description":"`COIN_NOT_FOUND`, `NO_SOURCES_AVAILABLE`, or `NO_QUOTES_AVAILABLE`","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"500":{"description":"`WORKFLOW_EXECUTION_ERROR` when sources fail with errors","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}}},"summary":"Get swap quote","tags":["Aggregator","Quote"]}}},"components":{"schemas":{"QuoteResponseDto":{"type":"object","properties":{"bestQuote":{"description":"Best quote across all sources – array with a single element (or empty if no quotes are available).","type":"array","items":{"$ref":"#/components/schemas/QuoteItemDto"}},"allQuotes":{"description":"Remaining quotes. Private best v1 and v2 (when present and not picked as the global best) are placed first, then other quotes sorted by `rate` descending.","type":"array","items":{"$ref":"#/components/schemas/QuoteItemDto"}}},"required":["bestQuote","allQuotes"]},"QuoteItemDto":{"type":"object","properties":{"rateId":{"type":"string","description":"Internal rate ID. Pass this in `rateId` to `/v1/swap` to record exactly which quote the user saw. Snapshot is kept in cache for 5 minutes."},"engine":{"type":"string","description":"Swap engine used for this quote","enum":["on-chain","off-chain","private"]},"provider":{"type":"string","description":"Provider slug – use this value in the `provider` field when calling `/v1/swap`"},"exchangerName":{"type":"string","description":"Display name of the provider"},"logoUrl":{"type":"string","description":"Provider logo URL. May be absent for some providers."},"rate":{"type":"string","description":"Exchange rate expressed as output per 1 unit of input token"},"estimatedOutput":{"type":"string","description":"Estimated amount the recipient will receive after all fees"},"inUsdValue":{"type":"number","description":"USD equivalent of the IN amount. Rate is taken from the etalon provider to USDT (TRON, then ETH, then BSC), with a fallback to a quote provider if the etalon is unavailable. `null` when the rate cannot be fetched.","nullable":true},"inUsdRateError":{"type":"string","description":"Set to `\"Can't fetch USD-rate\"` when the IN USD rate cannot be fetched. The quote itself is still returned.","nullable":true},"outUsdValue":{"type":"number","description":"USD equivalent of `estimatedOutput`. Rate is taken from this quote’s provider to USDT (TRON, then ETH, then BSC). `null` when unavailable (including private routes).","nullable":true},"outUsdDeviationPercent":{"type":"number","description":"Percent deviation of `outUsdValue` from `inUsdValue`. Negative means the user receives fewer USD than they sent.","nullable":true},"fromTokenUsdtRate":{"type":"number","description":"Raw USDT rate of 1 IN token. Taken from the etalon provider (USDT TRON → ETH → BSC), with a fallback to a quote provider if the etalon is unavailable. `null` when the IN USD rate cannot be fetched.","nullable":true},"toTokenUsdtRate":{"type":"number","description":"Raw USDT rate of 1 OUT token via this quote’s provider (USDT TRON → ETH → BSC). `null` when unavailable (including private routes).","nullable":true},"rateReversed":{"type":"number","description":"Inverse of `rate`: 1 OUT coin = Y IN coin"},"quoteId":{"type":"string","description":"Quote ID from the provider. Pass this in `quoteId` when calling `/v1/swap` to lock in the rate. `null` for providers that do not support rate locking."},"gasEstimated":{"type":"string","description":"Estimated gas cost in native token units. Present for DEX routes only. `null` for CEX and private routes."},"protocolFee":{"type":"string","description":"Protocol-level fee amount. Present for some DEX routes only."},"providerFee":{"type":"string","description":"Provider-level fee on top of the protocol fee. Present for some DEX routes only."},"slippageTolerance":{"type":"string","description":"Slippage tolerance applied to this quote in percent. Present for DEX routes only."},"estimatedTime":{"type":"string","description":"Expected time to complete the swap via this provider"},"kycLevel":{"type":"number","description":"KYC level inherited from the provider: 0 = No KYC, 1 = Rare KYC, 2 = Regular KYC","enum":[0,1,2]},"kycLevelName":{"type":"string","description":"KYC level display name inherited from the provider"},"legal":{"description":"Provider legal documents (Terms of Use, etc.) inherited from the provider","type":"array","items":{"$ref":"#/components/schemas/ProviderLegalDocumentDto"}},"label":{"type":"string","description":"Label assigned to the best quote (e.g. `\"best price\"`). `null` for all other quotes in `allQuotes`."},"dataForSign":{"type":"object","description":"EIP-712 typed data for client-side signing. Present only for CoW Swap DEX routes."},"schemeSign":{"type":"string","description":"Signing scheme identifier. Present only for CoW Swap routes. Always `\"eip712\"`."},"version":{"type":"string","description":"Private route version: v1 — Monero intermediate hop; v2 — stablecoin / non-XMR. Only when engine=private.","enum":["v1","v2"]},"routeKind":{"type":"string","description":"Private route shape: `direct` is one Quickex private swap; `two_leg` is the deposit+withdraw hop. Only when engine=private. `version` stays v1 or v2.","enum":["direct","two_leg"]}},"required":["rateId","engine","provider","exchangerName","rate","estimatedOutput","inUsdValue","inUsdRateError","outUsdValue","outUsdDeviationPercent","fromTokenUsdtRate","toTokenUsdtRate","rateReversed","estimatedTime"]},"ProviderLegalDocumentDto":{"type":"object","properties":{"docName":{"type":"string","description":"Document title"},"docLink":{"type":"string","description":"Official document URL"}},"required":["docName","docLink"]}}}}
```


# Swap

Create a swap order (`POST /v1/swap`)

## Create a swap order

> Creates an order with the chosen provider. \*\*No JWT is required.\*\* Optional header \`x-api-key-partner\` attributes the order to a partner; an invalid key returns \`401\` \`INVALID\_API\_KEY\`.\
> \
> NestJS default status for this \`POST\` is \*\*\`201 Created\`\*\*.\
> \
> \*\*\`engine\`\*\* (must be one of \`cex\` | \`dex\` | \`private\`):\
> \
> \- \`cex\` — off-chain. Send funds to \`depositAddress\` (memo: \`extraIdDeposit\` when present).\
> \- \`dex\` — on-chain. \`depositAddress\` is typically \`null\`; follow \`txCreateMeta\` / provider payload.\
> \- \`private\` — two-rail. \*\*No Bearer token is checked.\*\* Send funds to \`depositAddress\`. \`quoteId\` is passed to the private workflow as \`routeId\`.\
> \
> \*\*Rate snapshot (\`rateId\`)\*\* — UUID from \`GET /v1/quote\`. If sent:\
> \
> \- missing/expired snapshot → \`400\` \`RATE\_EXPIRED\` (TTL 5 minutes)\
> \- provider / coin UUIDs / amount do not match the snapshot → \`400\` \`RATE\_MISMATCH\` (\`error.details\` lists expected vs received)\
> \
> \`quoteId\` is the \*\*provider\*\* quote id (rate lock) and is independent of \`rateId\`.\
> \
> \`receiveAddress\` is validated against the destination token \`regexAddress\` when the catalog has one (\`INVALID\_RECEIVE\_ADDRESS\`). \`refundAddress\` is validated against the source token (\`INVALID\_REFUND\_ADDRESS\`).\
> \
> \`addressFrom\` is accepted for backward compatibility and \*\*ignored\*\*.\
> \
> \`transactionId\` in the response is the \*\*YiFi UUID\*\* stored in admin-service (use it on \`GET /v1/transactions/{id}\`). \`externalTransactionId\` is the provider id when it differs. \`accessToken\` is issued once — store it client-side.

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"tags":[{"name":"Swap","description":"Create a swap order (`POST /v1/swap`)"}],"servers":[{"url":"https://api.yifi.io","description":"Production"},{"url":"https://api-dev.yifi.io","description":"Development / Staging"}],"security":[{"partnerApiKey":[]}],"components":{"securitySchemes":{"partnerApiKey":{"type":"apiKey","in":"header","name":"x-api-key-partner","description":"Optional partner API key on POST /v1/swap. Invalid key → 401. Omitted → anonymous swap."}},"schemas":{"CreateSwapDto":{"type":"object","properties":{"provider":{"type":"string","description":"Provider slug from the chosen quote's `provider` field"},"fromToken":{"type":"string","description":"Source token ticker"},"fromNetwork":{"type":"string","description":"Source chain slug — same as `GET /v1/chains` → `id` (case-insensitive)"},"toToken":{"type":"string","description":"Target token ticker"},"toNetwork":{"type":"string","description":"Target chain slug — same as `GET /v1/chains` → `id` (case-insensitive)"},"engine":{"type":"string","description":"Swap engine to use. Must match the engine from the selected quote.\n\n- `cex` – off-chain CEX swap\n\n- `dex` – on-chain DEX swap\n\n- `private` – two-rail private swap (no JWT required on this API)","enum":["cex","dex","private"]},"amount":{"type":"number","description":"Amount to exchange in source token units","minimum":1e-8},"quoteId":{"type":"string","description":"Quote ID from `/v1/quote`. Locks in the rate with providers that support it."},"rateId":{"type":"string","description":"Internal rate ID from `/v1/quote` response. Use to record the exact quote shown to the user in the transaction history. The snapshot expires 5 minutes after the quote was issued. If you pass an expired or unknown ID the request will be rejected with `RATE_EXPIRED`."},"receiveAddress":{"type":"string","description":"Destination wallet address for the output token"},"addressFrom":{"type":"string","description":"Legacy field. Accepted (not rejected by validation) but **not used** by `createSwap`."},"slippageTolerance":{"type":"string","description":"Slippage tolerance in percent. Default `\"0.5\"`. **Applies to DEX routes only** (`engine=dex`). Ignored for CEX and private.","default":"0.5"},"extraIdTo":{"type":"string","description":"Memo / tag for the destination address. Required for tokens that need it (e.g. XRP, XLM, TON)."},"refundAddress":{"type":"string","description":"Address to receive a refund if the swap fails. Recommended when the chosen provider or route requires it — follow provider documentation and support guidance. Strongly recommended for private swaps."},"refundExtraId":{"type":"string","description":"Memo / tag for the refund address, if required by the source network"},"ref":{"type":"string","description":"Partner affiliate referral code (alias of `refCode`). Optional: without a code the swap is created as usual. Attributes the swap to the partner via their affiliate referral node."},"refCode":{"type":"string","description":"Partner affiliate referral code. Attributes the swap to the partner via their affiliate referral node. Optional. If both `ref` and `refCode` are sent, `ref` wins. An unknown code is rejected with `REFERRAL_CODE_NOT_FOUND`."}},"required":["provider","fromToken","fromNetwork","toToken","toNetwork","engine","amount","receiveAddress"]},"SwapResponseDto":{"type":"object","properties":{"fromToken":{"type":"string","description":"Source token ticker"},"fromNetwork":{"type":"string","description":"Source chain slug as sent in the request"},"toToken":{"type":"string","description":"Target token ticker"},"toNetwork":{"type":"string","description":"Target chain slug as sent in the request"},"provider":{"type":"string","description":"Provider slug executing this swap"},"transactionId":{"type":"string","description":"YiFi transaction ID. Use this to poll `/v1/transactions/{id}` for status updates."},"accessToken":{"type":"string","description":"Issued once at swap creation. Store securely client-side (used for private flows and client-side transaction operations)."},"externalTransactionId":{"type":"string","description":"Provider-side transaction id when it differs from the YiFi UUID in `transactionId`."},"status":{"type":"string","description":"Initial swap status – always `pending` at the moment of creation","enum":["pending","processing","completed","failed"]},"statusList":{"type":"object","description":"Granular step-by-step status map. All values are `false` at creation. Keys vary by provider and engine."},"receiveAmount":{"type":"string","description":"Expected output amount the recipient will receive"},"expirationTime":{"type":"object","description":"Order expiration from provider response (JSON path configured as expirationTimePath on create-exchange endpoint)","nullable":true},"estimatedOutput":{"type":"string","description":"Legacy: expected output amount (prefer `receiveAmount`)"},"estimatedTime":{"type":"string","description":"Expected time to complete the swap"},"depositAddress":{"type":"object","description":"Address to send source funds to. Present for CEX and private routes. `null` for DEX routes where funds are pulled via smart contract.","nullable":true},"extraIdTo":{"type":"string","description":"Memo / tag for the destination address, if required"},"refundAddress":{"type":"string","description":"Address that will receive funds if the swap fails"},"refundExtraId":{"type":"string","description":"Memo / tag for the refund address, if required"},"txCreateMeta":{"type":"object","description":"Raw transaction metadata returned by the provider at creation (e.g. `hash`, `nonce`). May be a JSON string.","nullable":true},"extraIdDeposit":{"type":"string","description":"Memo / tag for the deposit address, if required by the source network"},"tokenForTx":{"type":"string","description":"Ticker of the token as returned by the provider's internal `createExchange` response. May differ from `fromToken` in multi-hop DEX routes."}},"required":["fromToken","fromNetwork","toToken","toNetwork","provider","transactionId","accessToken","status","receiveAmount","estimatedTime"]}}},"paths":{"/v1/swap":{"post":{"description":"Creates an order with the chosen provider. **No JWT is required.** Optional header `x-api-key-partner` attributes the order to a partner; an invalid key returns `401` `INVALID_API_KEY`.\n\nNestJS default status for this `POST` is **`201 Created`**.\n\n**`engine`** (must be one of `cex` | `dex` | `private`):\n\n- `cex` — off-chain. Send funds to `depositAddress` (memo: `extraIdDeposit` when present).\n- `dex` — on-chain. `depositAddress` is typically `null`; follow `txCreateMeta` / provider payload.\n- `private` — two-rail. **No Bearer token is checked.** Send funds to `depositAddress`. `quoteId` is passed to the private workflow as `routeId`.\n\n**Rate snapshot (`rateId`)** — UUID from `GET /v1/quote`. If sent:\n\n- missing/expired snapshot → `400` `RATE_EXPIRED` (TTL 5 minutes)\n- provider / coin UUIDs / amount do not match the snapshot → `400` `RATE_MISMATCH` (`error.details` lists expected vs received)\n\n`quoteId` is the **provider** quote id (rate lock) and is independent of `rateId`.\n\n`receiveAddress` is validated against the destination token `regexAddress` when the catalog has one (`INVALID_RECEIVE_ADDRESS`). `refundAddress` is validated against the source token (`INVALID_REFUND_ADDRESS`).\n\n`addressFrom` is accepted for backward compatibility and **ignored**.\n\n`transactionId` in the response is the **YiFi UUID** stored in admin-service (use it on `GET /v1/transactions/{id}`). `externalTransactionId` is the provider id when it differs. `accessToken` is issued once — store it client-side.","operationId":"createSwap","parameters":[],"requestBody":{"required":true,"description":"Create swap request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSwapDto"}}}},"responses":{"201":{"description":"Order created (YiFi UUID + access token + deposit details)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwapResponseDto"}}}},"400":{"description":"Validation error, `RATE_EXPIRED`, `RATE_MISMATCH`, `INVALID_RECEIVE_ADDRESS`, or `INVALID_REFUND_ADDRESS`","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"401":{"description":"Header `x-api-key-partner` was sent but the key is invalid (`INVALID_API_KEY`)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"404":{"description":"`COIN_NOT_FOUND` or `PROVIDER_NOT_FOUND` (CEX/DEX only)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"408":{"description":"`WORKFLOW_TIMEOUT` (50s create-swap workflow)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"500":{"description":"`SWAP_ERROR`, `CREATE_TRANSACTION_FAILED`, or missing DEX/private task queue","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}}},"summary":"Create a swap order","tags":["Aggregator","Swap"]}}}}
```


# Transactions

Poll status and submit an on-chain deposit hash

## Get transaction status

> Returns the current status of an order created via \`POST /v1/swap\`.\
> \
> \`id\` is the \*\*YiFi UUID\*\* from \`transactionId\` in the create-swap response. A provider order id is not accepted and returns \`404\` \`TRANSACTION\_NOT\_FOUND\`. Empty / whitespace \`id\` → \`400\` \`INVALID\_TRANSACTION\_UUID\`.\
> \
> Token fields are expanded to objects (\`ticker\`, \`network\`, logos, \`contractAddress\`, \`chainId\`, \`decimals\`). \`inputAmount\` is the stored deposit amount. \`exchangeRate\` is \`receiveAmount / inputAmount\` when both parse as numbers and input > 0; otherwise \`null\`.\
> \
> \`fee\` from storage is \*\*not\*\* returned. Extra workflow fields that are returned when present: \`txDepositHash\`, \`txOutputHash\`, \`depositAddress\`, \`receiveAddress\`, \`statusList\`.\
> \
> There is \*\*no\*\* \`access\_token\` query on this public route when \`id\` is a YiFi UUID (unlike api-gateway).\
> \
> \*\*Top-level \`status\`:\*\* \`pending\` → \`processing\` → \`completed\`, or \`failed\` / \`cancelled\`. \`statusList\` keys are provider-specific booleans.

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"tags":[{"name":"Transactions","description":"Poll status and submit an on-chain deposit hash"}],"servers":[{"url":"https://api.yifi.io","description":"Production"},{"url":"https://api-dev.yifi.io","description":"Development / Staging"}],"paths":{"/v1/transactions/{id}":{"get":{"description":"Returns the current status of an order created via `POST /v1/swap`.\n\n`id` is the **YiFi UUID** from `transactionId` in the create-swap response. A provider order id is not accepted and returns `404` `TRANSACTION_NOT_FOUND`. Empty / whitespace `id` → `400` `INVALID_TRANSACTION_UUID`.\n\nToken fields are expanded to objects (`ticker`, `network`, logos, `contractAddress`, `chainId`, `decimals`). `inputAmount` is the stored deposit amount. `exchangeRate` is `receiveAmount / inputAmount` when both parse as numbers and input > 0; otherwise `null`.\n\n`fee` from storage is **not** returned. Extra workflow fields that are returned when present: `txDepositHash`, `txOutputHash`, `depositAddress`, `receiveAddress`, `statusList`.\n\nThere is **no** `access_token` query on this public route when `id` is a YiFi UUID (unlike api-gateway).\n\n**Top-level `status`:** `pending` → `processing` → `completed`, or `failed` / `cancelled`. `statusList` keys are provider-specific booleans.","operationId":"getTransactionStatus","parameters":[{"name":"id","required":true,"in":"path","description":"YiFi transaction UUID from `POST /v1/swap` → `transactionId`. Provider order ids are rejected.","schema":{"type":"string"}}],"responses":{"200":{"description":"Transaction details and current status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionStatusResponseDto"}}}},"400":{"description":"`INVALID_TRANSACTION_UUID` (empty id)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"404":{"description":"`TRANSACTION_NOT_FOUND`","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"408":{"description":"`WORKFLOW_TIMEOUT` (30s)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"500":{"description":"`INCOMPLETE_TRANSACTION_DATA` or `TRANSACTION_STATUS_ERROR`","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}}},"summary":"Get transaction status","tags":["App","Transactions"]}}},"components":{"schemas":{"TransactionStatusResponseDto":{"type":"object","properties":{"uuid":{"type":"string","description":"YiFi UUID. Same value as `POST /v1/swap` → `transactionId` and as the path `{id}` you queried."},"transactionId":{"type":"string","description":"Provider-side transaction id (may differ from `uuid`)"},"status":{"type":"string","description":"Current top-level swap status","enum":["pending","processing","completed","failed","cancelled"]},"statusList":{"type":"object","description":"Granular step-by-step status map. Keys vary by provider and engine."},"engine":{"type":"string","description":"Swap engine used for this transaction","enum":["on-chain","off-chain","private"]},"provider":{"type":"string","description":"Provider slug executing this swap"},"logoProvider":{"type":"object","description":"Provider logo URL"},"fromToken":{"description":"Source token details","allOf":[{"$ref":"#/components/schemas/TransactionTokenDto"}]},"toToken":{"description":"Target token details","allOf":[{"$ref":"#/components/schemas/TransactionTokenDto"}]},"inputAmount":{"type":"string","description":"Amount sent by the user in source token units"},"receiveAmount":{"type":"string","description":"Amount received (or expected) in target token units"},"startTime":{"type":"string","description":"Timestamp when the transaction was created"},"completionTime":{"type":"string","description":"Timestamp when the transaction reached a terminal state (`completed`, `failed`, or `cancelled`). `null` while in progress."},"exchangeRate":{"type":"object","description":"Effective exchange rate (`receiveAmount / inputAmount`). Populated once the swap reaches `completed` status.","nullable":true},"expirationTime":{"type":"object","description":"Order expiration captured at swap creation (same as in create-swap response; mapped via exchanger expirationTimePath)","nullable":true},"txCreateMeta":{"type":"object","description":"Raw provider metadata from transaction creation. May be an empty object or JSON string."},"txDepositHash":{"type":"object","description":"On-chain deposit hash once known. `null` / omitted while waiting.","nullable":true},"txOutputHash":{"type":"object","description":"On-chain output / payout hash once known. `null` / omitted while waiting.","nullable":true},"depositAddress":{"type":"object","description":"Deposit address the user must send to (CEX / private)","nullable":true},"receiveAddress":{"type":"object","description":"Destination address that receives the output token","nullable":true}},"required":["uuid","transactionId","status","engine","provider","fromToken","toToken","inputAmount","receiveAmount"]},"TransactionTokenDto":{"type":"object","properties":{"ticker":{"type":"string","description":"Token ticker"},"network":{"type":"string","description":"Chain slug"},"logoTicker":{"type":"object","description":"Token logo URL or structured logo payload. May be an empty object `{}` while not loaded."},"logoNetwork":{"type":"object","description":"Network logo URL or structured logo payload. May be an empty object `{}` while not loaded."},"contractAddress":{"type":"object","description":"Token contract address (null for native coins)","nullable":true},"chainId":{"type":"object","description":"EVM chainId of the network (null when unknown or non-EVM)","nullable":true},"decimals":{"type":"object","description":"Token decimals","nullable":true}},"required":["ticker","network"]}}}}
```

## Submit deposit transaction hash

> Forwards \`{ from, to, hash }\` to \`setDepositHashWorkflow\` after the user broadcasts a \*\*DEX\*\* deposit.\
> \
> Query \`access\_token\` is required (the secret from \`POST /v1/swap\`). Missing token → \`400\` \`ACCESS\_TOKEN\_REQUIRED\` without an order lookup.\
> \
> \`transactionProvider\` is the provider order id passed to the workflow as \`transactionId\`.\
> \
> \`engine\` is case-insensitive and must be \`dex\`. \`cex\` and \`private\` → \`400\` \`INVALID\_ENGINE\` and the workflow is not started.\
> \
> The hash is stored once. The same hash returns \`true\` without rewriting. A different hash → \`409\` \`DEPOSIT\_HASH\_ALREADY\_SET\`.\
> \
> Optional body field \`input\` is passed through as workflow \`meta.data\`.\
> \
> Success body is JSON \`true\` (\`201\`).

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"tags":[{"name":"Transactions","description":"Poll status and submit an on-chain deposit hash"}],"servers":[{"url":"https://api.yifi.io","description":"Production"},{"url":"https://api-dev.yifi.io","description":"Development / Staging"}],"paths":{"/v1/transactions/{transactionProvider}/{engine}/set-deposit-hash":{"post":{"description":"Forwards `{ from, to, hash }` to `setDepositHashWorkflow` after the user broadcasts a **DEX** deposit.\n\nQuery `access_token` is required (the secret from `POST /v1/swap`). Missing token → `400` `ACCESS_TOKEN_REQUIRED` without an order lookup.\n\n`transactionProvider` is the provider order id passed to the workflow as `transactionId`.\n\n`engine` is case-insensitive and must be `dex`. `cex` and `private` → `400` `INVALID_ENGINE` and the workflow is not started.\n\nThe hash is stored once. The same hash returns `true` without rewriting. A different hash → `409` `DEPOSIT_HASH_ALREADY_SET`.\n\nOptional body field `input` is passed through as workflow `meta.data`.\n\nSuccess body is JSON `true` (`201`).","operationId":"setDepositHash","parameters":[{"name":"transactionProvider","required":true,"in":"path","description":"Provider-side transaction id / slug passed to `setDepositHashWorkflow` as `transactionId`","schema":{"type":"string"}},{"name":"engine","required":true,"in":"path","description":"Must be `dex`. Other engines are rejected.","schema":{"type":"string","enum":["dex"]}},{"name":"access_token","required":true,"in":"query","description":"Order access token returned by `POST /v1/swap`","schema":{}}],"requestBody":{"required":true,"description":"On-chain deposit transfer identifiers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetDepositHashDto"}}}},"responses":{"201":{"description":"Workflow returned success (`true`)","content":{"application/json":{"schema":{"type":"boolean"}}}},"400":{"description":"Invalid `engine`, missing `access_token`, or `from` / `to` / `hash` missing or not strings (`INVALID_BODY`)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}},"500":{"description":"`DEX_NOT_CONFIGURED` or `WORKFLOW_EXECUTION_FAILED`","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (`COIN_NOT_FOUND`, `RATE_EXPIRED`, `INVALID_API_KEY`, `HTTP_EXCEPTION` for class-validator, …)"},"message":{"description":"Human-readable message. Class-validator 400s may return a string **array** of constraint texts.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"details":{"description":"Present for some validation (4xx) errors when thrown with `details`.","oneOf":[{"type":"object","additionalProperties":true},{"type":"array"}]}},"required":["code","message","requestId","timestamp"]}}}}}}},"summary":"Submit deposit transaction hash","tags":["App","Transactions"]}}},"components":{"schemas":{"SetDepositHashDto":{"type":"object","properties":{"from":{"type":"string","description":"Sender wallet address that broadcast the deposit"},"to":{"type":"string","description":"Deposit destination: provider deposit address (CEX/private) or the contract the user sent to (DEX)"},"hash":{"type":"string","description":"On-chain transaction hash of the broadcast deposit"},"input":{"type":"object","description":"Optional raw input forwarded to the provider workflow as `meta.data`. Shape is provider-specific."}},"required":["from","to","hash"]}}}}
```


# Models

## The PublicTokenItemApiDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"PublicTokenItemApiDto":{"type":"object","properties":{"uuid":{"type":"string","description":"Internal coin UUID (used by workflows; not required on public query params)"},"network":{"type":"string","description":"Canonical chain slug (`GET /v1/chains` → `id`)"},"ticker":{"type":"string","description":"Token ticker"},"name":{"type":"string","description":"Display name"},"supportsFixedRate":{"type":"boolean","description":"Whether any catalogued route supports a fixed rate for this asset"},"contractAddress":{"type":"object","description":"Contract address; `null` for native coins","nullable":true},"engineSupport":{"description":"Engines that support this token: `on-chain` (DEX), `off-chain` (CEX), and sometimes `private`","type":"array","items":{"type":"string"}},"logoUrlCoin":{"type":"string","description":"Token logo URL"},"regexAddress":{"type":"string","description":"JavaScript regex source used to validate addresses of this asset (`receiveAddress` / `refundAddress` on swap)"},"explorerAddressUrl":{"type":"string","description":"Block-explorer URL template for an address"},"explorerTransactionUrl":{"type":"string","description":"Block-explorer URL template for a transaction"},"decimals":{"type":"object","nullable":true,"description":"Token decimals"},"logoUrlsNetwork":{"type":"object","nullable":true,"description":"Network / chain logo URL"},"coingeckoCoinId":{"type":"object","nullable":true,"description":"CoinGecko coin id (`bitcoin`, `ethereum`, `usd-coin`)"},"currentPriceUsd":{"type":"object","nullable":true,"description":"Spot price in USD from CoinGecko (numeric string)"}},"required":["uuid","network","ticker","name","supportsFixedRate","contractAddress"]}}}}
```

## The TokenListApiResponseDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"TokenListApiResponseDto":{"type":"object","properties":{"tokens":{"type":"array","items":{"$ref":"#/components/schemas/PublicTokenItemApiDto"}},"totalTokens":{"type":"number","description":"Number of token objects in this response page (matches `tokens.length`)"},"limit":{"type":"number","description":"Page size for this response"},"offset":{"type":"number","description":"Pagination offset"},"total":{"type":"number","description":"Total tokens matching filters before pagination"}},"required":["tokens","totalTokens","limit","offset","total"]},"PublicTokenItemApiDto":{"type":"object","properties":{"uuid":{"type":"string","description":"Internal coin UUID (used by workflows; not required on public query params)"},"network":{"type":"string","description":"Canonical chain slug (`GET /v1/chains` → `id`)"},"ticker":{"type":"string","description":"Token ticker"},"name":{"type":"string","description":"Display name"},"supportsFixedRate":{"type":"boolean","description":"Whether any catalogued route supports a fixed rate for this asset"},"contractAddress":{"type":"object","description":"Contract address; `null` for native coins","nullable":true},"engineSupport":{"description":"Engines that support this token: `on-chain` (DEX), `off-chain` (CEX), and sometimes `private`","type":"array","items":{"type":"string"}},"logoUrlCoin":{"type":"string","description":"Token logo URL"},"regexAddress":{"type":"string","description":"JavaScript regex source used to validate addresses of this asset (`receiveAddress` / `refundAddress` on swap)"},"explorerAddressUrl":{"type":"string","description":"Block-explorer URL template for an address"},"explorerTransactionUrl":{"type":"string","description":"Block-explorer URL template for a transaction"},"decimals":{"type":"object","nullable":true,"description":"Token decimals"},"logoUrlsNetwork":{"type":"object","nullable":true,"description":"Network / chain logo URL"},"coingeckoCoinId":{"type":"object","nullable":true,"description":"CoinGecko coin id (`bitcoin`, `ethereum`, `usd-coin`)"},"currentPriceUsd":{"type":"object","nullable":true,"description":"Spot price in USD from CoinGecko (numeric string)"}},"required":["uuid","network","ticker","name","supportsFixedRate","contractAddress"]}}}}
```

## The ChainItemApiDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"ChainItemApiDto":{"type":"object","properties":{"id":{"type":"string","description":"Canonical slug. Use this value as `network`, `networkFrom`, `fromNetwork`, etc."},"name":{"type":"string","description":"Human-readable network name"},"chainId":{"type":"number","nullable":true},"status":{"type":"string","enum":["active","inactive","maintenance"]},"supportedEngines":{"type":"array","items":{"type":"string"}},"aliases":{"type":"array","items":{"type":"string"}},"nativeToken":{"type":"string"},"blockTime":{"type":"string","nullable":true},"providers":{"type":"object","description":"Liquidity provider slugs keyed by engine category","additionalProperties":true},"explorerUrl":{"type":"string"},"logoUrl":{"type":"object","nullable":true},"memoNeeded":{"type":"boolean","description":"Whether transfers on this chain require a memo/tag (derived from active coins with extraId)."}},"required":["id","name","chainId","status","supportedEngines","aliases","nativeToken"]}}}}
```

## The ChainsListApiResponseDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"ChainsListApiResponseDto":{"type":"object","properties":{"chains":{"type":"array","items":{"$ref":"#/components/schemas/ChainItemApiDto"}}},"required":["chains"]},"ChainItemApiDto":{"type":"object","properties":{"id":{"type":"string","description":"Canonical slug. Use this value as `network`, `networkFrom`, `fromNetwork`, etc."},"name":{"type":"string","description":"Human-readable network name"},"chainId":{"type":"number","nullable":true},"status":{"type":"string","enum":["active","inactive","maintenance"]},"supportedEngines":{"type":"array","items":{"type":"string"}},"aliases":{"type":"array","items":{"type":"string"}},"nativeToken":{"type":"string"},"blockTime":{"type":"string","nullable":true},"providers":{"type":"object","description":"Liquidity provider slugs keyed by engine category","additionalProperties":true},"explorerUrl":{"type":"string"},"logoUrl":{"type":"object","nullable":true},"memoNeeded":{"type":"boolean","description":"Whether transfers on this chain require a memo/tag (derived from active coins with extraId)."}},"required":["id","name","chainId","status","supportedEngines","aliases","nativeToken"]}}}}
```

## The TransactionTokenDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"TransactionTokenDto":{"type":"object","properties":{"ticker":{"type":"string","description":"Token ticker"},"network":{"type":"string","description":"Chain slug"},"logoTicker":{"type":"object","description":"Token logo URL or structured logo payload. May be an empty object `{}` while not loaded."},"logoNetwork":{"type":"object","description":"Network logo URL or structured logo payload. May be an empty object `{}` while not loaded."},"contractAddress":{"type":"object","description":"Token contract address (null for native coins)","nullable":true},"chainId":{"type":"object","description":"EVM chainId of the network (null when unknown or non-EVM)","nullable":true},"decimals":{"type":"object","description":"Token decimals","nullable":true}},"required":["ticker","network"]}}}}
```

## The TransactionStatusResponseDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"TransactionStatusResponseDto":{"type":"object","properties":{"uuid":{"type":"string","description":"YiFi UUID. Same value as `POST /v1/swap` → `transactionId` and as the path `{id}` you queried."},"transactionId":{"type":"string","description":"Provider-side transaction id (may differ from `uuid`)"},"status":{"type":"string","description":"Current top-level swap status","enum":["pending","processing","completed","failed","cancelled"]},"statusList":{"type":"object","description":"Granular step-by-step status map. Keys vary by provider and engine."},"engine":{"type":"string","description":"Swap engine used for this transaction","enum":["on-chain","off-chain","private"]},"provider":{"type":"string","description":"Provider slug executing this swap"},"logoProvider":{"type":"object","description":"Provider logo URL"},"fromToken":{"description":"Source token details","allOf":[{"$ref":"#/components/schemas/TransactionTokenDto"}]},"toToken":{"description":"Target token details","allOf":[{"$ref":"#/components/schemas/TransactionTokenDto"}]},"inputAmount":{"type":"string","description":"Amount sent by the user in source token units"},"receiveAmount":{"type":"string","description":"Amount received (or expected) in target token units"},"startTime":{"type":"string","description":"Timestamp when the transaction was created"},"completionTime":{"type":"string","description":"Timestamp when the transaction reached a terminal state (`completed`, `failed`, or `cancelled`). `null` while in progress."},"exchangeRate":{"type":"object","description":"Effective exchange rate (`receiveAmount / inputAmount`). Populated once the swap reaches `completed` status.","nullable":true},"expirationTime":{"type":"object","description":"Order expiration captured at swap creation (same as in create-swap response; mapped via exchanger expirationTimePath)","nullable":true},"txCreateMeta":{"type":"object","description":"Raw provider metadata from transaction creation. May be an empty object or JSON string."},"txDepositHash":{"type":"object","description":"On-chain deposit hash once known. `null` / omitted while waiting.","nullable":true},"txOutputHash":{"type":"object","description":"On-chain output / payout hash once known. `null` / omitted while waiting.","nullable":true},"depositAddress":{"type":"object","description":"Deposit address the user must send to (CEX / private)","nullable":true},"receiveAddress":{"type":"object","description":"Destination address that receives the output token","nullable":true}},"required":["uuid","transactionId","status","engine","provider","fromToken","toToken","inputAmount","receiveAmount"]},"TransactionTokenDto":{"type":"object","properties":{"ticker":{"type":"string","description":"Token ticker"},"network":{"type":"string","description":"Chain slug"},"logoTicker":{"type":"object","description":"Token logo URL or structured logo payload. May be an empty object `{}` while not loaded."},"logoNetwork":{"type":"object","description":"Network logo URL or structured logo payload. May be an empty object `{}` while not loaded."},"contractAddress":{"type":"object","description":"Token contract address (null for native coins)","nullable":true},"chainId":{"type":"object","description":"EVM chainId of the network (null when unknown or non-EVM)","nullable":true},"decimals":{"type":"object","description":"Token decimals","nullable":true}},"required":["ticker","network"]}}}}
```

## The SetDepositHashDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"SetDepositHashDto":{"type":"object","properties":{"from":{"type":"string","description":"Sender wallet address that broadcast the deposit"},"to":{"type":"string","description":"Deposit destination: provider deposit address (CEX/private) or the contract the user sent to (DEX)"},"hash":{"type":"string","description":"On-chain transaction hash of the broadcast deposit"},"input":{"type":"object","description":"Optional raw input forwarded to the provider workflow as `meta.data`. Shape is provider-specific."}},"required":["from","to","hash"]}}}}
```

## The ProviderLegalDocumentDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"ProviderLegalDocumentDto":{"type":"object","properties":{"docName":{"type":"string","description":"Document title"},"docLink":{"type":"string","description":"Official document URL"}},"required":["docName","docLink"]}}}}
```

## The AggregatorProviderDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"AggregatorProviderDto":{"type":"object","properties":{"id":{"type":"string","description":"Provider slug used in quote and swap requests"},"name":{"type":"string","description":"Display name of the provider"},"logoUrl":{"type":"object","description":"Provider logo URL","nullable":true},"engine":{"type":"string","description":"Swap engine for this provider","enum":["on-chain","off-chain","private"]},"status":{"type":"string","description":"Current operational status","enum":["active","inactive","maintenance"]},"kycLevel":{"type":"number","description":"KYC level inherited from the provider: 0 = No KYC, 1 = Rare KYC, 2 = Regular KYC","enum":[0,1,2]},"kycLevelName":{"type":"string","description":"KYC level display name"},"legal":{"description":"Provider legal documents (Terms of Use, etc.)","type":"array","items":{"$ref":"#/components/schemas/ProviderLegalDocumentDto"}},"description":{"type":"string","description":"Provider description for the public catalog"}},"required":["id","name","engine","status"]},"ProviderLegalDocumentDto":{"type":"object","properties":{"docName":{"type":"string","description":"Document title"},"docLink":{"type":"string","description":"Official document URL"}},"required":["docName","docLink"]}}}}
```

## The AggregatorInfoResponseDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"AggregatorInfoResponseDto":{"type":"object","properties":{"providers":{"description":"Active liquidity providers","type":"array","items":{"$ref":"#/components/schemas/AggregatorProviderDto"}},"totalProviders":{"type":"number","description":"Total number of providers in the response"},"aggregatedFrom":{"description":"Engine categories represented in the catalog","type":"array","items":{"type":"string"}},"breakdown":{"type":"object","description":"Count of providers per engine type"}},"required":["providers","totalProviders","aggregatedFrom","breakdown"]},"AggregatorProviderDto":{"type":"object","properties":{"id":{"type":"string","description":"Provider slug used in quote and swap requests"},"name":{"type":"string","description":"Display name of the provider"},"logoUrl":{"type":"object","description":"Provider logo URL","nullable":true},"engine":{"type":"string","description":"Swap engine for this provider","enum":["on-chain","off-chain","private"]},"status":{"type":"string","description":"Current operational status","enum":["active","inactive","maintenance"]},"kycLevel":{"type":"number","description":"KYC level inherited from the provider: 0 = No KYC, 1 = Rare KYC, 2 = Regular KYC","enum":[0,1,2]},"kycLevelName":{"type":"string","description":"KYC level display name"},"legal":{"description":"Provider legal documents (Terms of Use, etc.)","type":"array","items":{"$ref":"#/components/schemas/ProviderLegalDocumentDto"}},"description":{"type":"string","description":"Provider description for the public catalog"}},"required":["id","name","engine","status"]},"ProviderLegalDocumentDto":{"type":"object","properties":{"docName":{"type":"string","description":"Document title"},"docLink":{"type":"string","description":"Official document URL"}},"required":["docName","docLink"]}}}}
```

## The QuoteItemDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"QuoteItemDto":{"type":"object","properties":{"rateId":{"type":"string","description":"Internal rate ID. Pass this in `rateId` to `/v1/swap` to record exactly which quote the user saw. Snapshot is kept in cache for 5 minutes."},"engine":{"type":"string","description":"Swap engine used for this quote","enum":["on-chain","off-chain","private"]},"provider":{"type":"string","description":"Provider slug – use this value in the `provider` field when calling `/v1/swap`"},"exchangerName":{"type":"string","description":"Display name of the provider"},"logoUrl":{"type":"string","description":"Provider logo URL. May be absent for some providers."},"rate":{"type":"string","description":"Exchange rate expressed as output per 1 unit of input token"},"estimatedOutput":{"type":"string","description":"Estimated amount the recipient will receive after all fees"},"inUsdValue":{"type":"number","description":"USD equivalent of the IN amount. Rate is taken from the etalon provider to USDT (TRON, then ETH, then BSC), with a fallback to a quote provider if the etalon is unavailable. `null` when the rate cannot be fetched.","nullable":true},"inUsdRateError":{"type":"string","description":"Set to `\"Can't fetch USD-rate\"` when the IN USD rate cannot be fetched. The quote itself is still returned.","nullable":true},"outUsdValue":{"type":"number","description":"USD equivalent of `estimatedOutput`. Rate is taken from this quote’s provider to USDT (TRON, then ETH, then BSC). `null` when unavailable (including private routes).","nullable":true},"outUsdDeviationPercent":{"type":"number","description":"Percent deviation of `outUsdValue` from `inUsdValue`. Negative means the user receives fewer USD than they sent.","nullable":true},"fromTokenUsdtRate":{"type":"number","description":"Raw USDT rate of 1 IN token. Taken from the etalon provider (USDT TRON → ETH → BSC), with a fallback to a quote provider if the etalon is unavailable. `null` when the IN USD rate cannot be fetched.","nullable":true},"toTokenUsdtRate":{"type":"number","description":"Raw USDT rate of 1 OUT token via this quote’s provider (USDT TRON → ETH → BSC). `null` when unavailable (including private routes).","nullable":true},"rateReversed":{"type":"number","description":"Inverse of `rate`: 1 OUT coin = Y IN coin"},"quoteId":{"type":"string","description":"Quote ID from the provider. Pass this in `quoteId` when calling `/v1/swap` to lock in the rate. `null` for providers that do not support rate locking."},"gasEstimated":{"type":"string","description":"Estimated gas cost in native token units. Present for DEX routes only. `null` for CEX and private routes."},"protocolFee":{"type":"string","description":"Protocol-level fee amount. Present for some DEX routes only."},"providerFee":{"type":"string","description":"Provider-level fee on top of the protocol fee. Present for some DEX routes only."},"slippageTolerance":{"type":"string","description":"Slippage tolerance applied to this quote in percent. Present for DEX routes only."},"estimatedTime":{"type":"string","description":"Expected time to complete the swap via this provider"},"kycLevel":{"type":"number","description":"KYC level inherited from the provider: 0 = No KYC, 1 = Rare KYC, 2 = Regular KYC","enum":[0,1,2]},"kycLevelName":{"type":"string","description":"KYC level display name inherited from the provider"},"legal":{"description":"Provider legal documents (Terms of Use, etc.) inherited from the provider","type":"array","items":{"$ref":"#/components/schemas/ProviderLegalDocumentDto"}},"label":{"type":"string","description":"Label assigned to the best quote (e.g. `\"best price\"`). `null` for all other quotes in `allQuotes`."},"dataForSign":{"type":"object","description":"EIP-712 typed data for client-side signing. Present only for CoW Swap DEX routes."},"schemeSign":{"type":"string","description":"Signing scheme identifier. Present only for CoW Swap routes. Always `\"eip712\"`."},"version":{"type":"string","description":"Private route version: v1 — Monero intermediate hop; v2 — stablecoin / non-XMR. Only when engine=private.","enum":["v1","v2"]},"routeKind":{"type":"string","description":"Private route shape: `direct` is one Quickex private swap; `two_leg` is the deposit+withdraw hop. Only when engine=private. `version` stays v1 or v2.","enum":["direct","two_leg"]}},"required":["rateId","engine","provider","exchangerName","rate","estimatedOutput","inUsdValue","inUsdRateError","outUsdValue","outUsdDeviationPercent","fromTokenUsdtRate","toTokenUsdtRate","rateReversed","estimatedTime"]},"ProviderLegalDocumentDto":{"type":"object","properties":{"docName":{"type":"string","description":"Document title"},"docLink":{"type":"string","description":"Official document URL"}},"required":["docName","docLink"]}}}}
```

## The QuoteResponseDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"QuoteResponseDto":{"type":"object","properties":{"bestQuote":{"description":"Best quote across all sources – array with a single element (or empty if no quotes are available).","type":"array","items":{"$ref":"#/components/schemas/QuoteItemDto"}},"allQuotes":{"description":"Remaining quotes. Private best v1 and v2 (when present and not picked as the global best) are placed first, then other quotes sorted by `rate` descending.","type":"array","items":{"$ref":"#/components/schemas/QuoteItemDto"}}},"required":["bestQuote","allQuotes"]},"QuoteItemDto":{"type":"object","properties":{"rateId":{"type":"string","description":"Internal rate ID. Pass this in `rateId` to `/v1/swap` to record exactly which quote the user saw. Snapshot is kept in cache for 5 minutes."},"engine":{"type":"string","description":"Swap engine used for this quote","enum":["on-chain","off-chain","private"]},"provider":{"type":"string","description":"Provider slug – use this value in the `provider` field when calling `/v1/swap`"},"exchangerName":{"type":"string","description":"Display name of the provider"},"logoUrl":{"type":"string","description":"Provider logo URL. May be absent for some providers."},"rate":{"type":"string","description":"Exchange rate expressed as output per 1 unit of input token"},"estimatedOutput":{"type":"string","description":"Estimated amount the recipient will receive after all fees"},"inUsdValue":{"type":"number","description":"USD equivalent of the IN amount. Rate is taken from the etalon provider to USDT (TRON, then ETH, then BSC), with a fallback to a quote provider if the etalon is unavailable. `null` when the rate cannot be fetched.","nullable":true},"inUsdRateError":{"type":"string","description":"Set to `\"Can't fetch USD-rate\"` when the IN USD rate cannot be fetched. The quote itself is still returned.","nullable":true},"outUsdValue":{"type":"number","description":"USD equivalent of `estimatedOutput`. Rate is taken from this quote’s provider to USDT (TRON, then ETH, then BSC). `null` when unavailable (including private routes).","nullable":true},"outUsdDeviationPercent":{"type":"number","description":"Percent deviation of `outUsdValue` from `inUsdValue`. Negative means the user receives fewer USD than they sent.","nullable":true},"fromTokenUsdtRate":{"type":"number","description":"Raw USDT rate of 1 IN token. Taken from the etalon provider (USDT TRON → ETH → BSC), with a fallback to a quote provider if the etalon is unavailable. `null` when the IN USD rate cannot be fetched.","nullable":true},"toTokenUsdtRate":{"type":"number","description":"Raw USDT rate of 1 OUT token via this quote’s provider (USDT TRON → ETH → BSC). `null` when unavailable (including private routes).","nullable":true},"rateReversed":{"type":"number","description":"Inverse of `rate`: 1 OUT coin = Y IN coin"},"quoteId":{"type":"string","description":"Quote ID from the provider. Pass this in `quoteId` when calling `/v1/swap` to lock in the rate. `null` for providers that do not support rate locking."},"gasEstimated":{"type":"string","description":"Estimated gas cost in native token units. Present for DEX routes only. `null` for CEX and private routes."},"protocolFee":{"type":"string","description":"Protocol-level fee amount. Present for some DEX routes only."},"providerFee":{"type":"string","description":"Provider-level fee on top of the protocol fee. Present for some DEX routes only."},"slippageTolerance":{"type":"string","description":"Slippage tolerance applied to this quote in percent. Present for DEX routes only."},"estimatedTime":{"type":"string","description":"Expected time to complete the swap via this provider"},"kycLevel":{"type":"number","description":"KYC level inherited from the provider: 0 = No KYC, 1 = Rare KYC, 2 = Regular KYC","enum":[0,1,2]},"kycLevelName":{"type":"string","description":"KYC level display name inherited from the provider"},"legal":{"description":"Provider legal documents (Terms of Use, etc.) inherited from the provider","type":"array","items":{"$ref":"#/components/schemas/ProviderLegalDocumentDto"}},"label":{"type":"string","description":"Label assigned to the best quote (e.g. `\"best price\"`). `null` for all other quotes in `allQuotes`."},"dataForSign":{"type":"object","description":"EIP-712 typed data for client-side signing. Present only for CoW Swap DEX routes."},"schemeSign":{"type":"string","description":"Signing scheme identifier. Present only for CoW Swap routes. Always `\"eip712\"`."},"version":{"type":"string","description":"Private route version: v1 — Monero intermediate hop; v2 — stablecoin / non-XMR. Only when engine=private.","enum":["v1","v2"]},"routeKind":{"type":"string","description":"Private route shape: `direct` is one Quickex private swap; `two_leg` is the deposit+withdraw hop. Only when engine=private. `version` stays v1 or v2.","enum":["direct","two_leg"]}},"required":["rateId","engine","provider","exchangerName","rate","estimatedOutput","inUsdValue","inUsdRateError","outUsdValue","outUsdDeviationPercent","fromTokenUsdtRate","toTokenUsdtRate","rateReversed","estimatedTime"]},"ProviderLegalDocumentDto":{"type":"object","properties":{"docName":{"type":"string","description":"Document title"},"docLink":{"type":"string","description":"Official document URL"}},"required":["docName","docLink"]}}}}
```

## The TokenPairDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"TokenPairDto":{"type":"object","properties":{"fromToken":{"type":"string","description":"Source token ticker"},"fromNetwork":{"type":"string","description":"Source chain slug"},"toToken":{"type":"string","description":"Target token ticker"},"toNetwork":{"type":"string","description":"Target chain slug"},"availableEngines":{"description":"Available engines for this pair","type":"array","items":{"type":"string"}},"providers":{"description":"Provider IDs supporting this pair","type":"array","items":{"type":"string"}},"minAmount":{"type":"string","description":"Minimum exchange amount"},"maxAmount":{"type":"string","description":"Maximum exchange amount"}},"required":["fromToken","fromNetwork","toToken","toNetwork","availableEngines","providers","minAmount","maxAmount"]}}}}
```

## The TokenPairsResponseDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"TokenPairsResponseDto":{"type":"object","properties":{"tokenPairs":{"description":"List of token pairs","type":"array","items":{"$ref":"#/components/schemas/TokenPairDto"}},"totalPairs":{"type":"number","description":"Total number of token pairs found"}},"required":["tokenPairs","totalPairs"]},"TokenPairDto":{"type":"object","properties":{"fromToken":{"type":"string","description":"Source token ticker"},"fromNetwork":{"type":"string","description":"Source chain slug"},"toToken":{"type":"string","description":"Target token ticker"},"toNetwork":{"type":"string","description":"Target chain slug"},"availableEngines":{"description":"Available engines for this pair","type":"array","items":{"type":"string"}},"providers":{"description":"Provider IDs supporting this pair","type":"array","items":{"type":"string"}},"minAmount":{"type":"string","description":"Minimum exchange amount"},"maxAmount":{"type":"string","description":"Maximum exchange amount"}},"required":["fromToken","fromNetwork","toToken","toNetwork","availableEngines","providers","minAmount","maxAmount"]}}}}
```

## The CreateSwapDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"CreateSwapDto":{"type":"object","properties":{"provider":{"type":"string","description":"Provider slug from the chosen quote's `provider` field"},"fromToken":{"type":"string","description":"Source token ticker"},"fromNetwork":{"type":"string","description":"Source chain slug — same as `GET /v1/chains` → `id` (case-insensitive)"},"toToken":{"type":"string","description":"Target token ticker"},"toNetwork":{"type":"string","description":"Target chain slug — same as `GET /v1/chains` → `id` (case-insensitive)"},"engine":{"type":"string","description":"Swap engine to use. Must match the engine from the selected quote.\n\n- `cex` – off-chain CEX swap\n\n- `dex` – on-chain DEX swap\n\n- `private` – two-rail private swap (no JWT required on this API)","enum":["cex","dex","private"]},"amount":{"type":"number","description":"Amount to exchange in source token units","minimum":1e-8},"quoteId":{"type":"string","description":"Quote ID from `/v1/quote`. Locks in the rate with providers that support it."},"rateId":{"type":"string","description":"Internal rate ID from `/v1/quote` response. Use to record the exact quote shown to the user in the transaction history. The snapshot expires 5 minutes after the quote was issued. If you pass an expired or unknown ID the request will be rejected with `RATE_EXPIRED`."},"receiveAddress":{"type":"string","description":"Destination wallet address for the output token"},"addressFrom":{"type":"string","description":"Legacy field. Accepted (not rejected by validation) but **not used** by `createSwap`."},"slippageTolerance":{"type":"string","description":"Slippage tolerance in percent. Default `\"0.5\"`. **Applies to DEX routes only** (`engine=dex`). Ignored for CEX and private.","default":"0.5"},"extraIdTo":{"type":"string","description":"Memo / tag for the destination address. Required for tokens that need it (e.g. XRP, XLM, TON)."},"refundAddress":{"type":"string","description":"Address to receive a refund if the swap fails. Recommended when the chosen provider or route requires it — follow provider documentation and support guidance. Strongly recommended for private swaps."},"refundExtraId":{"type":"string","description":"Memo / tag for the refund address, if required by the source network"},"ref":{"type":"string","description":"Partner affiliate referral code (alias of `refCode`). Optional: without a code the swap is created as usual. Attributes the swap to the partner via their affiliate referral node."},"refCode":{"type":"string","description":"Partner affiliate referral code. Attributes the swap to the partner via their affiliate referral node. Optional. If both `ref` and `refCode` are sent, `ref` wins. An unknown code is rejected with `REFERRAL_CODE_NOT_FOUND`."}},"required":["provider","fromToken","fromNetwork","toToken","toNetwork","engine","amount","receiveAddress"]}}}}
```

## The SwapResponseDto object

```json
{"openapi":"3.0.0","info":{"title":"YiFi Swap Public API","version":"1.0"},"components":{"schemas":{"SwapResponseDto":{"type":"object","properties":{"fromToken":{"type":"string","description":"Source token ticker"},"fromNetwork":{"type":"string","description":"Source chain slug as sent in the request"},"toToken":{"type":"string","description":"Target token ticker"},"toNetwork":{"type":"string","description":"Target chain slug as sent in the request"},"provider":{"type":"string","description":"Provider slug executing this swap"},"transactionId":{"type":"string","description":"YiFi transaction ID. Use this to poll `/v1/transactions/{id}` for status updates."},"accessToken":{"type":"string","description":"Issued once at swap creation. Store securely client-side (used for private flows and client-side transaction operations)."},"externalTransactionId":{"type":"string","description":"Provider-side transaction id when it differs from the YiFi UUID in `transactionId`."},"status":{"type":"string","description":"Initial swap status – always `pending` at the moment of creation","enum":["pending","processing","completed","failed"]},"statusList":{"type":"object","description":"Granular step-by-step status map. All values are `false` at creation. Keys vary by provider and engine."},"receiveAmount":{"type":"string","description":"Expected output amount the recipient will receive"},"expirationTime":{"type":"object","description":"Order expiration from provider response (JSON path configured as expirationTimePath on create-exchange endpoint)","nullable":true},"estimatedOutput":{"type":"string","description":"Legacy: expected output amount (prefer `receiveAmount`)"},"estimatedTime":{"type":"string","description":"Expected time to complete the swap"},"depositAddress":{"type":"object","description":"Address to send source funds to. Present for CEX and private routes. `null` for DEX routes where funds are pulled via smart contract.","nullable":true},"extraIdTo":{"type":"string","description":"Memo / tag for the destination address, if required"},"refundAddress":{"type":"string","description":"Address that will receive funds if the swap fails"},"refundExtraId":{"type":"string","description":"Memo / tag for the refund address, if required"},"txCreateMeta":{"type":"object","description":"Raw transaction metadata returned by the provider at creation (e.g. `hash`, `nonce`). May be a JSON string.","nullable":true},"extraIdDeposit":{"type":"string","description":"Memo / tag for the deposit address, if required by the source network"},"tokenForTx":{"type":"string","description":"Ticker of the token as returned by the provider's internal `createExchange` response. May differ from `fromToken` in multi-hop DEX routes."}},"required":["fromToken","fromNetwork","toToken","toNetwork","provider","transactionId","accessToken","status","receiveAmount","estimatedTime"]}}}}
```


# Introduction

Every yield opportunity, one API. Compare markets, deposit in a single transaction, and track the position

### YiFi Earn is one API for DeFi yield

YiFi Earn normalizes yield opportunities across EVM chains and protocols behind a single API and turns a deposit into one signable transaction: **quote, build, sign, track** – without ever taking custody of user funds.

Whether you're building a wallet, a trading bot, a portfolio tracker, or a treasury tool, one integration gives you normalized access to yield across Lending, Liquid Staking, Strategic Vaults, and Stablecoin Vaults – on Ethereum, Base, BNB Chain, HyperEVM, Avalanche, Polygon, Arbitrum, Optimism, and Sonic – without wiring up a single protocol yourself.

#### What you can build

* **Market data** – normalized rates, TVL, and tokens across every protocol in one shape.
* **Execution** – ready-to-sign deposit and withdraw payloads, fully non-custodial.
* **Portfolio** – positions, performance, and history by wallet address.&#x20;

Revenue share is built in: a protocol-level fee splits on-chain between YiFi and the attributed partner, by Partner API key – no billing to build. Fees →

#### Why use YiFi Earn

Five ideas carry most of the integration.

1. **One normalized model.** Every chain, protocol, token, and market is normalized into stable, composable entities with predictable IDs. You integrate the model once – adding a protocol or a chain on our side doesn't change your integration.
2. **Routing, not custody.** YiFi runs no vault. A deposit routes straight into the underlying protocol, and the user receives that protocol's own receipt token – an Aave `aToken`, a Lido `stETH`, and so on. YiFi's contracts are never in the ownership chain of the asset.
3. **Execution is a lifecycle.** A deposit is four steps behind one integration: **quote → build → sign → track**. You request a quote and a ready-to-sign payload, the user signs from their own wallet, and you track it to confirmation.
4. **Track performance, not just balance.** A portfolio read-model reports positions, performance, and transaction history by wallet address – not just a snapshot balance.
5. **Revenue share built in.** A protocol-level fee splits on-chain between YiFi and the attributed partner, with attribution by Partner API and whitelisted wallets – no billing infrastructure to build.&#x20;


# How it works

The end-to-end YiFi Earn lifecycle – from discovering on-chain strategy to a live position and back out through withdrawal

A YiFi Earn integration moves through one loop: discover a strategy, execute a deposit, read the position, and – when the user is ready – withdraw. Everything below happens over the same normalized model, so the shape of a request doesn't change from one protocol to the next.

### The lifecycle at a glance

```mermaid
sequenceDiagram
    participant U as User wallet
    participant P as Partner app
    participant API as YiFi Core API
    participant R as Execution Layer (Portals / LI.FI)
    participant C as Underlying protocol

    P->>API: 1. Discover markets / strategies
    API-->>P: Normalized markets (rate, TVL, tokens)
    P->>API: 2. Zap quote (input token, amount, target market)
    API->>R: Resolve route
    R-->>API: Expected output, fees, steps
    API-->>P: Quote (expected receipt token, fee split)
    P->>API: 3. Zap build
    API-->>P: Ready-to-sign transaction payload
    P->>U: 4. Present transaction
    U->>C: 5. Sign & broadcast (from the user's own wallet)
    C-->>U: Receipt token (e.g. aToken)
    P->>API: 6. Track execution status
    API-->>P: Confirmed — position live
    P->>API: 7. Read portfolio (positions, history)
```

### The flow

{% stepper %}
{% step %}

#### Discover – the data layer

You query normalized **strategies** filtered by chain, platform, category, or token. Each strategy carries the fields you need to rank and display it – rate, TVL, participating tokens and detailed data that varies by strategy type.&#x20;

Under the hood this data is indexed with Subgraphs and Price Oracles.
{% endstep %}

{% step %}

#### Quote

`POST /zap/quote` with the input token, amount, and target market. The quote returns the expected output (the receipt token the user will hold), the fee breakdown, slippage tolerance, and the resolved route steps.
{% endstep %}

{% step %}

#### Build deposit transaction

`POST /zap/build` turns an accepted quote into a ready-to-sign transaction payload – context, the routing order, and the raw `tx`. This is a construction step only: YiFi assembles the **calldata**, it does not sign anything.
{% endstep %}

{% step %}

#### User signs the transaction

Once the transaction calldata is formed, it is passed to the user's wallet for signing. In our reference app, this is handled via Wagmi and Reown AppKit.&#x20;

YiFi never sees a private key, and no transaction executes without the user's explicit signature.
{% endstep %}

{% step %}

#### Settle into the protocol

Once broadcast, the transaction routes through the execution layer and deposits straight into the underlying protocol. The user receives the protocol's **own** receipt token directly.&#x20;
{% endstep %}

{% step %}

#### Track execution

`GET` the execution status to follow the transaction from broadcast to confirmation. Once confirmed, the position is live and readable through the Portfolio read-model.
{% endstep %}

{% step %}

#### Display position&#x20;

The Portfolio read-model returns **positions, performance, and transaction history by wallet address** – not just a balance snapshot. Performance is computed on a Weighted-Average Cost basis at the position level, calculated native-first with USD applied only at output, and gas is tracked separately in the chain's native asset.
{% endstep %}

{% step %}

#### Closing the position – withdraw

A withdrawal is the same lifecycle in reverse: **quote → build → sign → track**, against the position's receipt token.&#x20;
{% endstep %}
{% endstepper %}

### Where fees and attribution happen

The protocol-level fee is embedded in the zap and split **on-chain** through the FeeSplitter contract at execution time – there's no invoicing loop. Attribution is carried by the `X-Partner-Api-Key` header. See Fees structure and Partner attribution.


# Architecture overview

The components behind the YiFi Earn API, how data flows through them, and where the custody boundaries sit

YiFi Earn is a data-and-execution layer over EVM DeFi. It reads protocol state, normalizes it into a single model, prices it, and hands partners a signable transaction – while keeping user funds entirely outside its own contracts.

### Components

```mermaid
flowchart LR
    subgraph Client
        APP[Partner app / wallet]
        W[User wallet]
    end

    subgraph YiFi[YiFi Earn]
        API[Core API — Data Gateway]
        IDX[Indexer]
        PR[Pricing]
        EX[Execution routing]
        PF[Portfolio read-model]
    end

    subgraph Chain[EVM chains]
        PROTO[Underlying protocols — Aave, Lido, Morpho, Ethena, ...]
        FS[FeeSplitter contracts]
    end

    APP --> API
    API --> IDX
    API --> PR
    API --> EX
    API --> PF
    IDX --> PROTO
    PF --> IDX
    EX --> PROTO
    EX --> FS
    W --> PROTO
```

**Core API (Data Gateway).** The single entry point. It composes normalized reference data (chains, platforms, categories), tokens and their metrics, unified markets, and the execution and portfolio surfaces. All entities are linked by stable IDs so integrators can compose them freely.

**Indexer.** Protocol state is indexed Subgraphs to collect protocol-specific values that aren't present in standard schemas – like interest-rate-model curve parameters – are read through custom contract-call handlers rather than inferred from indexed events.

**Pricing.** Prices are applied at the edge, so internal calculations stay native-first.

**Execution routing.** Deposit (zap) and withdraw (unzap) transactions are constructed through Portals WarpDrive and LI.FI Composer. This layer builds calldata; it does not custody assets or sign.

**Portfolio read-model.** A read-only projection of positions, performance, and transaction history keyed by wallet address. It reads from indexed on-chain state – including parsing receipt-token transfer/redeem events directly – rather than trusting cached balances.

**FeeSplitter contracts.** A proprietary contract, deployed across eight EVM networks – Ethereum, BNB Chain, Base, HyperEVM, Arbitrum, Polygon, Optimism, and Avalanche – that splits the protocol-level fee on-chain between YiFi and the attributed partner. It holds only accrued fees, never user principal.

### The normalization pipeline

Raw, protocol-shaped data becomes a uniform model in a fixed sequence: indexed from chain (Subgraphs)→ mapped onto normalized entities with stable IDs → priced → served through the Core API.&#x20;

The result is that a lending reserve, a staking pool, and a vault all arrive in the same shape, and a partner writes one integration instead of one per protocol.


# Token

A token is a single asset in the YiFi model – identified by its canonical address, deployed across chains, and tagged by class.

### Identity

A token is keyed by `token_id` – the **canonical contract address** of the token. It's what you pass to `GET /tokens/{token_id}`.

Per-chain deployments live in `addresses[]`, each with its own `address`, `chain_id`, and `decimals`. Read decimals from the matching `addresses[]` entry.

### Fields

| Field                              | Type   | Notes                                                |
| ---------------------------------- | ------ | ---------------------------------------------------- |
| `token_id`                         | string | Canonical contract address                           |
| `symbol` / `name`                  | string | e.g. `USDT` / `Tether USDT`                          |
| `addresses[]`                      | array  | Per-chain: `chain_id` (slug), `address`, `decimals`  |
| `chain_ids[]`                      | array  | Chain slugs the token is on                          |
| `tag_ids[]`                        | array  | Class tags                                           |
| `token_group`                      | string | Short group slug, e.g. `usd`                         |
| `group_name` / `group_description` | string | Human-readable group metadata                        |
| `image` /                          | string | Logo URL                                             |
| `logo_url`                         | string | Often empty; prefer `image`                          |
| `price_usd` … `holders`            | string | Live metrics (detail); may be `"0"` when unpopulated |

#### Tags

`tag_ids[]` classify what a token *is*. Filter with the `tags` query param on `GET /tokens`, or fetch the full reference list from `GET /tags`. A token can carry more than one tag.

| `tag_id`         | Meaning                                          |
| ---------------- | ------------------------------------------------ |
| `native`         | Native gas token (ETH, BNB, MATIC)               |
| `stablecoin`     | Fiat-pegged stablecoin                           |
| `liquid-staking` | Liquid staking derivative (LST/LSD)              |
| `staked`         | Staked or yield-bearing wrapper of another token |
| `lp`             | Liquidity provider receipt token                 |
| `reward`         | Protocol reward or incentive token               |
| `governance`     | Governance voting token                          |
| `bridged`        | Bridged cross-chain token variant                |

#### Groups

`token_group` normalizes asset display across chains and wrapped variants. Fetch the full reference list from `GET /groups`.

| `token_group` | Covers                                                         |
| ------------- | -------------------------------------------------------------- |
| `usd`         | USD-pegged stablecoins (USDC, USDT, DAI, FRAX, etc.)           |
| `eth`         | ETH and liquid staking derivatives (wstETH, rETH, stETH, etc.) |
| `btc`         | BTC and wrapped BTC variants (WBTC, cbBTC, tBTC, etc.)         |
| `euro`        | EUR-pegged stablecoins (EURS, agEUR, EURe, etc.)               |
| `other`       | Everything else                                                |

`group_name` and `group_description` on the token object are the same values `GET /groups` returns for that `token_group` .

### Try querying Token yourself!

## List tokens

> Get paginated tokens with optional filters and relevance-ranked multi-term search.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Tokens, their metrics, types and historical data","name":"Tokens"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.Pagination-common_GetTokensResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/common.GetTokensResponse"}},"page":{"$ref":"#/components/schemas/common.Page"}}},"common.GetTokensResponse":{"type":"object","properties":{"chain_ids":{"type":"array","items":{"type":"string"}},"image":{"type":"string"},"name":{"type":"string"},"symbol":{"type":"string"},"tag_ids":{"type":"array","items":{"type":"string"}},"token_group":{"type":"string"},"token_id":{"type":"string"}}},"common.Page":{"type":"object","properties":{"currentPage":{"description":"page-based pagination","type":"integer"},"id":{"description":"keyset-based pagination","type":"string"},"limit":{"description":"common","type":"integer"},"nextCursor":{"type":"string"},"offset":{"description":"offset-based pagination","type":"integer"},"pageSize":{"type":"integer"},"prevCursor":{"description":"cursor-based pagination","type":"string"},"totalItems":{"type":"integer"},"totalPages":{"type":"integer"},"type":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/tokens":{"get":{"description":"Get paginated tokens with optional filters and relevance-ranked multi-term search.","tags":["Tokens"],"summary":"List tokens","parameters":[{"schema":{"type":"string"},"description":"multi-term search; terms are ANDed","name":"search","in":"query"},{"schema":{"type":"string"},"description":"comma separated chain ids","name":"chains","in":"query"},{"schema":{"type":"string"},"description":"comma separated tags","name":"tags","in":"query"},{"schema":{"type":"string"},"description":"group","name":"group","in":"query"},{"schema":{"type":"string"},"description":"updatedAt|createdAt|symbol|name; overrides relevance","name":"sortBy","in":"query"},{"schema":{"type":"string"},"description":"asc|desc","name":"sortDirection","in":"query"},{"schema":{"type":"integer","maximum":100},"description":"limit","name":"limit","in":"query"},{"schema":{"type":"integer"},"description":"offset","name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/common.Pagination-common_GetTokensResponse"}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get token

> Get token by id.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Tokens, their metrics, types and historical data","name":"Tokens"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.TokenFullCurrent":{"type":"object","properties":{"addresses":{"type":"array","items":{"$ref":"#/components/schemas/common.Address"}},"circulating_supply":{"type":"string"},"fdv":{"type":"string"},"group_description":{"type":"string"},"group_name":{"type":"string"},"holders":{"type":"string"},"image":{"type":"string"},"logo_url":{"type":"string"},"market_cap":{"type":"string"},"name":{"type":"string"},"price_usd":{"type":"string"},"symbol":{"type":"string"},"tag_ids":{"type":"array","items":{"type":"string"}},"token_group":{"description":"TODO: add constraints eth, usd, euro, btc, other","type":"string"},"token_id":{"type":"string"},"volume_24h_usd":{"type":"string"}}},"common.Address":{"type":"object","properties":{"address":{"type":"string"},"chain_id":{"type":"string"},"decimals":{"type":"integer"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/tokens/{token_id}":{"get":{"description":"Get token by id.","tags":["Tokens"],"summary":"Get token","parameters":[{"schema":{"type":"string"},"description":"token id","name":"token_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/common.TokenFullCurrent"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```


# Market

The raw building block underneath a strategy.

A market is one specific on-chain vault or pool: an Aave v3 lending pool, a Curve LP pool, a Lido staking contract. It's the raw, protocol-level unit – a strategy is the human-readable wrapper built on top of one or more markets.

### Identity

A market is keyed by `market_id`, in **`chain:address` format** – for example `ethereum:0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee`. It's what you pass to `GET /markets/{market_id}`.

### Fields

* **`category`** – what kind of market this is. See the categories table below.
* **`platform`** – the protocol operating the market (`aave-v3`, `curve`, `lido`, etc.). Fetch the reference list from `GET /platforms`.
* **`chain`** – the network the market's contract lives on.

#### Category

| `category_id`       | Covers                                                                      |
| ------------------- | --------------------------------------------------------------------------- |
| `lending`           | Overcollateralized lending protocols (Aave, Compound, Euler)                |
| `dex`               | DEX liquidity provision (Uniswap, Curve, Balancer)                          |
| `lst`               | Liquid staking protocols (Lido, Rocket Pool, Frax Ether)                    |
| `fixed-income`      | Fixed-rate yield products (Pendle)                                          |
| `structured-vaults` | Yield-bearing tokens issued by on-chain capital allocators (Veda, Ether.fi) |
| `stablecoin`        | Stablecoin-specific yield strategies                                        |

#### Rate

* **`annual_rate`** – the yield rate, as a percent string (`"3.84"` = 3.84%).
* **`rate_format`** – whether `annual_rate` is `apy` (compounded) or `apr` (simple).
* **`yield_type`** – `floating` (rate moves with market conditions) or `fixed`.
* **`tvl_usd`** – total value locked, in USD.

#### Participating tokens and roles

`participating_tokens[]` lists every token involved in the market, each with a **`role`** describing what it does there:

| `role`       | Meaning                                                             |
| ------------ | ------------------------------------------------------------------- |
| `INPUT`      | The strategy's input token                                          |
| `OUTPUT`     | The strategy's own token (vault share, pool token, lending receipt) |
| `COLLATERAL` | Deposited as collateral in a lending protocol                       |
| `DEBT`       | Borrowed token                                                      |
| `SUPPLY`     | Supplied/lent token earning interest                                |
| `REWARD`     | Protocol reward or incentive token                                  |
| `LP`         | Liquidity provider receipt token                                    |

### Historical data

For APR/TVL history instead of a snapshot, use `GET /markets/{market_id}/metrics` – up to a year of daily points (`annual_rate`, `tvl_usd` per timestamp). Useful for a yield chart on a market or strategy detail page.

### Example – `GET /markets/{market_id}`

```json
{
  "success": true,
  "data": {
    "market_id": "ethereum:0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee",
    "name": "Aave v3 weETH",
    "chain": "ethereum",
    "platform": "aave-v3",
    "category": "lending",
    "annual_rate": "3.84",
    "tvl_usd": "842000000",
    "rate_format": "apy",
    "yield_type": "floating",
    "participating_tokens": [
      {
        "token_id": "ethereum:0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee",
        "symbol": "weETH",
        "address": "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
        "chain": "ethereum",
        "decimals": 18,
        "price_usd": "3340.00",
        "role": "COLLATERAL"
      }
    ],
    "metadata": {
      "market_address": "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee"
    }
  },
  "error": null
}
```

### Try querying Market yourself!

## List markets

> Get paginated markets with filters and relevance-ranked multi-term search.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Unified DeFi markets – Staking/LST, DEX, Lending, Fixed Income, Structured Vaults, Stablecoins","name":"Markets"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.Pagination-core_MarketsResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/core.MarketsResponse"}},"page":{"$ref":"#/components/schemas/common.Page"}}},"core.MarketsResponse":{"type":"object","properties":{"annual_rate":{"description":"out of meta for effective search","type":"string"},"category":{"type":"string"},"chain":{"type":"string"},"market_id":{"type":"string"},"name":{"type":"string"},"participating_tokens":{"description":"slice of tokenIDs // no need for more for creating a market","type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platform":{"type":"string"},"rate_format":{"type":"string"},"tvl_usd":{"description":"in usd","type":"string"},"yield_type":{"description":"user inserts","type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"common.Page":{"type":"object","properties":{"currentPage":{"description":"page-based pagination","type":"integer"},"id":{"description":"keyset-based pagination","type":"string"},"limit":{"description":"common","type":"integer"},"nextCursor":{"type":"string"},"offset":{"description":"offset-based pagination","type":"integer"},"pageSize":{"type":"integer"},"prevCursor":{"description":"cursor-based pagination","type":"string"},"totalItems":{"type":"integer"},"totalPages":{"type":"integer"},"type":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/markets":{"get":{"description":"Get paginated markets with filters and relevance-ranked multi-term search.","tags":["Markets"],"summary":"List markets","parameters":[{"schema":{"type":"string"},"description":"multi-term search across markets, platforms, chains, and participating tokens","name":"search","in":"query"},{"schema":{"type":"string"},"description":"market ids","name":"ids","in":"query"},{"schema":{"type":"string"},"description":"comma separated category ids","name":"categoryIds","in":"query"},{"schema":{"type":"string"},"description":"comma separated platform ids","name":"platformIds","in":"query"},{"schema":{"type":"string"},"description":"comma separated chain ids","name":"chainIds","in":"query"},{"schema":{"type":"string"},"description":"comma separated token ids","name":"tokenIds","in":"query"},{"schema":{"type":"string"},"description":"min tvl usd","name":"minTvlUsd","in":"query"},{"schema":{"type":"string"},"description":"max tvl usd","name":"maxTvlUsd","in":"query"},{"schema":{"type":"string"},"description":"min apr","name":"minApr","in":"query"},{"schema":{"type":"string"},"description":"max apr","name":"maxApr","in":"query"},{"schema":{"type":"string"},"description":"tvlUsd|apr|apy|createdAt|updatedAt; overrides relevance","name":"sortBy","in":"query"},{"schema":{"type":"string"},"description":"asc|desc","name":"sortDirection","in":"query"},{"schema":{"type":"integer","maximum":100},"description":"limit","name":"limit","in":"query"},{"schema":{"type":"integer"},"description":"offset","name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/common.Pagination-core_MarketsResponse"}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get market

> Get market by id.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Unified DeFi markets – Staking/LST, DEX, Lending, Fixed Income, Structured Vaults, Stablecoins","name":"Markets"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.MarketCurrentResponse":{"type":"object","properties":{"annual_rate":{"description":"out of meta for effective search","type":"string"},"category":{"type":"string"},"chain":{"type":"string"},"market_id":{"type":"string"},"meta":{},"name":{"type":"string"},"participating_tokens":{"description":"slice of tokenIDs // no need for more for creating a market","type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platform":{"type":"string"},"rate_format":{"type":"string"},"tvl_usd":{"description":"in usd","type":"string"},"yield_type":{"description":"user inserts","type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/markets/{market_id}":{"get":{"description":"Get market by id.","tags":["Markets"],"summary":"Get market","parameters":[{"schema":{"type":"string"},"description":"market id","name":"market_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/core.MarketCurrentResponse"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Market history metrics

> Get market historical metrics for a given period.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Unified DeFi markets – Staking/LST, DEX, Lending, Fixed Income, Structured Vaults, Stablecoins","name":"Markets"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.MarketHistoryResponse":{"type":"object","properties":{"history":{"description":"category specific history metrics","type":"array","items":{"$ref":"#/components/schemas/core.History"}},"market_id":{"description":"key in portals","type":"string"},"rate_format":{"type":"string"},"yield_type":{"description":"admin inserts","type":"string"}}},"core.History":{"type":"object","properties":{"annual_rate":{"description":"out of meta for effective search. NEED ONLY FOR SEARCH. NOT OUTPUT. META ALREADY CONTAINS ALL INFO","type":"string"},"timestamp":{"description":"Meta      common.Meta `json:\"meta\"` // временно забиваем","type":"string"},"tvl_usd":{"description":"in usd","type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/markets/{market_id}/metrics":{"get":{"description":"Get market historical metrics for a given period.","tags":["Markets"],"summary":"Market history metrics","parameters":[{"schema":{"type":"string"},"description":"market id","name":"market_id","in":"path","required":true},{"schema":{"type":"string"},"description":"start time RFC3339","name":"from","in":"query"},{"schema":{"type":"string"},"description":"end time RFC3339","name":"to","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/core.MarketHistoryResponse"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

### Relationship to Strategy

A strategy references one or more markets by `market_id` and adds everything needed to actually deposit into one: input/output tokens, a risk rating, fee breakdown, and an executable path.


# Strategy

The executable, human-readable yield product built on top of one or more markets.

A strategy is what a user actually deposits into. It's the human-readable, executable layer on top of one or more [markets](https://docs.yifi.io/docs/earn/core-concepts/market) – carrying everything a market doesn't: input/output tokens, a risk rating, fees, deposit limits, and a routing path to execute.

`GET /strategies` is the primary discovery endpoint for a yield UI – filter it the way you'd filter a product catalog: by chain, category, token, TVL, or APR.

### Fields

#### Classification and tokens

* **`category_ids[]`**, **`chain_ids[]`** – see [Market → Category](https://docs.yifi.io/docs/earn/core-concepts/market#category).
* **`input_tokens[]`** – what a user can deposit with.&#x20;
* **`output_tokens[]`** – what the user ends up holding: the protocol's own receipt token (an aToken, a vault share, an LP token).

#### Rate and risk

* **`metrics.annual_rate`**, **`rate_format`**, **`yield_type`**, **`metrics.tvl_usd`** – same shape as on a market; see [Market → Rate](https://claude.ai/chat/market.md#rate).
* **`risk`** – a risk rating from `GET /risks`:

| `risk_score` | Name   | Meaning                                                                                |
| ------------ | ------ | -------------------------------------------------------------------------------------- |
| 1            | Low    | Blue-chip protocol, $100M+ TVL, multiple independent audits                            |
| 2            | Medium | Established protocol with limited smart-contract risk, or complex multi-step mechanics |
| 3            | High   | Significant liquidation, impermanent-loss, or leverage risk – use with caution         |

#### Fees and limits

* **`fee_breakdown`** – `total_fee`, `yifi_fee`, `partner_fee`, each a percent string.&#x20;
* **`limits`** – `min_deposit_usd`, `max_deposit_usd`, and two independent flags: `deposits_paused` and `withdrawals_paused`. Check these before showing a deposit button – a strategy can have deposits paused while withdrawals stay open (or vice versa), independent of the top-level `status`.

#### Execution

* **`routing_engine`** – which execution provider a zap into this strategy uses. See [Architecture Overview](https://docs.yifi.io/docs/earn/getting-started/architecture-overview).
* **`execution_config`** – the resolved `input_token_ids[]` / `output_token_ids[]`.
* **`market_ids[]`** – the underlying [market(s)](https://docs.yifi.io/docs/earn/core-concepts/market) this strategy wraps.
* **`platforms[]`** – the protocol(s) behind those markets, with `platform_id`, `platform_name`, and the chains each operates on.

### Historical data

For APR/TVL history instead of a snapshot, use `GET /strategies/{strategy_id}/history` – up to a year of daily points. Handy for a yield chart on a strategy detail page.

### Example – `GET /strategies/{strategy_id}`

```json
{
  "success": true,
  "data": {
    "strategy_id": "eth-eth-lending-aave",
    "name": "ETH Lending on Aave v3",
    "description": "Supply ETH on Aave v3 and earn variable lending yield",
    "yield_type": "floating",
    "rate_format": "apy",
    "status": "active",
    "routing_engine": "portals",
    "category_ids": ["lending"],
    "input_tokens": [
      { "token_id": "ethereum:0x0000000000000000000000000000000000000000", "symbol": "ETH", "decimals": 18, "price_usd": "3200.00" }
    ],
    "output_tokens": [
      { "token_id": "ethereum:0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8", "symbol": "aWETH", "decimals": 18, "price_usd": "3201.20" }
    ],
    "metrics": { "annual_rate": "3.84", "tvl_usd": "1842000000", "timestamp": "2026-05-07T10:00:00Z" },
    "risk": { "risk_score": 1, "name": "Low", "description": "Battle-tested protocol with $1B+ TVL and multiple audits" },
    "fee_breakdown": { "total_fee": "0.60", "yifi_fee": "0.30", "partner_fee": "0.30" },
    "limits": { "min_deposit_usd": "100", "max_deposit_usd": "10000000", "deposits_paused": false, "withdrawals_paused": false },
    "market_ids": ["ethereum:0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8"],
    "platforms": [{ "platform_id": "aave-v3", "platform_name": "Aave v3", "chain_ids": ["ethereum"] }]
  },
  "error": null
}
```

### Try querying Strategy yourself!

## List strategies

> Get paginated strategies with filters and relevance-ranked multi-term search.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Strategies – list, details by strategyId (future extension)","name":"Strategies"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.Pagination-core_StrategiesResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/core.StrategiesResponse"}},"page":{"$ref":"#/components/schemas/common.Page"}}},"core.StrategiesResponse":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"type":"array","items":{"$ref":"#/components/schemas/common.Chain"}},"description":{"type":"string"},"fee_breakdown":{"$ref":"#/components/schemas/core.Fees"},"input_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"metrics":{"$ref":"#/components/schemas/core.Metrics"},"name":{"type":"string"},"output_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/common.Platform"}},"rate_format":{"type":"string"},"risk":{"description":"upd (new)","allOf":[{"$ref":"#/components/schemas/common.Risk"}]},"status":{"type":"string"},"strategy_id":{"type":"string"},"updated_at":{"type":"integer"}}},"common.Chain":{"type":"object","properties":{"chain_id":{"description":"e.g.: \"ethereum\"","type":"string"},"ecosystem":{"type":"string"},"explorer_url":{"type":"string"},"image_url":{"type":"string"}}},"core.Fees":{"type":"object","properties":{"max_fee":{"description":"maximum possible fee","type":"string"},"partner_fee":{"type":"string"},"total_fee":{"type":"string"},"yifi_fee":{"type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"core.Metrics":{"type":"object","properties":{"annual_rate":{"description":"out of meta summin up all []meta metrics","type":"string"},"meta":{"description":"Meta carries the full point-in-time reserve snapshot for lending history.\nConcrete (not the common.Meta interface) so the response round-trips —\nclients can't unmarshal JSON into an interface. Populated on the history\nendpoint, omitted on getStrategies().","allOf":[{"$ref":"#/components/schemas/common.MetaLending"}]},"timestamp":{"type":"string"},"tvl_usd":{"type":"string"}}},"common.MetaLending":{"type":"object","properties":{"apy_tvl":{"$ref":"#/components/schemas/common.APYTVLMeta"},"atoken":{"type":"string"},"chain_id":{"type":"integer"},"irm":{"$ref":"#/components/schemas/common.IRMMeta"},"metadata":{"$ref":"#/components/schemas/common.ReserveMetadata"},"network":{"type":"string"},"underlying":{"type":"string"}}},"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"},"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}},"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}},"common.Platform":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"description":"\"ethereum\"","type":"array","items":{"type":"string"}},"image":{"type":"string"},"platform_id":{"description":"\"gyroscope\"","type":"string"},"platform_name":{"description":"\"Gyroscope\"","type":"string"}}},"common.Risk":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"risk_score":{"type":"integer"}}},"common.Page":{"type":"object","properties":{"currentPage":{"description":"page-based pagination","type":"integer"},"id":{"description":"keyset-based pagination","type":"string"},"limit":{"description":"common","type":"integer"},"nextCursor":{"type":"string"},"offset":{"description":"offset-based pagination","type":"integer"},"pageSize":{"type":"integer"},"prevCursor":{"description":"cursor-based pagination","type":"string"},"totalItems":{"type":"integer"},"totalPages":{"type":"integer"},"type":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/strategies":{"get":{"description":"Get paginated strategies with filters and relevance-ranked multi-term search.","tags":["Strategies"],"summary":"List strategies","parameters":[{"schema":{"type":"string"},"description":"multi-term search across strategies, tokens, markets, platforms, chains, and risks","name":"search","in":"query"},{"schema":{"type":"string"},"description":"strategy ids","name":"ids","in":"query"},{"schema":{"type":"string"},"description":"status","name":"status","in":"query"},{"schema":{"type":"string"},"description":"group","name":"group","in":"query"},{"schema":{"type":"string"},"description":"category ids comma separated","name":"category_ids","in":"query"},{"schema":{"type":"string"},"description":"chain ids comma separated","name":"chain_ids","in":"query"},{"schema":{"type":"string"},"description":"token ids comma separated","name":"token_ids","in":"query"},{"schema":{"type":"string"},"description":"platform ids comma separated","name":"platform_ids","in":"query"},{"schema":{"type":"string"},"description":"min tvl usd","name":"minTvlUsd","in":"query"},{"schema":{"type":"string"},"description":"max tvl usd","name":"maxTvlUsd","in":"query"},{"schema":{"type":"string"},"description":"min apr","name":"minApr","in":"query"},{"schema":{"type":"string"},"description":"max apr","name":"maxApr","in":"query"},{"schema":{"type":"integer"},"description":"maximum risk score (1-5)","name":"maxRiskScore","in":"query"},{"schema":{"type":"boolean"},"description":"invert catalog filters; search and status still apply","name":"exclude","in":"query"},{"schema":{"type":"string"},"description":"updatedAt|createdAt|apr|apy|tvlUsd|riskScore; overrides relevance","name":"sortBy","in":"query"},{"schema":{"type":"string"},"description":"asc|desc","name":"sortDirection","in":"query"},{"schema":{"type":"integer","maximum":100},"description":"limit","name":"limit","in":"query"},{"schema":{"type":"integer"},"description":"offset","name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/common.Pagination-core_StrategiesResponse"}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get strategy

> Get strategy by id.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Strategies – list, details by strategyId (future extension)","name":"Strategies"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.StrategyResponse":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"description":"upd","type":"array","items":{"$ref":"#/components/schemas/common.Chain"}},"created_at":{"type":"integer"},"default_engine":{"description":"mirror of routing_engine","type":"string"},"description":{"type":"string"},"execution_config":{"$ref":"#/components/schemas/core.ExecutionConfig"},"fallback_engines":{"description":"ordered alternatives","type":"array","items":{"type":"string"}},"fee_breakdown":{"$ref":"#/components/schemas/core.Fees"},"input_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"limits":{"$ref":"#/components/schemas/core.Limits"},"market_ids":{"type":"array","items":{"type":"string"}},"metrics":{"$ref":"#/components/schemas/core.Metrics"},"name":{"type":"string"},"output_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platforms":{"description":"upd (new)","type":"array","items":{"$ref":"#/components/schemas/common.Platform"}},"rate_format":{"type":"string"},"risk":{"description":"upd (new)","allOf":[{"$ref":"#/components/schemas/common.Risk"}]},"routing_engine":{"description":"default engine (back-compat name)","type":"string"},"status":{"type":"string"},"strategy_id":{"type":"string"},"updated_at":{"type":"integer"},"yield_type":{"type":"string"}}},"common.Chain":{"type":"object","properties":{"chain_id":{"description":"e.g.: \"ethereum\"","type":"string"},"ecosystem":{"type":"string"},"explorer_url":{"type":"string"},"image_url":{"type":"string"}}},"core.ExecutionConfig":{"type":"object","properties":{"input_token_ids":{"type":"array","items":{"type":"string"}},"output_token_ids":{"type":"array","items":{"type":"string"}}}},"core.Fees":{"type":"object","properties":{"max_fee":{"description":"maximum possible fee","type":"string"},"partner_fee":{"type":"string"},"total_fee":{"type":"string"},"yifi_fee":{"type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"core.Limits":{"type":"object","properties":{"deposits_paused":{"type":"boolean"},"withdrawals_paused":{"type":"boolean"}}},"core.Metrics":{"type":"object","properties":{"annual_rate":{"description":"out of meta summin up all []meta metrics","type":"string"},"meta":{"description":"Meta carries the full point-in-time reserve snapshot for lending history.\nConcrete (not the common.Meta interface) so the response round-trips —\nclients can't unmarshal JSON into an interface. Populated on the history\nendpoint, omitted on getStrategies().","allOf":[{"$ref":"#/components/schemas/common.MetaLending"}]},"timestamp":{"type":"string"},"tvl_usd":{"type":"string"}}},"common.MetaLending":{"type":"object","properties":{"apy_tvl":{"$ref":"#/components/schemas/common.APYTVLMeta"},"atoken":{"type":"string"},"chain_id":{"type":"integer"},"irm":{"$ref":"#/components/schemas/common.IRMMeta"},"metadata":{"$ref":"#/components/schemas/common.ReserveMetadata"},"network":{"type":"string"},"underlying":{"type":"string"}}},"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"},"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}},"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}},"common.Platform":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"description":"\"ethereum\"","type":"array","items":{"type":"string"}},"image":{"type":"string"},"platform_id":{"description":"\"gyroscope\"","type":"string"},"platform_name":{"description":"\"Gyroscope\"","type":"string"}}},"common.Risk":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"risk_score":{"type":"integer"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/strategies/{strategy_id}":{"get":{"description":"Get strategy by id.","tags":["Strategies"],"summary":"Get strategy","parameters":[{"schema":{"type":"string"},"description":"strategy id","name":"strategy_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/core.StrategyResponse"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Strategy history

> Get strategy history metrics for period.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Strategies – list, details by strategyId (future extension)","name":"Strategies"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.StrategyHistoryResponse":{"type":"object","properties":{"history":{"type":"array","items":{"$ref":"#/components/schemas/core.Metrics"}},"rate_format":{"type":"string"},"strategy_id":{"description":"key in portals","type":"string"},"yield_type":{"type":"string"}}},"core.Metrics":{"type":"object","properties":{"annual_rate":{"description":"out of meta summin up all []meta metrics","type":"string"},"meta":{"description":"Meta carries the full point-in-time reserve snapshot for lending history.\nConcrete (not the common.Meta interface) so the response round-trips —\nclients can't unmarshal JSON into an interface. Populated on the history\nendpoint, omitted on getStrategies().","allOf":[{"$ref":"#/components/schemas/common.MetaLending"}]},"timestamp":{"type":"string"},"tvl_usd":{"type":"string"}}},"common.MetaLending":{"type":"object","properties":{"apy_tvl":{"$ref":"#/components/schemas/common.APYTVLMeta"},"atoken":{"type":"string"},"chain_id":{"type":"integer"},"irm":{"$ref":"#/components/schemas/common.IRMMeta"},"metadata":{"$ref":"#/components/schemas/common.ReserveMetadata"},"network":{"type":"string"},"underlying":{"type":"string"}}},"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"},"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}},"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/strategies/{strategy_id}/history":{"get":{"description":"Get strategy history metrics for period.","tags":["Strategies"],"summary":"Strategy history","parameters":[{"schema":{"type":"string"},"description":"strategy id","name":"strategy_id","in":"path","required":true},{"schema":{"type":"string"},"description":"start time RFC3339","name":"from","in":"query"},{"schema":{"type":"string"},"description":"end time RFC3339","name":"to","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/core.StrategyHistoryResponse"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

### Relationship to Market and Position

A strategy references one or more [markets](https://docs.yifi.io/docs/earn/core-concepts/market) by `market_id` and adds the execution and business layer on top. Once a user deposits into a strategy, that deposit becomes a position – tracked by wallet address, independent of the strategy's own listing.


# Position

A user's deposit into a strategy, tracked over its full history – balance, performance, and every event that shaped it.

A position is a specific wallet's history with a specific [strategy](https://docs.yifi.io/docs/earn/core-concepts/strategy): every deposit and withdrawal, the current balance, and performance calculated from that full history.

A position is identified by the combination of a **wallet address** and a **`strategy_id`**.

History defaults to the position's **full lifetime** – from the strategy's first block through the latest indexed one – since performance calculations need the complete history to be accurate. Results are paginated with `limit`/`offset`.

### Response shape

A position response has four parts:

| Section    | Contains                                |
| ---------- | --------------------------------------- |
| `meta`     | Wallet, strategy, chain, and status     |
| `tokens`   | The tokens involved, classified by role |
| `pnl`      | Aggregated performance for the position |
| `events[]` | The full deposit/withdraw history       |

#### `meta`

Identifies the position and its current state: `wallet`, `strategy_id`, `chain_id`, `status` (whether the position is currently open or has been fully closed), and `opened_at` (when the first deposit happened).

#### `tokens`

Every token touched by this position, grouped by role:

| Category     | What it is                                 | Example             |
| ------------ | ------------------------------------------ | ------------------- |
| `underlying` | The base asset deposited or received back  | WETH, USDC          |
| `share`      | The strategy's own receipt token           | aEthWETH, syrupUSDC |
| `reward`     | Protocol reward tokens, if any             | –                   |
| `gas`        | The network's gas token, for cost tracking | ETH (on Ethereum)   |

### Events

`events[]` is the deposit/withdraw history behind the position, in chronological order. Each event has a direction, not a fixed token type:

* **`deposit`** – `sent` is the underlying token, `received` is the share token.
* **`withdraw`** – `sent` is the share token, `received` is the underlying token.

Each side carries both a gross and a net amount:

```json
"sent": {
  "token_id": "ethereum:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "amount_usd": "1.588000",
  "amount_gross": "0.001000",
  "amount_net": "0.000997"
}
```

`amount_gross` and `amount_net` differ only on the side a fee was actually taken from. `balance_after` is a snapshot of the share balance right after the event, useful for charting a position's balance over time without replaying the whole history yourself.

### How PnL is calculated

The core question a position answers: **how much has this deposit actually earned?** That splits into two numbers:

* **Realized PnL** – profit that's locked in. It only appears on a `withdraw`: the user got underlying tokens back, and the gain relative to what they originally cost is fixed and won't change afterward.
* **Unrealized PnL** – paper profit on whatever's still deposited. Calculated once, from the current value of the remaining balance versus what was paid for it.

#### Why order matters (weighted-average cost)

If a wallet deposits more than once at different rates, a withdrawal needs to know the *average* cost of the shares it's consuming – not just the total ever deposited. YiFi walks through a position's events in chronological order, maintaining a running weighted-average cost, and recalculates it at each withdrawal using only what had happened up to that point.

A simplified example (USDC lending, rate rising over time):

| # | Type     | Rate | Amount | Avg. cost | Realized this step |
| - | -------- | ---- | ------ | --------- | ------------------ |
| 1 | Deposit  | 1.00 | +1,000 | —         | —                  |
| 2 | Deposit  | 1.05 | +500   | —         | —                  |
| 3 | Withdraw | 1.10 | −220   | 1.0161    | **+16.77**         |
| 4 | Deposit  | 1.12 | +300   | —         | —                  |
| 5 | Withdraw | 1.15 | −115   | 1.0341    | **+11.59**         |

Realized PnL for each withdrawal, once calculated, never changes. Unrealized PnL is computed a single time at the end, from whatever balance remains.

#### Rebasing vs. appreciating tokens

Different protocols express yield differently, and a position handles both correctly:

* **Appreciating.** The number of share tokens stays fixed; each one becomes worth more over time (most ERC-4626 vaults, wstETH). Yield shows up as a rising exchange rate.
* **Rebasing.** The exchange rate stays pegged near 1:1; the *balance* of share tokens itself grows (Aave's aTokens, stETH). Yield shows up as more tokens appearing in the wallet, not a changing price.

For example, an Aave USDC position might show `aEthUSDC` balance growing from 2,987.80 to 2,994.17 over three weeks, with the token's price sitting steady near $1 the whole time — that balance growth **is** the yield. YiFi detects which behavior a given strategy's share token follows and computes unrealized PnL accordingly, so both types report accurate performance rather than a false loss or gain.

#### Settle token (multi-input strategies)

Some strategies accept more than one input token (for example, a strategy that takes ETH, WETH, or eETH and issues the same share token). Since those aren't directly comparable amounts, PnL in token terms is expressed relative to one chosen **settle token** – by default, the first input token used in the position's history, overridable via `?settle_token=<token_id>`.

Conversion between input tokens uses the **current** exchange rate, not the rate at the time of each deposit — this keeps the strategy's own performance cleanly separated from any price movement between the input assets themselves.

#### Gross vs. net, and USD

PnL is reported in three parallel views:

* **`gross`** – performance before fees.
* **`net`** – performance after the zap fee is factored in at each step.
* **`_usd` fields** – the same calculation expressed in USD. This can diverge meaningfully from the settle-token percentage for volatile assets – both numbers are correct, they just answer different questions ("how did my tokens grow" vs. "how did my dollar value grow").

### Example – position summary

```json
{
  "success": true,
  "data": {
    "meta": {
      "wallet": "0x053806E0642F6A6aAFE6176bd264cbbE446C8c92",
      "strategy_id": "eth-eth-lending-aave",
      "chain_id": "ethereum",
      "status": "active",
      "opened_at": 1774528679
    },
    "tokens": {
      "underlying": [{ "symbol": "WETH", "token_id": "ethereum:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "decimals": 18 }],
      "share": [{ "symbol": "aEthWETH", "token_id": "ethereum:0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8", "decimals": 18 }],
      "reward": [],
      "gas": [{ "symbol": "ETH" }]
    },
    "pnl": {
      "settle_token": { "token_id": "ethereum:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "symbol": "WETH" },
      "gross": {
        "realized_pnl_settle": "0.000210",
        "unrealized_pnl_settle": "0.000045",
        "pnl_settle_pct": "3.84",
        "pnl_usd_pct": "4.12"
      },
      "net": {
        "realized_pnl_settle": "0.000195",
        "unrealized_pnl_settle": "0.000042",
        "pnl_settle_pct": "3.55"
      }
    },
    "events": [
      {
        "type": "deposit",
        "tx_hash": "0x...",
        "sent": { "token_id": "ethereum:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "amount_gross": "0.001000", "amount_net": "0.000997", "amount_usd": "1.588000" },
        "received": { "token_id": "ethereum:0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8", "amount_gross": "0.000997", "amount_net": "0.000997", "amount_usd": "1.690081" },
        "balance_after": { "share_balance": "0.000997", "share_balance_usd": "1.690081" }
      }
    ],
    "pagination": { "limit": 20, "offset": 0 }
  },
  "error": null
}
```

### Relationship to Strategy

A position is what a [strategy](https://docs.yifi.io/docs/earn/core-concepts/strategy) becomes once a specific wallet deposits into it.&#x20;


# YiFi Earn Terms of Use

YiFi Earn is a non-custodial software interface that aggregates and displays yield opportunities offered by independent third-party DeFi protocols

*This summary is provided for your convenience only. It is not legally binding, is not a substitute for the full Earn Terms below, and does not modify them. If there is any difference between this summary and the full Terms, the full Terms govern.*

**What YiFi Earn is.** YiFi Earn is a non-custodial software interface that aggregates and displays yield opportunities (“strategies”) offered by independent third-party DeFi protocols. It shows you information such as estimated yield (APY), an indicative risk score and any withdrawal conditions, and it helps you build a blockchain transaction that **you** then sign from **your own** wallet to deposit into, or withdraw from, the chosen protocol.

**What YiFi Earn is&#x20;*****not*****.**

* It is **not** a bank, broker, exchange, fund, investment adviser, financial intermediary or fiduciary.
* It does **not** take custody of your assets. We never hold your funds, private keys or seed phrase, and we cannot move your assets. Every transaction is signed by you.
* It does **not** manage your money, exercise discretion over it, or decide where you place it. You choose; you sign.
* The APY, risk scores and other figures are **not** advice, recommendations, guarantees or offers. They are automatically generated information drawn from external, public on-chain sources.
* We do **not** create, control, audit or operate the underlying protocols or their smart contracts.

**Key risks you accept.**

* **Smart-contract risk.** Underlying protocols and routers are built and run by third parties. They can contain bugs, can be exploited or hacked, and can fail. You can lose some or all of your funds, and we are not liable for that.
* **No guaranteed returns.** APY is variable and indicative; past performance does not predict future results. You can earn less than displayed, nothing, or suffer a loss.
* **Liquidity / withdrawal risk.** Some strategies have withdrawal delays, lock-ups or limited liquidity, and exit may not be immediate.
* **Data risk.** Displayed figures come from external sources and may be inaccurate, incomplete or delayed.
* **Eligibility risk.** The Service is not available in Restricted Jurisdictions, and individual protocols may impose their own additional restrictions that you must check and comply with yourself.

**Your responsibility.** You decide whether any strategy is suitable for you, you assess the risks, you keep your wallet secure, and you remain responsible for your own legal, tax and regulatory compliance.

### Terms of Use

These Terms of Use and any terms incorporated herein (the “**Terms**” or “**Earn Terms**“) apply to your (“**user**“, “**you**“) use of the **YiFi Earn** service available at <https://yifi.io/earn>, including the technology and integrated platform therein, as well as any related applications (including, without limitation, mobile applications) (the “**Earn Service**“), which are operated and maintained by yifi.io (“**Yifi.io**“, “**We**” or “**Us**“). We provide you with the opportunity to use the Earn Service subject to these Terms.

* Yifi.io is owned by Exchangeify Corp., registration number 155777159, registered address: 55 Building, 21st Floor, Office 3, Panama City, Republic of Panama.
* Certain services may be provided by our other operating companies or by the operating companies of our partners.

### 1. Acceptance, Enforcement and Amendments

1.1. These Earn Terms constitute a binding agreement between Yifi.io and you from the moment you access the Earn Service. By accessing or using the Earn Service, you confirm that you have fully read, understood and accepted these Earn Terms prior to use, and that you meet the eligibility requirements in Section 7.

1.2. You agree that these Earn Terms may be updated, supplemented or modified from time to time at the sole discretion of Yifi.io. If you do not read and fully accept these Earn Terms, you must not use or continue using the Earn Service. Your continued use after changes take effect constitutes acceptance of the amended Terms.

### 2. Key Definitions

Unless the context requires otherwise, the following words and expressions shall have the meanings assigned to them below:

“**Platform**“, “**Platform Services**” means the websites, applications, services, interfaces or tools of Yifi.io through which the Earn Service is made available.

“**Platform Website**” means the website located at <https://yifi.io/>, where the Yifi.io interface is hosted or available.

“**Website Administration**” means the authorized employees managing the Website on behalf of Yifi.io.

“**Earn Service**” means the YiFi Earn interface and related functionality that aggregates and displays third-party yield opportunities and assists Users in constructing deposit and withdrawal transactions.

“**User**” means any person using the Earn Service.

“**Digital Assets**” means a digital representation of value (including “cryptocurrency”, “virtual currency”, “digital currency”, “crypto-token”, “token”, “crypto-asset” or “digital commodity”), such as Bitcoin or Ether, based on a cryptographic protocol of a computer network, which may be centralized or decentralized, open-source or closed-source, and used as a medium of exchange and/or store of value.

“**Strategy**” means a yield opportunity offered by one or more third-party Protocols and surfaced through the Earn interface, together with its associated displayed metrics (such as APY and Risk Score) and conditions (such as withdrawal delays).

“**Protocol**” means an autonomous, third-party blockchain protocol, smart contract, lending/staking/liquidity platform or aggregator (including, without limitation, AAVE, Compound and Lido) that is developed, deployed, controlled and operated by parties other than Yifi.io.

“**Router**” / “**Zap**” means third-party smart-contract infrastructure (including, without limitation, Portals.fi and LI.FI) used to construct, bundle and route deposit/withdrawal transactions.

“**APY**” means an annual percentage yield figure displayed for informational purposes only, derived from historical and current on-chain data sourced from external providers.

“**Risk Score**” means an indicative, informational classification displayed for a Strategy, derived from external and on-chain data, which does not constitute a rating, recommendation or assurance of any kind.

“**Restricted Jurisdiction**” and “**Restricted Person**” have the meanings given in Section 7.

### 3. Description of the Earn Service

3.1. The Earn service is a non-custodial web interface that provides access to functions and data from third-party Protocols. The Earn Service acts solely as an **informational and technical aggregation tool**. It is not a financial institution, bank, broker, exchange, fund, investment adviser, portfolio manager, or financial service provider, and it does not provide financial, investment, legal, tax or other professional advice or any offer. All information presented (including, without limitation, APY and yield estimates) is for informational purposes only, is generated automatically based on data from public sources, and under no circumstances shall be construed as financial, investment, tax or other professional advice or an offer.

3.2. Through the Earn interface, the Earn Service:

* displays available Strategies offered by third-party Protocols;
* displays informational metrics for those Strategies, including estimated APY, an indicative Risk Score, and any applicable conditions such as withdrawal delays;
* automates the technical construction and routing of deposit and withdrawal transactions, including through third-party Routers/Zap infrastructure; and
* enables the technical submission of transactions, signed by the User, to the smart contracts of selected third-party Protocols.

3.3. Actual placement of assets, accrual of yield, and all settlement occur **exclusively through third-party smart contracts**. The Earn Service does not manage, pool, hold, lend, stake or invest User assets, does not exercise any discretion over them, and does not guarantee any level of return. APY figures are indicative and subject to change.

3.4. **Withdrawal conditions.** Some Strategies and Protocols impose withdrawal delays, cooldown or unbonding periods, lock-ups, queues, or other liquidity constraints. These conditions are set and enforced by the relevant Protocol, not by Yifi.io. Where available, we display such conditions for information, but we do not control them, cannot accelerate or waive them, and are not responsible for any inability to withdraw, delay in withdrawal, or value change occurring during any such period.

### 4. Nature of the Earn Service – Informational Only; No Investment Advice

4.1. The Earn Service is **non-custodial**, exercises **no discretion** over User assets, and is **informational and technical** in character. You acknowledge and agree that, both in these Terms and as reflected in the interface:

* all materials, data and figures presented through the Earn Service – including, without limitation, APY, Risk Score, Strategy descriptions, rankings and comparisons – **do not constitute investment advice, a recommendation, a solicitation, an inducement, a rating or an offer**, and must not be relied upon as such;
* APY, Risk Score and similar metrics are **calculated automatically on the basis of historical and current on-chain data obtained from external sources**, are **indicative**, are subject to change at any time, and **do not guarantee or predict any future result**;
* Yifi.io does **not warrant the accuracy, completeness, currency or reliability** of any such data, which is sourced from external Protocols and third-party data providers; and
* **you alone are responsible** for evaluating each Strategy, the associated risks, and its suitability for your circumstances, and for making your own decisions. You are encouraged to obtain independent financial, legal and tax advice.

4.2. You acknowledge that Yifi.io is **not your broker, intermediary, agent, adviser, fiduciary, custodian or counterparty**, that no information provided through the Earn Service constitutes advice, and that the display, ordering, labelling or aggregation of Strategies does not express any view by Yifi.io as to their merits.

### 5. Non-Custodial Status and User Control

The Earn Service is strictly non-custodial. This means:

* We never request, receive, or store private keys, seed phrases, passwords or any other wallet-access credentials.
* We have no access to your Digital Assets and cannot initiate, sign or broadcast any transaction without your explicit electronic signature (confirmation).
* All deposit and withdrawal transactions are initiated, signed and broadcast to the blockchain exclusively by your own wallet software.
* You bear full and exclusive responsibility for the security of your wallet, devices and credentials, and for verifying transaction details (including amounts, recipients and Protocol addresses) before signing.

### 6. Relationship with Third-Party Protocols and Smart Contracts

6.1. The Earn Service acts as an independent interface and technological layer that facilitates your interaction with autonomous Protocols and Routers developed, deployed, controlled and operated by third parties, including decentralized exchanges (DEXs), lending, staking and other DeFi protocols, as well as liquidity and yield aggregators. We are not a party to, and assume no responsibility for, the relationship between you and any Protocol.

6.2. The Earn Service may aggregate data and route transactions either directly to third-party Protocols or through external aggregators and Routers (including, without limitation, Portals.fi and LI.FI).

6.3. **“As is” integration of third-party smart contracts.** Integration with the smart contracts of third-party Protocols and Routers (including, without limitation, AAVE, Compound, Lido, Portals.fi and LI.FI) is provided on an “**as is**” and “**as available**” basis. You acknowledge and agree that:

* such smart contracts are **developed, deployed and controlled by third parties** and are **not created, controlled or audited by Yifi.io**;
* Yifi.io does not review, verify, endorse or guarantee the code, security, economic logic, solvency, liquidity, continued operation or legality of any such smart contract or Protocol; and
* **Yifi.io is not responsible or liable for any bug, defect, error, exploit, hack, vulnerability, malfunction, failure, downtime, depeg, insolvency, governance action or other incorrect or unexpected behaviour** of any third-party smart contract, Protocol, Router, oracle or related infrastructure, including any resulting partial or total loss of your assets.

6.4. You acknowledge and agree that:

* all transactions initiated through the Earn interface are executed by third-party smart contracts;
* the Earn Service does not control or guarantee liquidity, uninterrupted operation, solvency or financial stability of any Protocol;
* the Earn Service is not responsible for the functionality, security, economic logic or legality of any third-party smart contract;
* the Earn Service does not guarantee the accuracy, completeness or timeliness of displayed data (including APY, Risk Score and other metrics) sourced from external Protocols and data providers; and
* the Earn Service is not responsible for the acts or omissions of administrators, developers, governance participants or operators of third-party Protocols.

By interacting through the Earn interface, you directly and at your own risk enter into relationships with third-party Protocols. The Earn Service is not a party to such relationships and bears no responsibility for their consequences.

6.5. **Protocol-specific terms and restrictions.** Each underlying Protocol sets its own terms of use, eligibility criteria and geographic and other restrictions, which may differ from and be broader than those of Yifi.io and which may change without notice. We do not reproduce or maintain those terms inside these Earn Terms. Where reasonably practicable, the relevant Protocol’s terms of use are made accessible from the description of the corresponding Strategy in the interface, together with a notice that access may be restricted in case of non-compliance. **You are solely responsible for reviewing, understanding and complying with the terms and restrictions of any Protocol before transacting**, and you accept the consequences of any non-compliance, which are governed by that Protocol’s terms.

### 7. Eligibility, Representations and Restricted Jurisdictions

7.1. To use the Earn Service you must connect a compatible cryptocurrency wallet that is under your exclusive control, and you must have full legal capacity to enter into these Terms.

7.2. By accessing and using the Earn Service, you represent and warrant that you are not located in, and are not a citizen or resident of, the United States of America, any country subject to sanctions imposed by the United Nations, the U.S. Office of Foreign Assets Control (OFAC), or the European Union, or any Restricted Jurisdiction defined in Clause 7.3 of these terms.

7.3. **Consolidated Restricted Jurisdictions.** The Earn Service is not offered to, and may not be used by, persons connected with the following categories (each a “**Restricted Jurisdiction**” or, for list-based designations, a “**Restricted Person**“). This consolidated list is intended to cover the principal restrictions applied across the underlying Protocols; it is reviewed and may be updated from time to time:

* **(a) Comprehensively Sanctioned Territories** – countries and territories subject to comprehensive sanctions or embargoes, including, without limitation, Cuba, Iran, North Korea (DPRK), Syria, the Russian Federation, and the Crimea, Donetsk, Luhansk, Zaporizhzhia and Kherson regions of Ukraine.
* **(b) Crypto-Prohibited Jurisdictions** – countries in which dealing in, or the circulation of, cryptocurrency or digital assets is directly prohibited under applicable law, including, without limitation, the People’s Republic of China and Algeria (and other such jurisdictions as may apply from time to time).
* **(c) Sanctioned Persons (list-based)** – any person, entity or wallet that appears on, is owned or controlled by, or acts on behalf of a person on, any applicable sanctions list, including, without limitation, the OFAC Specially Designated Nationals and Blocked Persons (SDN) List, and equivalent UN, EU or UK lists. Because such lists designate **persons rather than territories**, filtering by IP address is not applicable to this category; instead, Yifi.io reserves the right to restrict or refuse access where such a person is identified.

7.4. Yifi.io does not operate in, and does not target, Restricted Jurisdictions, and reserves the right to determine the markets and jurisdictions in which it makes the Earn Service available, and to restrict or refuse access at any time. You are responsible for ensuring that your use of the Earn Service is lawful in your jurisdiction; the fact that the interface is technically accessible to you is not a representation that such use is lawful.

7.5. **Geographic notices on Strategies.** Where a Protocol applies country-level restrictions to a Strategy, the relevant Protocol’s terms are, where reasonably practicable, made accessible from the Strategy description, together with a notice that access to that Strategy may be restricted where a country policy is breached. Restrictions and their consequences on the Protocol side are governed by the Protocol’s terms; on its own side, Yifi.io reserves the right to restrict access to its interface upon detecting non-compliance. Nothing in the interface constitutes a representation that a given Strategy is available or lawful in your jurisdiction.

7.6. You further represent, agree and warrant that you will not violate any laws, agreements, third-party rights, or commit any tortious acts when accessing or using the Earn Service, and that you bear sole responsibility for your actions and/or omissions in connection with your use of the Earn Service. Without limiting the foregoing, you represent, agree and warrant that:

* you have full legal capacity to enter into contracts under applicable law;
* you are not located in, under the control of, or a citizen or resident of any Restricted Jurisdiction, and you are not a Restricted Person;
* you have not previously been suspended or prohibited from using the Earn Service;
* the use of the Earn Service is not prohibited in your country;
* you do not use the Earn Service for fraudulent, deceptive, or any other unlawful purposes, including but not limited to money laundering, terrorist financing, sanctions evasion, illegal gambling or other illegal activities;
* you use only crypto assets obtained from lawful sources when using the Earn Service;
* you do not provide false, inaccurate or misleading information;
* you do not engage in any actions intended to cause harm to Yifi.io or to other users or service providers;
* you comply with these Terms and all applicable laws;
* you use the Earn Service solely for personal purposes and do not act on behalf of third parties;
* you acknowledge that Yifi.io is not your broker, intermediary, agent, advisor, or fiduciary, and that no information provided by Yifi.io constitutes advice;
* you do not attempt to modify, decompile, reverse engineer or otherwise disassemble the software, the Website or the Earn Service;
* you do not use robots, spiders, crawlers, scrapers or other automated means to access the Earn Service, unless such tools are provided by Yifi.io;
* you do not circumvent content-filtering mechanisms or attempt to access any sections or features to which you do not have authorized access;
* you do not develop third-party applications that interact with the Earn Service without our prior written consent;
* you do not frame, wrap or otherwise enclose Yifi.io’s trademarks, logos or other content;
* you do not copy, reproduce, distribute or otherwise use Yifi.io’s content except as expressly permitted under these Terms;
* you do not remove or alter copyright notices or other proprietary markings;
* you consent to receive all communications, documents, notices and disclosures related to your use of the Earn Service in electronic form;
* you understand and accept that delays in the provision of the Earn Service may occur;
* you do not use proxies, VPNs or other software to conceal your IP address; and
* you do not encourage or induce third parties to engage in any conduct prohibited by these Terms.

### 8. Right to Restrict Access and Enforcement

8.1. Yifi.io reserves the right, at its sole discretion and without prior notice or disclosure of reasons, to restrict, suspend, condition or terminate any User’s access to all or part of the Earn Service, including where Yifi.io reasonably believes that a User is a Restricted Person, is connected with a Restricted Jurisdiction, has breached these Terms or applicable law, or presents a legal, regulatory, security or reputational risk.

8.2. For these purposes, Yifi.io may operate access-control and blocklisting measures, including blocking or restricting by **wallet address, account/login identifier, and User-Agent or device/browser characteristics**, and may, as an additional protective layer, implement IP-based restrictions.

8.3. We aim to protect our users from fraudulent and scam activities in the crypto space. It is possible that certain crypto assets are intended for unlawful seizure, or are deemed fraud, scam, or any other activity recognized by law as illegal and/or non-compliant with applicable regulations. We reserve the right, at our sole discretion, to prohibit and terminate any access or functionality involving such crypto assets through the Earn Service without prior notice and without disclosing the reason once it becomes known to us. YOU RELEASE Yifi.io FROM ANY CLAIMS, DEMANDS, AND DAMAGES, WHETHER DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL, OR OF ANY OTHER KIND, INCLUDING, WITHOUT LIMITATION, LOSS OR FORFEITURE OF PROFITS, ARISING FROM ANY ACTIONS TAKEN UNDER THIS SECTION OR OTHERWISE ARISING OUT OF OR RELATED TO THE PROHIBITION OR TERMINATION OF ANY ACCESS OR FUNCTIONALITY INVOLVING ANY CRYPTO ASSET.

8.4. Yifi.io may refuse service without providing any explanation or disclosure of reasons. Any restriction under this Section does not give rise to any liability of Yifi.io, and you release Yifi.io from any claim arising out of or relating to any such restriction, suspension or termination.

### 9. Compliance and AML

9.1. The Earn Service is non-custodial. Yifi.io does not take custody of User assets, does not pool or execute transactions on Users’ behalf, and does not itself collect personal data for the purpose of identity verification. Accordingly, Yifi.io does not perform KYC verification of Users for the Earn Service and does not assume independent verification obligations in respect of it.

9.2. Identity verification or other compliance checks may be performed by independent third-party Protocols, Routers or off-chain providers on their own side, at their discretion and under their own rules. Such checks are outside Yifi.io’s control.

9.3. Yifi.io’s compliance approach, the categories of Restricted Jurisdictions, and the allocation of verification responsibilities are described in greater detail in the separate [Yifi.io AML / Compliance Policy](https://docs.yifi.io/legal-swap/aml-compliance-policy), which is incorporated into these Terms by reference. You agree to use only assets derived from lawful sources and not to use the Earn Service for money laundering, terrorist financing, sanctions evasion or any other unlawful purpose.

### 10. Fees and Taxes

10.1. You agree to pay all applicable fees for use of the Earn Service, as set forth in the YiFi Earn’s interface.

10.2. All applicable fees charged by Yifi.io are displayed to you in the interface prior to signing and submitting the transaction to the blockchain network.

10.3. You acknowledge that additional fees may apply when interacting with third-party Protocols, Routers and aggregators, including but not limited to performance fees, protocol fees and fees charged by external aggregators. Such fees are set by third parties and are not controlled by Yifi.io.

10.4. To execute transactions on blockchain networks, you pay network fees (gas fees), the amount of which is determined by the relevant blockchain network and does not depend on the Earn Service.

10.5. The Earn Service does not charge hidden or undisclosed fees. All applicable charges by Yifi.io are displayed prior to transaction confirmation. Yifi.io reserves the right to change the structure and amount of its service fees; current information is always available in the interface.

10.6. You are solely responsible for determining which taxes, if any, apply to the payments you make or receive, and for collecting, reporting and remitting such taxes to the appropriate tax authority. You agree that Yifi.io is not responsible for determining whether any taxes apply to your use of the Earn Service, or for collecting, reporting or remitting any taxes arising from any transaction or use of the Earn Service. You acknowledge that we may provide you with additional documents or records necessary for calculating your tax obligations.

### 11. Third-Party Content and Services

11.1. For the purposes of these Terms, “**Third-Party Content**” means content provided by third parties, including, without limitation, links to such parties’ web pages, which may be presented through the Earn Service. “**Third-Party Service**” means any platform or network in which crypto assets are owned by you or you are the beneficial owner, and which is operated or maintained by a third party outside of the Earn Service.

11.2. You may be charged by a third-party service provider. Yifi.io is not responsible for payment of any third-party services. You bear sole responsibility for the use of third-party services and agree to comply with all terms applicable to any such third-party services.

11.3. YOU RELEASE Yifi.io FROM ANY AND ALL DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL OR ANY OTHER DAMAGES OF ANY KIND, INCLUDING, WITHOUT LIMITATION, LOSS OF USE, LOSS OF PROFITS, LOSS OF DATA OR ASSETS, WHETHER ARISING UNDER CONTRACT, TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE, ARISING OUT OF OR IN ANY WAY RELATED TO THE INVALIDITY OR BREACH OF ANY PROVISION OF THIS SECTION.

11.4. When using the Earn Service, you may access Third-Party Content. We do not control, endorse or accept responsibility for any Third-Party Content (unless explicitly stated otherwise by us), including, without limitation, content that may be misleading, incomplete, inaccurate, offensive, obscene or otherwise objectionable. Any business dealings or correspondence with such third parties are conducted solely between you and the third parties. We are not responsible for any loss or damage incurred as a result of any such dealings, and you acknowledge that your use of Third-Party Content and interactions with third parties is at your own risk.

### 12. Intellectual Property

12.1. All of our intellectual property assets (“**IP**“), including, without limitation, all copyrights, trademarks, patents, service marks, trade names, software code, icons, logos, symbols, layouts, trade secrets, buttons, color schemes and graphics, are protected under local and international intellectual property laws and agreements.

12.2. We hereby grant you a limited, non-exclusive, non-transferable and non-sublicensable license to access and use our IP solely for your personal use.

12.3. Under no circumstances may you modify, adapt, reproduce, distribute or use any materials for commercial purposes, including text, graphics, videos, audio, software code, user-interface design or logos.

12.4. The license granted under this Section is automatically terminated if we suspend or terminate your access to the Earn Service.

12.5. If you upload or share with us any feedback, suggestions, ideas or other information or materials (“**Content**“), you hereby automatically grant us a worldwide license to use such Content. We may use it for marketing or any other purposes at our discretion.

### 13. Indemnification

13.1. **Third-Party Claims.** You agree to fully indemnify and hold us harmless from and against any and all claims, demands, actions, suits, proceedings, disputes, allegations or investigations brought by any third party, governmental authority or industry association, as well as all liabilities, losses (both actual and consequential), damages (including any direct or indirect losses, loss of profits or loss of reputation), costs and expenses, including without limitation all interest, penalties and reasonable legal and other professional fees and expenses (“**Losses**“), arising out of or in connection with: (a) your access to or use of the Earn Service; (b) your breach or alleged breach of these Terms or any documents incorporated by reference; (c) your violation of any applicable law; (d) your infringement of the rights of any third party; or (e) your interaction with any Protocol, Router or other third party.

13.2. **Waiver of Claims.** You hereby irrevocably and unconditionally agree to release us from any claims or demands (and waive any rights you may have now or in the future against us in connection with any Losses you may suffer) arising directly or indirectly out of or in connection with any dispute you may have with any other person, user or third party relating to the Earn Service or the subject matter of these Terms.

### 14. Disclaimers and Limitation of Liability

14.1. Except as expressly provided by us in writing, the Earn Service is provided on an “as is” and “as available” basis. WE EXPRESSLY DISCLAIM, AND YOU WAIVE, ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT WITH RESPECT TO THE EARN SERVICE, INCLUDING ANY INFORMATION, CONTENT AND MATERIALS CONTAINED THEREIN. We do not warrant that the Earn Service or any data will be accurate, uninterrupted, secure or error-free.

14.2. **Smart-contract and protocol risk acknowledged.** You expressly acknowledge that interacting with DeFi Protocols and smart contracts is highly risky and that you may lose some or all of your assets. You assume all such risk. To the maximum extent permitted by law, Yifi.io is not liable for any loss of assets or other loss arising from any bug, exploit, hack, vulnerability, failure, depeg, insolvency, governance action or other behaviour of any third-party Protocol, Router, smart contract, oracle or infrastructure, or from any inaccuracy or delay in displayed data, or from any withdrawal delay or liquidity constraint.

14.3. Except as required by law, UNDER NO CIRCUMSTANCES SHALL Yifi.io, OUR DIRECTORS, OFFICERS, MEMBERS, EMPLOYEES OR AGENTS BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL, EXEMPLARY, PUNITIVE OR ANY OTHER DAMAGES OF ANY KIND, INCLUDING, WITHOUT LIMITATION, LOSS OF USE, LOSS OF PROFITS, LOSS OF DATA OR ASSETS, WHETHER ARISING UNDER CONTRACT, TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE, ARISING OUT OF OR IN ANY WAY RELATED TO THE USE OF OR INABILITY TO USE THE EARN SERVICE, INCLUDING, WITHOUT LIMITATION, ANY DAMAGES CAUSED BY OR ARISING FROM ANY USE OF ANY INFORMATION OBTAINED FROM Yifi.io, OR ARISING FROM ERRORS, OMISSIONS, INTERRUPTIONS, INACCURACIES, DEFECTS, VIRUSES, DELAYS IN OPERATION OR TRANSMISSION, OR ANY FAILURE OF PERFORMANCE DUE TO FORCE MAJEURE, COMMUNICATION FAILURES, THEFT, DESTRUCTION OR UNAUTHORIZED ACCESS TO Yifi.io RECORDS, PROGRAMS OR SERVICES.

14.4. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL THE AGGREGATE LIABILITY OF Yifi.io (INCLUDING OUR DIRECTORS, OFFICERS, MEMBERS, EMPLOYEES AND AGENTS), UNDER ANY THEORY, WHETHER IN CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, ARISING FROM OR RELATING TO THE USE OR INABILITY TO USE THE EARN SERVICE OR THESE TERMS, EXCEED THE FEES PAID BY YOU TO Yifi.io FOR THE EARN SERVICE DURING THE THREE (3) MONTHS IMMEDIATELY PRECEDING THE DATE OF THE EVENT GIVING RISE TO SUCH LIABILITY.

### 15. Risk Disclosures

15.1. You acknowledge and agree that your access to and use of the Earn Service is entirely at your own risk.

15.2. You acknowledge that the use of the Internet and blockchain technologies involves certain technical and operational risks, including, without limitation, hardware failures, software malfunctions, Internet connectivity issues and errors in the operation of decentralized networks. Yifi.io shall not be liable for any failures, errors, data corruption or delays arising from such factors.

15.3. You understand and accept the risks associated with the use of smart contracts and decentralized protocols, including, without limitation: potential vulnerabilities or errors in smart-contract code; slippage and price changes; market and yield risk (APY is variable and indicative, returns are not guaranteed, and you may earn less than displayed, nothing, or incur losses, including from impermanent loss or depeg); liquidity and withdrawal risk (withdrawals may be delayed, queued, locked or unavailable); data and oracle risk; and the irreversible nature of blockchain transactions. Yifi.io does not guarantee the correct, secure or uninterrupted operation of third-party Protocols.

15.4. Yifi.io shall not be liable for: failures, delays or errors at the blockchain-network level; network congestion or increased fees; hard forks, protocol upgrades or other changes in network operation; or temporary or permanent unavailability of underlying blockchain infrastructure. Such circumstances are considered force majeure and are beyond the control of the Earn Service.

### 16. Governing Law and Dispute Resolution

16.1. **Governing Law.** These Terms are governed by and construed in accordance with the laws of the Republic of Panama, without regard to any conflict-of-laws or choice-of-law rules.

16.2. **Claim Notice.** In the event of any dispute or claim that you have against Yifi.io or in any way relating to these Terms, you agree to first contact Yifi.io and attempt to resolve the claim by providing written notice of your claim (“**Notice**“) via email: <legal@yifi.io>.

16.3. **Arbitration Referral.** If you and Yifi.io are unable to reach a settlement of the claim within thirty (30) days of receipt of such Notice, either party may submit the dispute to binding arbitration as set forth below.

16.4. **Dispute Resolution.** Any disputes, disagreements, differences or claims between you and Yifi.io (and/or any of its Affiliates) arising out of or relating to: (a) these Terms, including their existence, validity, subject matter, interpretation, performance, breach, negotiation, termination, enforceability or consequences of invalidity; (b) your relationship with Yifi.io (and/or any of its Affiliates) as a user (whether claims are based in contract, tort, statute, fraud, misrepresentation or any other legal theory, and whether they arise during or after termination of these Terms); and (c) any dispute concerning non-contractual obligations arising out of or in connection with these Terms or your relationship with Yifi.io (and/or any of its Affiliates), shall be submitted for consideration and finally resolved by arbitration administered by **the Arbitration Centre of the Chamber of Commerce, Industries and Agriculture of Panama (CeCAP), under its Arbitration Rules** in effect at the commencement of the arbitration. The arbitral decision shall be final and binding. The arbitration provisions set forth in this Section shall survive the termination of these Terms.

16.5. **Arbitration Details.** You and we agree that: the governing law of this provision shall be **the laws of the Republic of Panama**; the place (seat) of arbitration shall be **Panama City, Panama**; the arbitration shall be conducted in English; unless otherwise agreed, the number of arbitrators shall be one (1), and such arbitrator shall have appropriate legal and technological expertise; and if you and we do not agree on the appointment of an arbitrator within fifteen (15) business days of submitting the dispute to arbitration, the arbitrator shall be appointed by **CeCAP**.

16.6. **Limitation Period.** Any claim you bring in connection with these Terms must be filed in arbitration strictly within one (1) year from the date such claim arises; otherwise, the claim shall be considered irrevocably time-barred.

16.7. **Injunctive Relief.** Notwithstanding any other provision of these Terms, you agree that we may seek injunctive relief (or its equivalent in any jurisdiction) or equitable remedies in any jurisdiction.

16.8. **Individual Arbitration.** You agree that any dispute arising in connection with these Terms is private between you and Yifi.io, and shall be resolved exclusively on an individual basis and shall not be treated as a class arbitration, class action or any other representative proceeding.

16.9. **Severability.** If any part of this provision is found to be unenforceable or unlawful for any reason: only the unenforceable or unlawful provision shall be severed; severance shall not affect the remainder of this Section or the ability of the parties to enforce arbitration of any remaining claims on an individual basis; and if any claims must be pursued on a class, collective, consolidated or representative basis, such claims shall be submitted to a competent civil court rather than arbitration, and proceedings regarding such claims shall be stayed pending the resolution of any individual claims in arbitration.

16.10. **Confidentiality.** The parties agree that the arbitration shall be confidential. The fact of arbitration, the existence or content of any claim, all documents and information exchanged or submitted, and any submissions, orders or decisions issued during the arbitration, shall be kept confidential, and neither party shall disclose any of the foregoing to any third party, except to the arbitral tribunal, the parties, their attorneys, experts, witnesses, accountants and auditors, insurers and reinsurers, and any other persons necessary to conduct the arbitration. Notwithstanding the foregoing, a party may disclose such confidential information if: written consent is obtained from the other party; required by applicable law or by any competent regulatory authority or court order; in connection with initiating, pursuing or defending any bona fide legal action to enforce or challenge any arbitral award; or to the extent the relevant information becomes publicly available other than as a result of a breach of these Terms.

16.11. **Survival of Confidentiality.** The confidentiality obligation contained in this Section shall survive the termination of these Terms and the completion or suspension of any arbitration commenced under these Terms.

### 17. Privacy

17.1. In connection with your use of the Earn Service, Yifi.io may collect, store and process personal data. Such collection and processing are governed by the applicable [Yifi.io Privacy Policy](https://docs.yifi.io/legal-swap/privacy-policy), which is incorporated into these Terms by reference. By using the Earn Service, you acknowledge that you have read the Privacy Policy and agree to its terms.

### 18. Miscellaneous

18.1. These Terms constitute the entire agreement and supersede all prior and contemporaneous agreements between the parties regarding the Earn Service.

18.2. In the event of any conflict between these Terms and any other agreement you may enter into with Yifi.io, the terms of such other agreement shall prevail only if these Terms are specifically identified and declared to be overridden by that other agreement.

18.3. Our failure or delay in exercising any right, power or privilege under these Terms shall not operate as a waiver of such right, power or privilege.

18.4. The invalidity or unenforceability of any provision of these Terms shall not affect the validity or enforceability of any other provision, all of which shall remain in full force and effect.

18.5. We may amend these Terms from time to time. The “Last updated” date reflects the latest version, and your continued use of the Earn Service after changes take effect constitutes acceptance of the amended Terms.


# YiFi API Terms of Use

These API / Developer Terms of Use (the “**API Terms**” or “**Terms**“) govern your access to and use of the application programming interfaces, software development kits, widgets, data feeds, sample code and related documentation made available by yifi.io for the **YiFi Earn** and **YiFi Swap** products, including the interfaces documented at <https://yifi.io/docs/api/earn> and <https://yifi.io/docs/api/swap> (together, the “**API**“).

These API Terms are public and apply to every person or entity that accesses or uses the API (“**Developer**“, “**you**“). They apply in addition to the Terms of Use of the YiFi Earn service and the YiFi Swap service (the “**Service Terms**“) and the [Yifi.io AML / Compliance Policy](https://docs.yifi.io/legal-swap/aml-compliance-policy) and [Privacy Policy](https://docs.yifi.io/legal-swap/privacy-policy), each of which is incorporated by reference. If you use the API on behalf of an organisation, you represent that you are authorised to bind that organisation, and “you” refers to that organisation.

Yifi.io is owned by Exchangeify Corp., registration number 155777159, registered address: 55 Building, 21st Floor, Office 3, Panama City, Republic of Panama (“**Yifi.io**“, “**We**“, “**Us**“).

By accessing or using the API, or by generating or using an API Key, you confirm that you have read, understood and accepted these API Terms. If you do not agree, you must not access or use the API.

### 1. Definitions

“**API**” has the meaning given above and includes the YiFi Earn API and the YiFi Swap API, together with all endpoints, SDKs, widgets, data, and Documentation.

“**API Key**” means any credential, token, secret or identifier issued by or on behalf of Yifi.io that enables access to the API.

“**Application**” means any product, service, website, application or system operated by you that integrates with or calls the API.

“**Documentation**” means the technical documentation, specifications, usage guides and policies published by Yifi.io for the API, including at the URLs referenced above, as updated from time to time.

“**End User**” means any person who uses, or interacts with, your Application.

“**Services**” means the YiFi Earn service and the YiFi Swap service as described in their respective Service Terms.

“**Digital Assets**“, “**Protocol**“, “**Provider**“, “**Restricted Jurisdiction**” and “**Restricted Person**” have the meanings given in the applicable Service Terms.

### 2. License and Access

2.1. Subject to your continuous compliance with these API Terms, Yifi.io grants you a limited, non-exclusive, non-transferable, non-sublicensable, revocable license to access and use the API solely to develop, test and operate your Application and to integrate the Services into your Application in accordance with the Documentation.

2.2. The license does not transfer any ownership rights. All rights not expressly granted are reserved by Yifi.io.

2.3. Yifi.io may make available different access tiers, environments (such as test and production), features, quotas or commercial terms. Access to certain features (including the Partner API, higher quotas, affiliate or revenue-share arrangements, or commercial use beyond any free tier) may require a separate written agreement with Yifi.io (a “**Partner Agreement**“).

### 3. API Keys and Security

3.1. You are responsible for obtaining and safeguarding your API Keys. API Keys are confidential, are issued to you only, and must not be shared, sold, sublicensed or disclosed to any third party.

3.2. You are fully responsible for all activity that occurs under your API Keys, whether or not authorised by you. You must promptly notify Yifi.io of any actual or suspected unauthorised use or compromise of your API Keys.

3.3. Yifi.io may rotate, suspend or revoke API Keys at any time, including for security, legal, compliance or operational reasons.

### 4. Acceptable Use and Restrictions

4.1. You must use the API only as permitted by these API Terms and the Documentation, and in compliance with all applicable laws. You must not, and must not permit any third party to:

* exceed, circumvent or interfere with any rate limit, quota, throttling, authentication or access control;
* access the API by any means other than the documented interfaces, or scrape, crawl or harvest data other than through the API as documented;
* reverse engineer, decompile or disassemble the API or attempt to derive source code, except to the extent such restriction is prohibited by law;
* resell, redistribute, sublicense or commercially exploit the API or any data obtained through it other than as an integrated part of your Application, or build or assist in building a competing product, index or aggregated data set;
* introduce malware, conduct penetration testing without prior written consent, or otherwise disrupt or compromise the integrity, security or performance of the API or the Services;
* misrepresent the source of, or remove or alter any attribution, proprietary notices or markings in, any API output;
* use the API to facilitate any unlawful, fraudulent, deceptive, infringing or harmful activity; or
* use the API in or for the benefit of any Restricted Jurisdiction or Restricted Person, or to provide access to the Services to any such jurisdiction or person.

4.2. Yifi.io may monitor your use of the API to verify compliance, ensure stability, and improve the API and the Services.

### 5. Rate Limits and Availability

5.1. Your use of the API is subject to the rate limits, quotas and fair-use parameters set out in the Documentation or otherwise communicated to you. Yifi.io may set, change, throttle or enforce such limits at its discretion.

5.2. The API is provided on an “as is” and “as available” basis. Yifi.io does not guarantee any level of availability, uptime, latency, throughput or performance unless expressly agreed in a Partner Agreement. Yifi.io may modify, suspend, deprecate or discontinue the API or any of its features, endpoints or versions at any time, and will use reasonable efforts to provide advance notice of material breaking changes through the Documentation or other channels.

### 6. Nature of the API and the Services

6.1. The API is a non-custodial, informational and technical interface. Yifi.io does not take custody of, hold or control any Digital Assets, does not have access to private keys, and does not execute transactions on behalf of you or any End User. All transactions are initiated and signed by the relevant wallet holder, or executed by independent third-party Protocols and Providers.

6.2. **YiFi Earn API.** Data exposed by the YiFi Earn API (including yield/APY figures and risk scores) is generated automatically from external on-chain and third-party data sources, is indicative and informational only, and **does not constitute investment advice, a recommendation, a rating, a solicitation or an offer**. It is subject to change and is not a guarantee of any result.

6.3. **YiFi Swap API.** The YiFi Swap API provides routing, quote and execution-construction functionality across third-party liquidity sources (including DEX, CEX, private liquidity and bridges). Quotes and routes are indicative, are generated automatically, and may differ from actual execution due to slippage, market movement, route availability and network conditions.

6.4. **Third parties “as is”.** The Services route to, and rely on, autonomous third-party Protocols, smart contracts, routers and Providers that are developed, deployed and controlled by third parties and are **not created, controlled or audited by Yifi.io**. Yifi.io is not responsible or liable for any bug, exploit, hack, vulnerability, failure, depeg, insolvency, delay or other behaviour of any such third party, including any resulting loss of assets.

### 7. Developer Obligations Toward End Users

7.1. You are solely responsible for your Application, including its design, security, content, and its compliance with all applicable laws. You act as an independent operator and not as an agent of Yifi.io.

7.2. You must maintain your own terms of service and privacy policy with your End Users, and must not represent that Yifi.io is responsible for, or a party to, your relationship with your End Users.

7.3. You must accurately present to your End Users, and must not alter or omit, the informational nature and risk character of the data and functionality obtained through the API, including (where applicable) that yield/APY and risk scores are informational and not advice, that interactions involve third-party smart contracts and Providers on an “as is” basis, and that transactions may be irreversible.

7.4. You must not use the API to offer the Services, or enable access, in any Restricted Jurisdiction or to any Restricted Person, and you must implement reasonable measures consistent with the [AML / Compliance Policy](https://docs.yifi.io/legal-swap/aml-compliance-policy) to prevent such access.

### 8. Compliance

8.1. You are responsible for your own regulatory status and for any licensing, registration, KYC, AML/CTF, consumer-protection, tax and other obligations applicable to your Application and your End Users. You must review and comply, and ensure your End Users are directed to review and comply, with the terms, rules and policies of any platform, Protocol or Provider through which an operation is performed.

### 9. Data and Privacy

9.1. Yifi.io may collect and process technical and usage data relating to your access to the API (such as request metadata, identifiers, IP address, and performance data) for security, analytics, billing, abuse prevention and improvement purposes, as described in the [Privacy Policy](https://docs.yifi.io/legal-swap/privacy-policy).

9.2. As between the parties, you are responsible for any personal data of your End Users that you collect or process, and for providing all required notices and obtaining all required consents. You must not send Yifi.io any End-User personal data except as strictly necessary to use the API and as permitted by the Documentation and applicable law.

### 10. Fees

10.1. Yifi.io may offer the API under a free tier and/or on a metered or commercial basis. Yifi.io reserves the right to introduce, change or remove fees, quotas and access tiers at its discretion, with notice through the Documentation or other channels.

10.2. Commercial use beyond any published free tier, the Partner API, and any affiliate or revenue-share arrangement are governed by a separate Partner Agreement. In the event of a conflict between these API Terms and a signed Partner Agreement, the Partner Agreement prevails for the matters it expressly addresses.

### 11. Intellectual Property and Brand

11.1. The API, the Documentation, the Services, and all related software, content, trademarks, logos and other intellectual property are owned by Yifi.io or its licensors and are protected by applicable laws. Except for the limited license expressly granted, no rights are granted to you.

11.2. You may refer to Yifi.io, YiFi Earn and YiFi Swap solely to truthfully describe your integration, in accordance with any brand guidelines provided by Yifi.io. You must not use Yifi.io’s marks in a manner that implies endorsement, partnership or sponsorship beyond the actual integration, or that disparages Yifi.io.

11.3. If you provide feedback, suggestions or ideas regarding the API, you grant Yifi.io a worldwide, perpetual, irrevocable, royalty-free license to use them for any purpose without obligation to you.

### 12. Disclaimers

12.1. THE API, THE DOCUMENTATION AND ALL DATA AND OUTPUT ARE PROVIDED ON AN “AS IS” AND “AS AVAILABLE” BASIS. TO THE MAXIMUM EXTENT PERMITTED BY LAW, Yifi.io EXPRESSLY DISCLAIMS ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, ACCURACY, AND UNINTERRUPTED OR ERROR-FREE OPERATION.

12.2. You assume all risk arising from your use of the API and the operation of your Application, including any reliance on indicative data, any interaction with third-party Protocols, smart contracts and Providers, and any loss of Digital Assets.

### 13. Limitation of Liability

13.1. TO THE MAXIMUM EXTENT PERMITTED BY LAW, Yifi.io AND ITS DIRECTORS, OFFICERS, MEMBERS, EMPLOYEES AND AGENTS SHALL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY OR PUNITIVE DAMAGES, OR FOR ANY LOSS OF PROFITS, REVENUE, DATA, GOODWILL OR DIGITAL ASSETS, ARISING OUT OF OR RELATING TO THE API OR THESE API TERMS, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE) OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

13.2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE AGGREGATE LIABILITY OF Yifi.io ARISING OUT OF OR RELATING TO THE API OR THESE API TERMS SHALL NOT EXCEED THE GREATER OF (A) THE TOTAL FEES PAID BY YOU TO Yifi.io FOR ACCESS TO THE API DURING THE THREE (3) MONTHS IMMEDIATELY PRECEDING THE EVENT GIVING RISE TO THE CLAIM, OR (B) ONE HUNDRED U.S. DOLLARS (USD 100).

### 14. Indemnification

14.1. You agree to indemnify and hold harmless Yifi.io and its directors, officers, employees, agents and affiliates from and against any claims, demands, proceedings, liabilities, losses, damages, costs and expenses (including reasonable legal fees) arising out of or in connection with: (a) your access to or use of the API; (b) your Application and your relationship with your End Users; (c) your breach of these API Terms or any incorporated terms; (d) your violation of any applicable law; or (e) your infringement of any third-party right.

### 15. Suspension and Termination

15.1. Yifi.io may suspend, restrict or terminate your access to the API at any time, with or without notice, including for actual or suspected breach of these API Terms, security or legal risk, non-payment, or discontinuation of the API.

15.2. You may stop using the API at any time. Upon termination, the license in Section 2 ends, you must cease all use of the API, stop using and delete any API Keys and cached non-public data, and remove the integration from your Application. Sections that by their nature should survive (including IP, disclaimers, limitation of liability, indemnification, and dispute resolution) survive termination.

### 16. Changes to these API Terms

16.1. We may amend these API Terms from time to time at our sole discretion. The “Last updated” date reflects the latest version. Your continued access to or use of the API after changes take effect constitutes acceptance of the amended Terms.

### 17. Governing Law and Dispute Resolution

17.1. These API Terms are governed by the laws of the Republic of Panama, without regard to conflict-of-laws rules.

17.2. Any dispute arising out of or relating to these API Terms shall first be notified in writing to Yifi.io at <legal@yifi.io> and, if not resolved within thirty (30) days, shall be finally resolved by binding individual arbitration administered by **the Arbitration Centre of the Chamber of Commerce, Industries and Agriculture of Panama (CeCAP) under its Arbitration Rules**, with the governing law of this provision being **the laws of the Republic of Panama**, the place (seat) of arbitration being **Panama City, Panama**, conducted in English before one (1) arbitrator. The parties waive any right to class or representative proceedings. Any claim must be brought within one (1) year of arising. Notwithstanding the foregoing, Yifi.io may seek injunctive or equitable relief in any jurisdiction. The arbitration shall be confidential.

### 18. Miscellaneous

18.1. These API Terms, together with the documents incorporated by reference and any applicable Partner Agreement, constitute the entire agreement between you and Yifi.io regarding the API.

18.2. You may not assign these API Terms without Yifi.io’s prior written consent; Yifi.io may assign them freely. Nothing in these API Terms creates any partnership, joint venture, agency or employment relationship between the parties.

18.3. Our failure to exercise any right is not a waiver. If any provision is held invalid or unenforceable, the remaining provisions remain in full force and effect.


# Reference

Basic reference data (chains, platforms, categories)

## Get categories

> Returns list of categories.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Basic reference data (chains, platforms, categories)","name":"Reference"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.Category":{"type":"object","properties":{"category_id":{"type":"string"},"description":{"type":"string"},"is_active":{"type":"boolean"},"name":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/categories":{"get":{"description":"Returns list of categories.","tags":["Reference"],"summary":"Get categories","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/common.Category"}}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get chains

> Returns list of blockchain chains.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Basic reference data (chains, platforms, categories)","name":"Reference"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"common.Chain":{"type":"object","properties":{"chain_id":{"description":"e.g.: \"ethereum\"","type":"string"},"ecosystem":{"type":"string"},"explorer_url":{"type":"string"},"image_url":{"type":"string"}}}}},"paths":{"/chains":{"get":{"description":"Returns list of blockchain chains.","tags":["Reference"],"summary":"Get chains","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/common.Chain"}}}}},"400":{"description":"Bad Request"},"500":{"description":"Internal Server Error"}}}}}}
```

## Get platforms

> Returns list of platforms.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Basic reference data (chains, platforms, categories)","name":"Reference"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.Platform":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"description":"\"ethereum\"","type":"array","items":{"type":"string"}},"image":{"type":"string"},"platform_id":{"description":"\"gyroscope\"","type":"string"},"platform_name":{"description":"\"Gyroscope\"","type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/platforms":{"get":{"description":"Returns list of platforms.","tags":["Reference"],"summary":"Get platforms","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/common.Platform"}}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```


# Tokens

Tokens, their metrics, types and historical data

## Token groups

> List token groups.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Tokens, their metrics, types and historical data","name":"Tokens"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.TokenGroup":{"type":"object","properties":{"group_description":{"type":"string"},"group_name":{"type":"string"},"logo_url":{"type":"string"},"token_group":{"description":"TODO: add constraints eth, usd, euro, btc, other","type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/groups":{"get":{"description":"List token groups.","tags":["Tokens"],"summary":"Token groups","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenGroup"}}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Token tags

> List available token tags.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Tokens, their metrics, types and historical data","name":"Tokens"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.TokenTag":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"tag_id":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/tags":{"get":{"description":"List available token tags.","tags":["Tokens"],"summary":"Token tags","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenTag"}}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## List tokens

> Get paginated tokens with optional filters and relevance-ranked multi-term search.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Tokens, their metrics, types and historical data","name":"Tokens"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.Pagination-common_GetTokensResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/common.GetTokensResponse"}},"page":{"$ref":"#/components/schemas/common.Page"}}},"common.GetTokensResponse":{"type":"object","properties":{"chain_ids":{"type":"array","items":{"type":"string"}},"image":{"type":"string"},"name":{"type":"string"},"symbol":{"type":"string"},"tag_ids":{"type":"array","items":{"type":"string"}},"token_group":{"type":"string"},"token_id":{"type":"string"}}},"common.Page":{"type":"object","properties":{"currentPage":{"description":"page-based pagination","type":"integer"},"id":{"description":"keyset-based pagination","type":"string"},"limit":{"description":"common","type":"integer"},"nextCursor":{"type":"string"},"offset":{"description":"offset-based pagination","type":"integer"},"pageSize":{"type":"integer"},"prevCursor":{"description":"cursor-based pagination","type":"string"},"totalItems":{"type":"integer"},"totalPages":{"type":"integer"},"type":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/tokens":{"get":{"description":"Get paginated tokens with optional filters and relevance-ranked multi-term search.","tags":["Tokens"],"summary":"List tokens","parameters":[{"schema":{"type":"string"},"description":"multi-term search; terms are ANDed","name":"search","in":"query"},{"schema":{"type":"string"},"description":"comma separated chain ids","name":"chains","in":"query"},{"schema":{"type":"string"},"description":"comma separated tags","name":"tags","in":"query"},{"schema":{"type":"string"},"description":"group","name":"group","in":"query"},{"schema":{"type":"string"},"description":"updatedAt|createdAt|symbol|name; overrides relevance","name":"sortBy","in":"query"},{"schema":{"type":"string"},"description":"asc|desc","name":"sortDirection","in":"query"},{"schema":{"type":"integer","maximum":100},"description":"limit","name":"limit","in":"query"},{"schema":{"type":"integer"},"description":"offset","name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/common.Pagination-common_GetTokensResponse"}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get token

> Get token by id.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Tokens, their metrics, types and historical data","name":"Tokens"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.TokenFullCurrent":{"type":"object","properties":{"addresses":{"type":"array","items":{"$ref":"#/components/schemas/common.Address"}},"circulating_supply":{"type":"string"},"fdv":{"type":"string"},"group_description":{"type":"string"},"group_name":{"type":"string"},"holders":{"type":"string"},"image":{"type":"string"},"logo_url":{"type":"string"},"market_cap":{"type":"string"},"name":{"type":"string"},"price_usd":{"type":"string"},"symbol":{"type":"string"},"tag_ids":{"type":"array","items":{"type":"string"}},"token_group":{"description":"TODO: add constraints eth, usd, euro, btc, other","type":"string"},"token_id":{"type":"string"},"volume_24h_usd":{"type":"string"}}},"common.Address":{"type":"object","properties":{"address":{"type":"string"},"chain_id":{"type":"string"},"decimals":{"type":"integer"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/tokens/{token_id}":{"get":{"description":"Get token by id.","tags":["Tokens"],"summary":"Get token","parameters":[{"schema":{"type":"string"},"description":"token id","name":"token_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/common.TokenFullCurrent"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Token group by token id

> Get token group for a token.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Tokens, their metrics, types and historical data","name":"Tokens"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.TokenGroup":{"type":"object","properties":{"group_description":{"type":"string"},"group_name":{"type":"string"},"logo_url":{"type":"string"},"token_group":{"description":"TODO: add constraints eth, usd, euro, btc, other","type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/tokens/{token_id}/group":{"get":{"description":"Get token group for a token.","tags":["Tokens"],"summary":"Token group by token id","parameters":[{"schema":{"type":"string"},"description":"token id","name":"token_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/common.TokenGroup"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Token history metrics

> Get token historical metrics (time range). \`from\` limited to 1 year back.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Tokens, their metrics, types and historical data","name":"Tokens"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.TokenStatsHistory":{"type":"object","properties":{"history":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenHistory"}},"token_id":{"type":"string"}}},"common.TokenHistory":{"type":"object","properties":{"metrics":{"$ref":"#/components/schemas/common.TokenStats"},"timestamp":{"type":"string"}}},"common.TokenStats":{"type":"object","properties":{"circulating_supply":{"type":"string"},"fdv":{"type":"string"},"holders":{"type":"string"},"market_cap":{"type":"string"},"price_usd":{"type":"string"},"volume_24h_usd":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/tokens/{token_id}/metrics":{"get":{"description":"Get token historical metrics (time range). `from` limited to 1 year back.","tags":["Tokens"],"summary":"Token history metrics","parameters":[{"schema":{"type":"string"},"description":"token id","name":"token_id","in":"path","required":true},{"schema":{"type":"string"},"description":"start time RFC3339","name":"from","in":"query"},{"schema":{"type":"string"},"description":"end time RFC3339","name":"to","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/common.TokenStatsHistory"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```


# Markets

Unified DeFi markets – Staking/LST, DEX, Lending, Fixed Income, Structured Vaults, Stablecoins

## List markets

> Get paginated markets with filters and relevance-ranked multi-term search.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Unified DeFi markets – Staking/LST, DEX, Lending, Fixed Income, Structured Vaults, Stablecoins","name":"Markets"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.Pagination-core_MarketsResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/core.MarketsResponse"}},"page":{"$ref":"#/components/schemas/common.Page"}}},"core.MarketsResponse":{"type":"object","properties":{"annual_rate":{"description":"out of meta for effective search","type":"string"},"category":{"type":"string"},"chain":{"type":"string"},"market_id":{"type":"string"},"name":{"type":"string"},"participating_tokens":{"description":"slice of tokenIDs // no need for more for creating a market","type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platform":{"type":"string"},"rate_format":{"type":"string"},"tvl_usd":{"description":"in usd","type":"string"},"yield_type":{"description":"user inserts","type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"common.Page":{"type":"object","properties":{"currentPage":{"description":"page-based pagination","type":"integer"},"id":{"description":"keyset-based pagination","type":"string"},"limit":{"description":"common","type":"integer"},"nextCursor":{"type":"string"},"offset":{"description":"offset-based pagination","type":"integer"},"pageSize":{"type":"integer"},"prevCursor":{"description":"cursor-based pagination","type":"string"},"totalItems":{"type":"integer"},"totalPages":{"type":"integer"},"type":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/markets":{"get":{"description":"Get paginated markets with filters and relevance-ranked multi-term search.","tags":["Markets"],"summary":"List markets","parameters":[{"schema":{"type":"string"},"description":"multi-term search across markets, platforms, chains, and participating tokens","name":"search","in":"query"},{"schema":{"type":"string"},"description":"market ids","name":"ids","in":"query"},{"schema":{"type":"string"},"description":"comma separated category ids","name":"categoryIds","in":"query"},{"schema":{"type":"string"},"description":"comma separated platform ids","name":"platformIds","in":"query"},{"schema":{"type":"string"},"description":"comma separated chain ids","name":"chainIds","in":"query"},{"schema":{"type":"string"},"description":"comma separated token ids","name":"tokenIds","in":"query"},{"schema":{"type":"string"},"description":"min tvl usd","name":"minTvlUsd","in":"query"},{"schema":{"type":"string"},"description":"max tvl usd","name":"maxTvlUsd","in":"query"},{"schema":{"type":"string"},"description":"min apr","name":"minApr","in":"query"},{"schema":{"type":"string"},"description":"max apr","name":"maxApr","in":"query"},{"schema":{"type":"string"},"description":"tvlUsd|apr|apy|createdAt|updatedAt; overrides relevance","name":"sortBy","in":"query"},{"schema":{"type":"string"},"description":"asc|desc","name":"sortDirection","in":"query"},{"schema":{"type":"integer","maximum":100},"description":"limit","name":"limit","in":"query"},{"schema":{"type":"integer"},"description":"offset","name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/common.Pagination-core_MarketsResponse"}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get market

> Get market by id.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Unified DeFi markets – Staking/LST, DEX, Lending, Fixed Income, Structured Vaults, Stablecoins","name":"Markets"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.MarketCurrentResponse":{"type":"object","properties":{"annual_rate":{"description":"out of meta for effective search","type":"string"},"category":{"type":"string"},"chain":{"type":"string"},"market_id":{"type":"string"},"meta":{},"name":{"type":"string"},"participating_tokens":{"description":"slice of tokenIDs // no need for more for creating a market","type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platform":{"type":"string"},"rate_format":{"type":"string"},"tvl_usd":{"description":"in usd","type":"string"},"yield_type":{"description":"user inserts","type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/markets/{market_id}":{"get":{"description":"Get market by id.","tags":["Markets"],"summary":"Get market","parameters":[{"schema":{"type":"string"},"description":"market id","name":"market_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/core.MarketCurrentResponse"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Market history metrics

> Get market historical metrics for a given period.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Unified DeFi markets – Staking/LST, DEX, Lending, Fixed Income, Structured Vaults, Stablecoins","name":"Markets"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.MarketHistoryResponse":{"type":"object","properties":{"history":{"description":"category specific history metrics","type":"array","items":{"$ref":"#/components/schemas/core.History"}},"market_id":{"description":"key in portals","type":"string"},"rate_format":{"type":"string"},"yield_type":{"description":"admin inserts","type":"string"}}},"core.History":{"type":"object","properties":{"annual_rate":{"description":"out of meta for effective search. NEED ONLY FOR SEARCH. NOT OUTPUT. META ALREADY CONTAINS ALL INFO","type":"string"},"timestamp":{"description":"Meta      common.Meta `json:\"meta\"` // временно забиваем","type":"string"},"tvl_usd":{"description":"in usd","type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/markets/{market_id}/metrics":{"get":{"description":"Get market historical metrics for a given period.","tags":["Markets"],"summary":"Market history metrics","parameters":[{"schema":{"type":"string"},"description":"market id","name":"market_id","in":"path","required":true},{"schema":{"type":"string"},"description":"start time RFC3339","name":"from","in":"query"},{"schema":{"type":"string"},"description":"end time RFC3339","name":"to","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/core.MarketHistoryResponse"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Market token roles

> List roles tokens can play in markets.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Unified DeFi markets – Staking/LST, DEX, Lending, Fixed Income, Structured Vaults, Stablecoins","name":"Markets"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/roles":{"get":{"description":"List roles tokens can play in markets.","tags":["Markets"],"summary":"Market token roles","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"type":"array","items":{"type":"string"}}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```


# Strategies

Strategies – list, details by strategyId (future extension)

## Get engines

> List strategy engines.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Strategies – list, details by strategyId (future extension)","name":"Strategies"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.Engine":{"type":"object","properties":{"routing_engine":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/engines":{"get":{"description":"List strategy engines.","tags":["Strategies"],"summary":"Get engines","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/core.Engine"}}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get rate formats

> List rate formats.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Strategies – list, details by strategyId (future extension)","name":"Strategies"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/rates":{"get":{"description":"List rate formats.","tags":["Strategies"],"summary":"Get rate formats","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"type":"array","items":{"type":"string"}}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get risk scores

> List risk scores for strategies.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Strategies – list, details by strategyId (future extension)","name":"Strategies"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.Risk":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"risk_score":{"type":"integer"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/risks":{"get":{"description":"List risk scores for strategies.","tags":["Strategies"],"summary":"Get risk scores","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/common.Risk"}}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get strategy statuses

> List possible strategy statuses.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Strategies – list, details by strategyId (future extension)","name":"Strategies"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/statuses":{"get":{"description":"List possible strategy statuses.","tags":["Strategies"],"summary":"Get strategy statuses","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"type":"array","items":{"type":"string"}}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## List strategies

> Get paginated strategies with filters and relevance-ranked multi-term search.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Strategies – list, details by strategyId (future extension)","name":"Strategies"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.Pagination-core_StrategiesResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/core.StrategiesResponse"}},"page":{"$ref":"#/components/schemas/common.Page"}}},"core.StrategiesResponse":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"type":"array","items":{"$ref":"#/components/schemas/common.Chain"}},"description":{"type":"string"},"fee_breakdown":{"$ref":"#/components/schemas/core.Fees"},"input_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"metrics":{"$ref":"#/components/schemas/core.Metrics"},"name":{"type":"string"},"output_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/common.Platform"}},"rate_format":{"type":"string"},"risk":{"description":"upd (new)","allOf":[{"$ref":"#/components/schemas/common.Risk"}]},"status":{"type":"string"},"strategy_id":{"type":"string"},"updated_at":{"type":"integer"}}},"common.Chain":{"type":"object","properties":{"chain_id":{"description":"e.g.: \"ethereum\"","type":"string"},"ecosystem":{"type":"string"},"explorer_url":{"type":"string"},"image_url":{"type":"string"}}},"core.Fees":{"type":"object","properties":{"max_fee":{"description":"maximum possible fee","type":"string"},"partner_fee":{"type":"string"},"total_fee":{"type":"string"},"yifi_fee":{"type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"core.Metrics":{"type":"object","properties":{"annual_rate":{"description":"out of meta summin up all []meta metrics","type":"string"},"meta":{"description":"Meta carries the full point-in-time reserve snapshot for lending history.\nConcrete (not the common.Meta interface) so the response round-trips —\nclients can't unmarshal JSON into an interface. Populated on the history\nendpoint, omitted on getStrategies().","allOf":[{"$ref":"#/components/schemas/common.MetaLending"}]},"timestamp":{"type":"string"},"tvl_usd":{"type":"string"}}},"common.MetaLending":{"type":"object","properties":{"apy_tvl":{"$ref":"#/components/schemas/common.APYTVLMeta"},"atoken":{"type":"string"},"chain_id":{"type":"integer"},"irm":{"$ref":"#/components/schemas/common.IRMMeta"},"metadata":{"$ref":"#/components/schemas/common.ReserveMetadata"},"network":{"type":"string"},"underlying":{"type":"string"}}},"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"},"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}},"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}},"common.Platform":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"description":"\"ethereum\"","type":"array","items":{"type":"string"}},"image":{"type":"string"},"platform_id":{"description":"\"gyroscope\"","type":"string"},"platform_name":{"description":"\"Gyroscope\"","type":"string"}}},"common.Risk":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"risk_score":{"type":"integer"}}},"common.Page":{"type":"object","properties":{"currentPage":{"description":"page-based pagination","type":"integer"},"id":{"description":"keyset-based pagination","type":"string"},"limit":{"description":"common","type":"integer"},"nextCursor":{"type":"string"},"offset":{"description":"offset-based pagination","type":"integer"},"pageSize":{"type":"integer"},"prevCursor":{"description":"cursor-based pagination","type":"string"},"totalItems":{"type":"integer"},"totalPages":{"type":"integer"},"type":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/strategies":{"get":{"description":"Get paginated strategies with filters and relevance-ranked multi-term search.","tags":["Strategies"],"summary":"List strategies","parameters":[{"schema":{"type":"string"},"description":"multi-term search across strategies, tokens, markets, platforms, chains, and risks","name":"search","in":"query"},{"schema":{"type":"string"},"description":"strategy ids","name":"ids","in":"query"},{"schema":{"type":"string"},"description":"status","name":"status","in":"query"},{"schema":{"type":"string"},"description":"group","name":"group","in":"query"},{"schema":{"type":"string"},"description":"category ids comma separated","name":"category_ids","in":"query"},{"schema":{"type":"string"},"description":"chain ids comma separated","name":"chain_ids","in":"query"},{"schema":{"type":"string"},"description":"token ids comma separated","name":"token_ids","in":"query"},{"schema":{"type":"string"},"description":"platform ids comma separated","name":"platform_ids","in":"query"},{"schema":{"type":"string"},"description":"min tvl usd","name":"minTvlUsd","in":"query"},{"schema":{"type":"string"},"description":"max tvl usd","name":"maxTvlUsd","in":"query"},{"schema":{"type":"string"},"description":"min apr","name":"minApr","in":"query"},{"schema":{"type":"string"},"description":"max apr","name":"maxApr","in":"query"},{"schema":{"type":"integer"},"description":"maximum risk score (1-5)","name":"maxRiskScore","in":"query"},{"schema":{"type":"boolean"},"description":"invert catalog filters; search and status still apply","name":"exclude","in":"query"},{"schema":{"type":"string"},"description":"updatedAt|createdAt|apr|apy|tvlUsd|riskScore; overrides relevance","name":"sortBy","in":"query"},{"schema":{"type":"string"},"description":"asc|desc","name":"sortDirection","in":"query"},{"schema":{"type":"integer","maximum":100},"description":"limit","name":"limit","in":"query"},{"schema":{"type":"integer"},"description":"offset","name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/common.Pagination-core_StrategiesResponse"}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get strategy

> Get strategy by id.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Strategies – list, details by strategyId (future extension)","name":"Strategies"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.StrategyResponse":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"description":"upd","type":"array","items":{"$ref":"#/components/schemas/common.Chain"}},"created_at":{"type":"integer"},"default_engine":{"description":"mirror of routing_engine","type":"string"},"description":{"type":"string"},"execution_config":{"$ref":"#/components/schemas/core.ExecutionConfig"},"fallback_engines":{"description":"ordered alternatives","type":"array","items":{"type":"string"}},"fee_breakdown":{"$ref":"#/components/schemas/core.Fees"},"input_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"limits":{"$ref":"#/components/schemas/core.Limits"},"market_ids":{"type":"array","items":{"type":"string"}},"metrics":{"$ref":"#/components/schemas/core.Metrics"},"name":{"type":"string"},"output_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platforms":{"description":"upd (new)","type":"array","items":{"$ref":"#/components/schemas/common.Platform"}},"rate_format":{"type":"string"},"risk":{"description":"upd (new)","allOf":[{"$ref":"#/components/schemas/common.Risk"}]},"routing_engine":{"description":"default engine (back-compat name)","type":"string"},"status":{"type":"string"},"strategy_id":{"type":"string"},"updated_at":{"type":"integer"},"yield_type":{"type":"string"}}},"common.Chain":{"type":"object","properties":{"chain_id":{"description":"e.g.: \"ethereum\"","type":"string"},"ecosystem":{"type":"string"},"explorer_url":{"type":"string"},"image_url":{"type":"string"}}},"core.ExecutionConfig":{"type":"object","properties":{"input_token_ids":{"type":"array","items":{"type":"string"}},"output_token_ids":{"type":"array","items":{"type":"string"}}}},"core.Fees":{"type":"object","properties":{"max_fee":{"description":"maximum possible fee","type":"string"},"partner_fee":{"type":"string"},"total_fee":{"type":"string"},"yifi_fee":{"type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"core.Limits":{"type":"object","properties":{"deposits_paused":{"type":"boolean"},"withdrawals_paused":{"type":"boolean"}}},"core.Metrics":{"type":"object","properties":{"annual_rate":{"description":"out of meta summin up all []meta metrics","type":"string"},"meta":{"description":"Meta carries the full point-in-time reserve snapshot for lending history.\nConcrete (not the common.Meta interface) so the response round-trips —\nclients can't unmarshal JSON into an interface. Populated on the history\nendpoint, omitted on getStrategies().","allOf":[{"$ref":"#/components/schemas/common.MetaLending"}]},"timestamp":{"type":"string"},"tvl_usd":{"type":"string"}}},"common.MetaLending":{"type":"object","properties":{"apy_tvl":{"$ref":"#/components/schemas/common.APYTVLMeta"},"atoken":{"type":"string"},"chain_id":{"type":"integer"},"irm":{"$ref":"#/components/schemas/common.IRMMeta"},"metadata":{"$ref":"#/components/schemas/common.ReserveMetadata"},"network":{"type":"string"},"underlying":{"type":"string"}}},"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"},"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}},"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}},"common.Platform":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"description":"\"ethereum\"","type":"array","items":{"type":"string"}},"image":{"type":"string"},"platform_id":{"description":"\"gyroscope\"","type":"string"},"platform_name":{"description":"\"Gyroscope\"","type":"string"}}},"common.Risk":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"risk_score":{"type":"integer"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/strategies/{strategy_id}":{"get":{"description":"Get strategy by id.","tags":["Strategies"],"summary":"Get strategy","parameters":[{"schema":{"type":"string"},"description":"strategy id","name":"strategy_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/core.StrategyResponse"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Strategy history

> Get strategy history metrics for period.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Strategies – list, details by strategyId (future extension)","name":"Strategies"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.StrategyHistoryResponse":{"type":"object","properties":{"history":{"type":"array","items":{"$ref":"#/components/schemas/core.Metrics"}},"rate_format":{"type":"string"},"strategy_id":{"description":"key in portals","type":"string"},"yield_type":{"type":"string"}}},"core.Metrics":{"type":"object","properties":{"annual_rate":{"description":"out of meta summin up all []meta metrics","type":"string"},"meta":{"description":"Meta carries the full point-in-time reserve snapshot for lending history.\nConcrete (not the common.Meta interface) so the response round-trips —\nclients can't unmarshal JSON into an interface. Populated on the history\nendpoint, omitted on getStrategies().","allOf":[{"$ref":"#/components/schemas/common.MetaLending"}]},"timestamp":{"type":"string"},"tvl_usd":{"type":"string"}}},"common.MetaLending":{"type":"object","properties":{"apy_tvl":{"$ref":"#/components/schemas/common.APYTVLMeta"},"atoken":{"type":"string"},"chain_id":{"type":"integer"},"irm":{"$ref":"#/components/schemas/common.IRMMeta"},"metadata":{"$ref":"#/components/schemas/common.ReserveMetadata"},"network":{"type":"string"},"underlying":{"type":"string"}}},"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"},"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}},"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/strategies/{strategy_id}/history":{"get":{"description":"Get strategy history metrics for period.","tags":["Strategies"],"summary":"Strategy history","parameters":[{"schema":{"type":"string"},"description":"strategy id","name":"strategy_id","in":"path","required":true},{"schema":{"type":"string"},"description":"start time RFC3339","name":"from","in":"query"},{"schema":{"type":"string"},"description":"end time RFC3339","name":"to","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/core.StrategyHistoryResponse"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get yields

> List strategy yield types.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Strategies – list, details by strategyId (future extension)","name":"Strategies"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/yields":{"get":{"description":"List strategy yield types.","tags":["Strategies"],"summary":"Get yields","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"type":"array","items":{"type":"string"}}}}]}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```


# Zap

Execution layer: quotes + tx payloads for zap/unzap, and execution tracking

## Get transaction info

> Get zap transaction info by execution id.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Execution layer: quotes + tx payloads for zap/unzap, and execution tracking","name":"Zap"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.WalletTxResponse":{"type":"object","properties":{"chain_id":{"type":"string"},"created_at":{"type":"integer"},"decimals":{"type":"integer"},"input_amount":{"type":"string"},"input_amount_usd":{"type":"string"},"is_deposit":{"type":"boolean"},"is_native":{"type":"boolean"},"is_wrapped":{"type":"boolean"},"meta":{"$ref":"#/components/schemas/common.FullTxView"},"order_id":{"type":"string"},"output_amount":{"type":"string"},"output_amount_usd":{"type":"string"},"partner_fee":{"type":"string"},"partner_id":{"type":"string"},"strategy_id":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"},"token_id_actual":{"type":"string"},"token_price_usd":{"type":"string"},"tx_hash":{"type":"string"},"wallet_id":{"type":"string"},"yifi_fee":{"type":"string"}}},"common.FullTxView":{"type":"object","properties":{"block_hash":{"type":"string"},"block_number":{"type":"integer"},"effective_gas_price":{"type":"string"},"from":{"type":"string"},"gas_limit":{"type":"integer"},"gas_price":{"type":"string"},"gas_used":{"type":"integer"},"nonce":{"type":"integer"},"portal_input":{"$ref":"#/components/schemas/common.PrintablePortalInput"},"status":{"type":"integer"},"to":{"type":"string"},"token_transfers":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenTransfer"}},"transaction_fee":{"type":"string"},"tx_hash":{"type":"string"},"type":{"type":"integer"},"value":{"type":"string"},"zap":{"type":"string"}}},"common.PrintablePortalInput":{"type":"object","properties":{"calls":{"type":"array","items":{"$ref":"#/components/schemas/common.PrintablePortalCall"}},"input_amount":{"type":"string"},"input_token":{"type":"string"},"min_output_amount":{"type":"string"},"output_token":{"type":"string"},"partner":{"type":"string"},"recipient":{"type":"string"}}},"common.PrintablePortalCall":{"type":"object","properties":{"amount_index":{"type":"string"},"data":{"type":"string"},"input_token":{"type":"string"},"target":{"type":"string"}}},"common.TokenTransfer":{"type":"object","properties":{"amount":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"token":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/tx/{execution_id}":{"get":{"description":"Get zap transaction info by execution id.","tags":["Zap"],"summary":"Get transaction info","parameters":[{"schema":{"type":"string"},"description":"execution id","name":"execution_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/core.WalletTxResponse"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Build zap

> Build zap transaction signature.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Execution layer: quotes + tx payloads for zap/unzap, and execution tracking","name":"Zap"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.Signature":{"type":"object","properties":{"approval_address":{"description":"spender to approve before sending","type":"string"},"chainId":{"description":"chain slug the tx executes on","type":"string"},"data":{"type":"string"},"engine":{"description":"Engine routing metadata (multi-engine support). Additive; portals leaves\nthem empty when it has no equivalent.","type":"string"},"from":{"type":"string"},"gasLimit":{"type":"string"},"min_output_amount":{"type":"string"},"orderId":{"type":"string"},"output_amount":{"type":"string"},"to":{"type":"string"},"value":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}},"core.ZapQuoteRequest":{"type":"object","properties":{"engine":{"description":"Engine is an optional routing-engine override. Empty means use the\nstrategy's default_engine; the frontend sets this to a strategy fallback\nengine when the user picks \"use alternative route\" after a failure.","type":"string"},"input_amount":{"description":"The quantity of inputToken to spend in inputToken base units","type":"string"},"input_token":{"description":"The ERC20 token address to spend (e.g. DAI, USDC, etc.). Use address(0) for the native token. Address must be prepended with the network name. (e.g ethereum:0x6B175474E89094C44Da98b954EedeAC495271d0F for DAI)","type":"string"},"order_id":{"description":"OrderID is required and identifies the frozen quote returned by /zap/quote.\nBuild returns the same id and the transaction captured with that quote.","type":"string"},"output_token":{"description":"The ERC20 token address to receive (e.g. DAI, USDC, etc.). Use address(0) for the native token. Address must be prepended with the network name. (e.g ethereum:0x6B175474E89094C44Da98b954EedeAC495271d0F for DAI)","type":"string"},"partner_fee":{"description":"if partner has set a policy on this strategy, then its fee will be added to fees","type":"string"},"partner_id":{"description":"needed for gateway service to attach it from partners policy response","type":"string"},"sender":{"description":"The address of the owner of the inputToken.","type":"string"},"slippage_tolerance_percentage":{"description":"The maximum acceptable slippage for the portal. Must be a number between 0.1 and 10 (e.g. 0.25 for 0.25%, 2 for 2%). If not set, auto slippage will be used instead (requires that validate is set to true)","type":"string"},"strategy_id":{"type":"string"}}}}},"paths":{"/zap/build":{"post":{"description":"Build zap transaction signature.","tags":["Zap"],"summary":"Build zap","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"X-YIFI-PARTNER-ID","in":"header"},{"schema":{"type":"string"},"description":"API key","name":"X-YIFI-API-KEY","in":"header"},{"schema":{"type":"string"},"description":"Timestamp in milliseconds","name":"X-YIFI-NONCE","in":"header"},{"schema":{"type":"string"},"description":"HMAC-SHA256 signature","name":"X-YIFI-SIGN","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/core.Signature"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"410":{"description":"Gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ZapQuoteRequest"}}},"description":"zap quote request","required":true}}}}}
```

## Get zap quote

> Get zap quote from core service.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Execution layer: quotes + tx payloads for zap/unzap, and execution tracking","name":"Zap"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.ZapQuoteResponse":{"type":"object","properties":{"approval_address":{"description":"spender to approve (estimate.approvalAddress / context.target)","type":"string"},"approval_required":{"description":"sender must approve before build can execute","type":"boolean"},"engine":{"description":"Engine routing metadata (multi-engine support). Additive; a connector\nleaves empty anything it has no source for.","type":"string"},"engine_route_tool":{"description":"e.g. \"composer\", \"0x\", a DEX name","type":"string"},"fee_amount":{"type":"string"},"fee_amount_usd":{"type":"number"},"fee_recipient":{"description":"FeeSplitter address; filled core-side from config","type":"string"},"fee_token":{"type":"string"},"gas_estimate":{"description":"nullable; only lifi populates","allOf":[{"$ref":"#/components/schemas/common.GasEstimate"}]},"min_output_amount":{"type":"string"},"min_output_amount_usd":{"type":"number"},"order_id":{"type":"string"},"output_amount":{"type":"string"},"output_amount_usd":{"type":"number"},"output_token":{"type":"string"},"slippage_tolerance_percentage":{"type":"string"},"steps":{"type":"array","items":{"type":"string"}}}},"common.GasEstimate":{"type":"object","properties":{"amount":{"description":"base units of Token","type":"string"},"amount_usd":{"description":"USD value if the engine gives one","type":"number"},"token":{"description":"token_id ({chain}:{address})","type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}},"core.ZapQuoteRequest":{"type":"object","properties":{"engine":{"description":"Engine is an optional routing-engine override. Empty means use the\nstrategy's default_engine; the frontend sets this to a strategy fallback\nengine when the user picks \"use alternative route\" after a failure.","type":"string"},"input_amount":{"description":"The quantity of inputToken to spend in inputToken base units","type":"string"},"input_token":{"description":"The ERC20 token address to spend (e.g. DAI, USDC, etc.). Use address(0) for the native token. Address must be prepended with the network name. (e.g ethereum:0x6B175474E89094C44Da98b954EedeAC495271d0F for DAI)","type":"string"},"order_id":{"description":"OrderID is required and identifies the frozen quote returned by /zap/quote.\nBuild returns the same id and the transaction captured with that quote.","type":"string"},"output_token":{"description":"The ERC20 token address to receive (e.g. DAI, USDC, etc.). Use address(0) for the native token. Address must be prepended with the network name. (e.g ethereum:0x6B175474E89094C44Da98b954EedeAC495271d0F for DAI)","type":"string"},"partner_fee":{"description":"if partner has set a policy on this strategy, then its fee will be added to fees","type":"string"},"partner_id":{"description":"needed for gateway service to attach it from partners policy response","type":"string"},"sender":{"description":"The address of the owner of the inputToken.","type":"string"},"slippage_tolerance_percentage":{"description":"The maximum acceptable slippage for the portal. Must be a number between 0.1 and 10 (e.g. 0.25 for 0.25%, 2 for 2%). If not set, auto slippage will be used instead (requires that validate is set to true)","type":"string"},"strategy_id":{"type":"string"}}}}},"paths":{"/zap/quote":{"post":{"description":"Get zap quote from core service.","tags":["Zap"],"summary":"Get zap quote","parameters":[{"schema":{"type":"boolean"},"description":"partner flag","name":"partner","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/common.ZapQuoteResponse"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ZapQuoteRequest"}}},"description":"zap quote request","required":true}}}}}
```


# Partners

B2B attribution: partner analytics, strategy policy and revenue share reporting

## Get supported chains

> Returns chains supported by the partners service.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"models.Chain":{"type":"object","properties":{"chain_id":{"type":"integer"},"chain_name":{"type":"string"},"distributor":{"description":"Distributor is the TokenDistributor contract address on this chain (empty if not deployed)","type":"string"},"is_evm":{"type":"boolean"},"provider":{"type":"string"}}},"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/supported-chains":{"get":{"description":"Returns chains supported by the partners service.","tags":["Partners"],"summary":"Get supported chains","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/models.Chain"}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}}}}}}
```

## Cancel partner TOTP

> Disables TOTP for the authenticated partner after verifying the current code.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"auth.TOTPCancelResponse":{"type":"object","properties":{"cancelled":{"type":"boolean"}}},"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"partnertotp.TOTPCancelRequest":{"type":"object","properties":{"totp_code":{"type":"string"}}}}},"paths":{"/partners/totp/cancel":{"post":{"description":"Disables TOTP for the authenticated partner after verifying the current code.","tags":["Partners"],"summary":"Cancel partner TOTP","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/auth.TOTPCancelResponse"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/rest.Response"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/partnertotp.TOTPCancelRequest"}}},"description":"TOTP cancel payload","required":true}}}}}
```

## Check partner TOTP status

> Returns true if the authenticated partner has TOTP enabled.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"auth.TOTPEnabledResponse":{"type":"object","properties":{"enabled":{"type":"boolean"}}}}},"paths":{"/partners/totp/enabled":{"get":{"description":"Returns true if the authenticated partner has TOTP enabled.","tags":["Partners"],"summary":"Check partner TOTP status","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/auth.TOTPEnabledResponse"}}}}}}}}}
```

## Reset partner TOTP

> Resets the partner's TOTP configuration using the email reset code.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"auth.TOTPResetResponse":{"type":"object","properties":{"reset":{"type":"boolean"}}},"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"partnertotp.TOTPResetRequest":{"type":"object","properties":{"email_code":{"type":"string"}}}}},"paths":{"/partners/totp/reset":{"post":{"description":"Resets the partner's TOTP configuration using the email reset code.","tags":["Partners"],"summary":"Reset partner TOTP","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/auth.TOTPResetResponse"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/rest.Response"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/partnertotp.TOTPResetRequest"}}},"description":"TOTP reset payload","required":true}}}}}
```

## Send TOTP reset code

> Sends a reset code to the partner's registered email address.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}}},"paths":{"/partners/totp/reset/send-code":{"post":{"description":"Sends a reset code to the partner's registered email address.","tags":["Partners"],"summary":"Send TOTP reset code","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"string"}}}}}}}}}
```

## Setup partner TOTP

> Generates a TOTP secret and QR code for the authenticated partner. Returns an error if TOTP is already configured.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"auth.TOTPSetupResponse":{"type":"object","properties":{"qr_png_base64":{"type":"string"},"qr_uri":{"type":"string"},"secret":{"type":"string"}}}}},"paths":{"/partners/totp/setup":{"post":{"description":"Generates a TOTP secret and QR code for the authenticated partner. Returns an error if TOTP is already configured.","tags":["Partners"],"summary":"Setup partner TOTP","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/auth.TOTPSetupResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"string"}}}}}}}}}
```

## Verify partner TOTP code

> Verifies a TOTP code for the authenticated partner.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"auth.TOTPVerifyResponse":{"type":"object","properties":{"valid":{"type":"boolean"}}},"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"partnertotp.TOTPVerifyRequest":{"type":"object","properties":{"code":{"type":"string"}}}}},"paths":{"/partners/totp/verify":{"post":{"description":"Verifies a TOTP code for the authenticated partner.","tags":["Partners"],"summary":"Verify partner TOTP code","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/auth.TOTPVerifyResponse"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/rest.Response"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/partnertotp.TOTPVerifyRequest"}}},"description":"TOTP verification payload","required":true}}}}}
```

## Get API keys

> Returns all API keys for a partner.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"models.APIKey":{"type":"object","properties":{"api_key":{"description":"essential key to be used by","type":"string"},"created_at":{"type":"string"},"hash":{"description":"чтобы декриптнуть локально","type":"array","items":{"type":"integer"}},"meta":{},"name":{"type":"string"},"prefix":{"type":"string"},"revoked_at":{"type":"string"},"secret_byte":{"description":"this is his secret token to sign, shown just one time","type":"array","items":{"type":"integer"}},"status":{"type":"boolean"}}},"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/api-keys":{"get":{"description":"Returns all API keys for a partner.","tags":["Partners"],"summary":"Get API keys","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/models.APIKey"}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}}}}}}
```

## Create API key

> Creates a new API key for a partner.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"models.APIKeyFull":{"type":"object","properties":{"api_key":{"description":"essential key to be used by","type":"string"},"created_at":{"type":"string"},"hash":{"description":"чтобы декриптнуть локально","type":"array","items":{"type":"integer"}},"meta":{},"name":{"type":"string"},"prefix":{"type":"string"},"revoked_at":{"type":"string"},"secret":{"type":"string"},"secret_byte":{"description":"this is his secret token to sign, shown just one time","type":"array","items":{"type":"integer"}},"status":{"type":"boolean"}}},"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}},"core.CreateAPIKeyRequest":{"type":"object","properties":{"name":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/api-keys":{"post":{"description":"Creates a new API key for a partner.","tags":["Partners"],"summary":"Create API key","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.APIKeyFull"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.CreateAPIKeyRequest"}}},"description":"API key payload","required":true}}}}}
```

## Revoke API key

> Revokes a partner API key.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/api-keys/{api_key}":{"delete":{"description":"Revokes a partner API key.","tags":["Partners"],"summary":"Revoke API key","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true},{"schema":{"type":"string"},"description":"API key","name":"api_key","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}}}}}}
```

## Get claim addresses

> Returns all claim addresses for a partner.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"models.ClaimAddress":{"type":"object","properties":{"address":{"type":"string"},"chain_id":{"type":"integer"},"created_at":{"type":"string"},"name":{"type":"string"},"partner_id":{"type":"string"},"status":{"type":"boolean"},"updated_at":{"type":"string"}}},"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/claim-addresses":{"get":{"description":"Returns all claim addresses for a partner.","tags":["Partners"],"summary":"Get claim addresses","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/models.ClaimAddress"}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}}}}}}
```

## Attach new claim address

> Adds a new claim address for a partner. Pass chain\_id="EVM" to attach to all EVM chains. If an address already exists on the target chain and TOTP is enabled, totp\_code is required.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/claim-addresses":{"post":{"description":"Adds a new claim address for a partner. Pass chain_id=\"EVM\" to attach to all EVM chains. If an address already exists on the target chain and TOTP is enabled, totp_code is required.","tags":["Partners"],"summary":"Attach new claim address","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"Claim address payload {chain_id: int|string|","required":true}}}}}
```

## Update claim address

> Changes an existing claim address for a partner. Pass chain\_id="EVM" to apply to all EVM chains. If the partner has TOTP enabled, totp\_code is required.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/claim-addresses/{chain_id}":{"put":{"description":"Changes an existing claim address for a partner. Pass chain_id=\"EVM\" to apply to all EVM chains. If the partner has TOTP enabled, totp_code is required.","tags":["Partners"],"summary":"Update claim address","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Chain ID or EVM","name":"chain_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"New address and optional label {address: string, name?: string, totp_code?: string}","required":true}}}}}
```

## Get fee balance

> Returns the current fee balance for a partner.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"models.Balance":{"type":"object","properties":{"claimable_usd":{"type":"string"},"partner_id":{"type":"string"},"pending_usd":{"type":"string"},"tokens":{"type":"array","items":{"$ref":"#/components/schemas/models.TokenBalanceView"}},"total_usd":{"type":"string"},"updated_at":{"type":"string"}}},"models.TokenBalanceView":{"type":"object","properties":{"amount":{"$ref":"#/components/schemas/models.TokenAmount"},"amount_usd":{"type":"string"},"chain_id":{"type":"integer"},"claimable_usd":{"type":"string"},"decimals":{"type":"integer"},"is_native":{"type":"boolean"},"is_wrapped":{"type":"boolean"},"pending_usd":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"models.TokenAmount":{"type":"object","properties":{"free":{"description":"Free is accrued but not yet pushed to the TokenDistributor.","type":"string"},"pending":{"description":"Pending is pushed to the TokenDistributor and claimable on-chain.","type":"string"},"total":{"description":"Total = Free + Pending, the whole fee balance for the token.","type":"string"}}},"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/fee-balance":{"get":{"description":"Returns the current fee balance for a partner.","tags":["Partners"],"summary":"Get fee balance","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.Balance"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}}}}}}
```

## Claim fees

> Submits a fee claim for a partner.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"models.TxInfo":{"type":"object","properties":{"amount_sent":{"type":"string"},"chain_id":{"type":"integer"},"claim_id":{"type":"string"},"data":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"token_id":{"type":"string"},"tx_hash":{"type":"string"},"value":{"type":"string"}}},"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}},"models.PartnerFeeClaimRequest":{"type":"object","properties":{"chain_id":{"type":"string"},"claim_address":{"type":"string"},"partner_id":{"type":"string"},"token_id":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/fees/claim":{"post":{"description":"Submits a fee claim for a partner.","tags":["Partners"],"summary":"Claim fees","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.TxInfo"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.PartnerFeeClaimRequest"}}},"description":"Claim fees payload","required":true}}}}}
```

## Claim all fees

> Claims every token's whole fee balance on a chain for a partner.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"models.TxInfo":{"type":"object","properties":{"amount_sent":{"type":"string"},"chain_id":{"type":"integer"},"claim_id":{"type":"string"},"data":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"token_id":{"type":"string"},"tx_hash":{"type":"string"},"value":{"type":"string"}}},"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}},"core.ClaimAllFeesRequest":{"type":"object","properties":{"chain_id":{"type":"string"},"claim_address":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/fees/claim-all":{"post":{"description":"Claims every token's whole fee balance on a chain for a partner.","tags":["Partners"],"summary":"Claim all fees","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.TxInfo"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ClaimAllFeesRequest"}}},"description":"Claim all fees payload","required":true}}}}}
```

## Get partner metrics

> Returns aggregated partner metrics for the given time range.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"models.Metrics":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/models.Metric"}},"partner_id":{"type":"string"},"updated_at":{"description":"last time user updated (or us) his summuary (хранится в кэше, обновлять можно руками, можем сами)","type":"string"}}},"models.Metric":{"type":"object","properties":{"deposits_usd":{"type":"string"},"fees_earned_usd":{"type":"string"},"strategy_id":{"type":"string"},"transactions_count":{"type":"integer"},"users_count":{"type":"integer"},"withdrawals_usd":{"type":"string"}}},"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/metrics":{"get":{"description":"Returns aggregated partner metrics for the given time range.","tags":["Partners"],"summary":"Get partner metrics","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Period shortcut: 24h (rolling), today (calendar day), 7d, 30d, 90d, All (default All)","name":"period","in":"query"},{"schema":{"type":"string"},"description":"From date (RFC3339 or YYYY-MM-DD), overrides period","name":"from","in":"query"},{"schema":{"type":"string"},"description":"To date (RFC3339 or YYYY-MM-DD), inclusive end-of-day when date-only; overrides period","name":"to","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.Metrics"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}}}}}}
```

## Performance by strategy

> Returns aggregated performance metrics per strategy for the partner's users.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"core.StrategyPerformanceResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/core.StrategyPerformance"}},"limit":{"type":"integer"},"offset":{"type":"integer"},"total":{"type":"integer"}}},"core.StrategyPerformance":{"type":"object","properties":{"deposits_amount":{"type":"string"},"deposits_amount_usd":{"type":"string"},"deposits_count":{"type":"integer"},"deposits_token":{"type":"string"},"fees_by_token":{"type":"array","items":{"$ref":"#/components/schemas/core.StrategyFeeBreakdown"}},"fees_earned_usd":{"type":"string"},"strategy_id":{"type":"string"},"strategy_name":{"type":"string"},"wallets_participated":{"type":"integer"},"withdrawals_amount":{"type":"string"},"withdrawals_amount_usd":{"type":"string"},"withdrawals_count":{"type":"integer"},"withdrawals_token":{"type":"string"}}},"core.StrategyFeeBreakdown":{"type":"object","properties":{"fee_amount":{"type":"string"},"fee_amount_usd":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/performance":{"get":{"description":"Returns aggregated performance metrics per strategy for the partner's users.","tags":["Partners"],"summary":"Performance by strategy","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Period shortcut: 24h, 7d, 30d, 90d, All (default All)","name":"period","in":"query"},{"schema":{"type":"string"},"description":"From date (RFC3339 or YYYY-MM-DD), overrides period","name":"from","in":"query"},{"schema":{"type":"string"},"description":"To date (RFC3339 or YYYY-MM-DD), overrides period","name":"to","in":"query"},{"schema":{"type":"string"},"description":"Comma-separated wallet IDs","name":"wallet_ids","in":"query"},{"schema":{"type":"string"},"description":"Comma-separated strategy IDs","name":"strategy_ids","in":"query"},{"schema":{"type":"string"},"description":"Comma-separated chain IDs","name":"chain_ids","in":"query"},{"schema":{"type":"string"},"description":"deposit | withdrawal | deposit,withdrawal","name":"type","in":"query"},{"schema":{"type":"integer"},"description":"Page size (default 5)","name":"limit","in":"query"},{"schema":{"type":"integer"},"description":"Page offset","name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.StrategyPerformanceResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}}}}}}
```

## Get partner policy

> Returns the active policy for a partner.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"core.Policy":{"type":"object","properties":{"allow_strategy_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"type":"array","items":{"type":"string"}},"deny_strategy_ids":{"type":"array","items":{"type":"string"}},"fees_policies":{"$ref":"#/components/schemas/core.FeePolicy"},"maxRiskScore":{"type":"integer","maximum":5,"minimum":1},"minApr":{"type":"string"},"minTvlUsd":{"type":"string"},"rate_format":{"type":"string","enum":["apr","apy"]},"updated_at":{"type":"string"}}},"core.FeePolicy":{"type":"object","properties":{"common_fee":{"type":"string"},"strategies_fee":{"type":"array","items":{"$ref":"#/components/schemas/models.StrategyFee"}}}},"models.StrategyFee":{"type":"object","properties":{"partner_fee_preference":{"type":"string"},"strategy_id":{"type":"string"}}},"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/policy":{"get":{"description":"Returns the active policy for a partner.","tags":["Partners"],"summary":"Get partner policy","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Policy"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}}}}}}
```

## Update partner policy

> Replaces the partner policy.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}},"core.Policy":{"type":"object","properties":{"allow_strategy_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"type":"array","items":{"type":"string"}},"deny_strategy_ids":{"type":"array","items":{"type":"string"}},"fees_policies":{"$ref":"#/components/schemas/core.FeePolicy"},"maxRiskScore":{"type":"integer","maximum":5,"minimum":1},"minApr":{"type":"string"},"minTvlUsd":{"type":"string"},"rate_format":{"type":"string","enum":["apr","apy"]},"updated_at":{"type":"string"}}},"core.FeePolicy":{"type":"object","properties":{"common_fee":{"type":"string"},"strategies_fee":{"type":"array","items":{"$ref":"#/components/schemas/models.StrategyFee"}}}},"models.StrategyFee":{"type":"object","properties":{"partner_fee_preference":{"type":"string"},"strategy_id":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/policy":{"put":{"description":"Replaces the partner policy.","tags":["Partners"],"summary":"Update partner policy","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Policy"}}},"description":"Policy payload","required":true}}}}}
```

## Update strategy-specific partner fee

> Sets or resets the partner fee preference for a single strategy.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/policy/strategies/{strategy_id}/fee":{"put":{"description":"Sets or resets the partner fee preference for a single strategy.","tags":["Partners"],"summary":"Update strategy-specific partner fee","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Strategy ID","name":"strategy_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"Fee payload {partner_fee_preference?: string}","required":true}}}}}
```

## Get partner summary

> Returns summary stats for a partner for the given time range.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"models.Summary":{"type":"object","properties":{"deposits_usd":{"type":"string"},"fees_earned_usd":{"type":"string"},"from":{"type":"string"},"partner_id":{"type":"string"},"to":{"type":"string"},"transactions_count":{"type":"integer"},"updated_at":{"description":"last time user updated (or us) his summuary (хранится в кэше, обновлять можно руками, можем сами)","type":"string"},"users_count":{"type":"integer"},"withdrawals_usd":{"type":"string"}}},"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/summary":{"get":{"description":"Returns summary stats for a partner for the given time range.","tags":["Partners"],"summary":"Get partner summary","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Period shortcut: 24h (rolling), today (calendar day), 7d, 30d, 90d, All (default All)","name":"period","in":"query"},{"schema":{"type":"string"},"description":"From date (RFC3339 or YYYY-MM-DD), overrides period","name":"from","in":"query"},{"schema":{"type":"string"},"description":"To date (RFC3339 or YYYY-MM-DD), inclusive end-of-day when date-only; overrides period","name":"to","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.Summary"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}}}}}}
```

## List partner transactions

> Returns paginated user transactions for a partner with optional filters.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"core.PartnerTransactionsResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/core.PartnerTransaction"}},"limit":{"type":"integer"},"offset":{"type":"integer"},"total":{"type":"integer"}}},"core.PartnerTransaction":{"type":"object","properties":{"chain":{"type":"string"},"date":{"type":"string"},"fee_amount":{"type":"string"},"fee_amount_usd":{"type":"string"},"fee_token":{"type":"string"},"input_amount":{"type":"string"},"input_amount_usd":{"type":"string"},"input_token":{"type":"string"},"output_amount":{"type":"string"},"output_amount_usd":{"type":"string"},"output_token":{"type":"string"},"strategy":{"type":"string"},"strategy_name":{"type":"string"},"tx_hash":{"type":"string"},"type":{"type":"string"},"wallet":{"type":"string"}}},"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/transactions":{"get":{"description":"Returns paginated user transactions for a partner with optional filters.","tags":["Partners"],"summary":"List partner transactions","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Period shortcut: 24h, 7d, 30d, 90d, All (default All)","name":"period","in":"query"},{"schema":{"type":"string"},"description":"From date (RFC3339 or YYYY-MM-DD), overrides period","name":"from","in":"query"},{"schema":{"type":"string"},"description":"To date (RFC3339 or YYYY-MM-DD), overrides period","name":"to","in":"query"},{"schema":{"type":"string"},"description":"Comma-separated wallet IDs","name":"wallet_ids","in":"query"},{"schema":{"type":"string"},"description":"Comma-separated strategy IDs","name":"strategy_ids","in":"query"},{"schema":{"type":"string"},"description":"Comma-separated chain IDs","name":"chain_ids","in":"query"},{"schema":{"type":"string"},"description":"Filter by tx hash substring","name":"hash","in":"query"},{"schema":{"type":"string"},"description":"deposit | withdrawal | deposit,withdrawal","name":"type","in":"query"},{"schema":{"type":"integer"},"description":"Page size","name":"limit","in":"query"},{"schema":{"type":"integer"},"description":"Page offset","name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.PartnerTransactionsResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}}}}}}
```

## Export partner transactions to CSV

> Exports all user transactions for a partner as CSV.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"B2B attribution: partner analytics, strategy policy and revenue share reporting","name":"Partners"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/partners/{partner_id}/transactions/export":{"get":{"description":"Exports all user transactions for a partner as CSV.","tags":["Partners"],"summary":"Export partner transactions to CSV","parameters":[{"schema":{"type":"string"},"description":"Partner ID","name":"partner_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Period shortcut: 24h, 7d, 30d, 90d, All (default All)","name":"period","in":"query"},{"schema":{"type":"string"},"description":"From date (RFC3339 or YYYY-MM-DD), overrides period","name":"from","in":"query"},{"schema":{"type":"string"},"description":"To date (RFC3339 or YYYY-MM-DD), overrides period","name":"to","in":"query"},{"schema":{"type":"string"},"description":"Comma-separated wallet IDs","name":"wallet_ids","in":"query"},{"schema":{"type":"string"},"description":"Comma-separated strategy IDs","name":"strategy_ids","in":"query"},{"schema":{"type":"string"},"description":"Comma-separated chain IDs","name":"chain_ids","in":"query"},{"schema":{"type":"string"},"description":"Filter by tx hash substring","name":"hash","in":"query"},{"schema":{"type":"string"},"description":"deposit | withdrawal | deposit,withdrawal","name":"type","in":"query"}],"responses":{"200":{"description":"CSV file","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Bad Request","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/core.ErrorResponse"}}}}}}}}}
```


# Transactions

Track of actions: wallets transactions interacting with yifi

## Get wallet position events

> Get position summary and deposit/withdrawal events for a wallet and strategy within a time range.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Track of actions: wallets transactions interacting with yifi","name":"Transactions"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.PositionEventsResponse":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionEventView"}},"meta":{"$ref":"#/components/schemas/core.PositionMeta"},"pagination":{"$ref":"#/components/schemas/core.PositionPagination"},"pnl":{"$ref":"#/components/schemas/core.PositionPnL"},"tokens":{"$ref":"#/components/schemas/core.PositionTokens"}}},"core.PositionEventView":{"type":"object","properties":{"apy_snapshot_pct":{"type":"string"},"balance_after":{"$ref":"#/components/schemas/core.EventBalance"},"block_number":{"type":"integer"},"chain":{"type":"string"},"explorer_url":{"type":"string"},"fee":{"$ref":"#/components/schemas/core.EventFee"},"gas":{"$ref":"#/components/schemas/core.EventGas"},"received":{"$ref":"#/components/schemas/core.EventLeg"},"sent":{"$ref":"#/components/schemas/core.EventLeg"},"timestamp":{"description":"unix seconds","type":"integer"},"tx_hash":{"type":"string"},"type":{"description":"deposit | withdraw","type":"string"}}},"core.EventBalance":{"type":"object","properties":{"share_balance":{"type":"string"},"share_balance_usd":{"type":"string"}}},"core.EventFee":{"type":"object","properties":{"amount":{"type":"string"},"amount_usd":{"type":"string"},"pct":{"type":"string"},"token_id":{"type":"string"}}},"core.EventGas":{"type":"object","properties":{"amount":{"description":"native token","type":"string"},"amount_usd":{"type":"string"}}},"core.EventLeg":{"type":"object","properties":{"amount_gross":{"description":"before zap fee","type":"string"},"amount_net":{"description":"after zap fee","type":"string"},"amount_usd":{"description":"historical, at the event's block","type":"string"},"token_id":{"type":"string"}}},"core.PositionMeta":{"type":"object","properties":{"chain_id":{"type":"string"},"closed_at":{"type":"integer"},"from_block":{"type":"integer"},"last_indexed_block":{"type":"integer"},"opened_at":{"type":"integer"},"share_accrual_type":{"description":"ShareAccrualType is how the share token accrues yield and thus which PnL\nbranch was used: \"appreciating\" | \"rebasing\" | \"unknown\" (§4.7). When\n\"unknown\" the PnL block is omitted (we won't risk a wrong sign).","type":"string"},"status":{"description":"active | closed","type":"string"},"strategy_id":{"type":"string"},"to_block":{"type":"integer"},"wallet":{"type":"string"}}},"core.PositionPagination":{"type":"object","properties":{"limit":{"type":"integer"},"offset":{"type":"integer"},"total_events":{"type":"integer"}}},"core.PositionPnL":{"type":"object","properties":{"balance_share":{"description":"Current live balance of the share token.","type":"string"},"balance_share_usd":{"type":"string"},"costs":{"$ref":"#/components/schemas/core.PositionPnLCosts"},"days_held":{"type":"string"},"deposited_settle_gross":{"description":"Reporting totals over the whole range (gross = before zap fee, net = after).","type":"string"},"deposited_settle_net":{"type":"string"},"gross":{"$ref":"#/components/schemas/core.PositionPnLGross"},"n_deposits":{"type":"integer"},"n_withdrawals":{"type":"integer"},"net":{"$ref":"#/components/schemas/core.PositionPnLNet"},"received_share_gross":{"type":"string"},"received_share_net":{"type":"string"},"settle_token":{"$ref":"#/components/schemas/core.SettleToken"},"withdrawn_settle_gross":{"type":"string"},"withdrawn_settle_net":{"type":"string"},"withdrawn_share_gross":{"type":"string"},"withdrawn_share_net":{"type":"string"}}},"core.PositionPnLCosts":{"type":"object","properties":{"gas_native":{"type":"string"},"gas_settle":{"type":"string"},"gas_usd":{"type":"string"},"zap_fees_settle":{"description":"deposit-side zap fees, in settle token","type":"string"},"zap_fees_share":{"description":"withdraw-side zap fees, in share token","type":"string"},"zap_fees_usd":{"type":"string"}}},"core.PositionPnLGross":{"type":"object","properties":{"pnl_settle":{"type":"string"},"pnl_settle_pct":{"type":"string"},"pnl_usd":{"type":"string"},"pnl_usd_pct":{"type":"string"},"realized_pnl_settle":{"type":"string"},"realized_pnl_usd":{"type":"string"},"unrealized_pnl_settle":{"type":"string"},"unrealized_pnl_usd":{"type":"string"}}},"core.PositionPnLNet":{"type":"object","properties":{"pnl_settle":{"type":"string"},"pnl_settle_pct":{"type":"string"},"pnl_usd":{"type":"string"},"pnl_usd_pct":{"type":"string"},"realized_pnl_settle":{"type":"string"},"unrealized_pnl_settle":{"type":"string"}}},"core.SettleToken":{"type":"object","properties":{"symbol":{"type":"string"},"token_id":{"type":"string"}}},"core.PositionTokens":{"type":"object","properties":{"gas":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionToken"}},"reward":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionToken"}},"share":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionToken"}},"underlying":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionToken"}}}},"core.PositionToken":{"type":"object","properties":{"address":{"type":"string"},"decimals":{"type":"integer"},"id":{"description":"\"chain:address\"","type":"string"},"logo_url":{"type":"string"},"name":{"type":"string"},"price_usd":{"type":"string"},"symbol":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/positions/{wallet_id}/events/{strategy_id}/{from}/{to}":{"get":{"description":"Get position summary and deposit/withdrawal events for a wallet and strategy within a time range.","tags":["Transactions"],"summary":"Get wallet position events","parameters":[{"schema":{"type":"string"},"description":"Wallet ID","name":"wallet_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Strategy ID","name":"strategy_id","in":"path","required":true},{"schema":{"type":"integer"},"description":"From timestamp","name":"from","in":"path","required":true},{"schema":{"type":"integer"},"description":"To timestamp","name":"to","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/core.PositionEventsResponse"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get wallet transactions history

> List wallet transactions for a wallet and strategy within a time range.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Track of actions: wallets transactions interacting with yifi","name":"Transactions"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.WalletTx":{"type":"object","properties":{"chain_id":{"description":"chain в котором была произведена транза и в котором накопились fees","type":"string"},"created_at":{"description":"millisecond","type":"integer"},"decimals":{"description":"decimals of the fee/input token, so downstream can scale InputAmount/fee from base units to human units","type":"integer"},"input_amount":{"description":"amount транзы прошедшей (чтобы посчитать notional amount) и обновить балансы партнёра","type":"string"},"input_amount_usd":{"type":"string"},"is_deposit":{"description":"deposit/withdrawal","type":"boolean"},"is_native":{"type":"boolean"},"is_wrapped":{"type":"boolean"},"meta":{"description":"full log","allOf":[{"$ref":"#/components/schemas/common.FullTxView"}]},"order_id":{"description":"берём  для  идемпотентности","type":"string"},"output_amount":{"description":"amount транзы прошедшей (чтобы посчитать notional amount) и обновить балансы партнёра","type":"string"},"output_amount_usd":{"type":"string"},"partner_fee":{"description":"BELOW IS NOT FOR FRONTEND\nTotalFee *decimal.Decimal `json:\"total_fee\"`\npartnerFee is attached by gateway service at buildZap","type":"string"},"partner_id":{"description":"партнёр через которого прошла транза","type":"string"},"strategy_id":{"description":"стртегия","type":"string"},"symbol":{"description":"Token metadata so downstream services (e.g. partners fee-balance) can\ndisplay the fee token without calling core on every read.","type":"string"},"token_id":{"description":"токен в котором партнёр получает fee","type":"string"},"token_id_actual":{"description":"TokenIDActual is the ERC20 that physically settled in the distributor\ncontract. When the zap input is a native coin (e.g. bsc:0x0…0), Portals\nwraps it 1:1 and delivers the fee as the wrapped token (WBNB), so the fee\non-chain is WBNB even though TokenID stays native for analytics/display.\nEmpty when core could not resolve it; downstream falls back to TokenID.","type":"string"},"token_price_usd":{"description":"инфo по транзакции","type":"string"},"tx_hash":{"description":"hash транзакции","type":"string"},"wallet_id":{"description":"юзер который отправляет запросы","type":"string"},"yifi_fee":{"description":"yifi Fee is attached by core service","type":"string"}}},"common.FullTxView":{"type":"object","properties":{"block_hash":{"type":"string"},"block_number":{"type":"integer"},"effective_gas_price":{"type":"string"},"from":{"type":"string"},"gas_limit":{"type":"integer"},"gas_price":{"type":"string"},"gas_used":{"type":"integer"},"nonce":{"type":"integer"},"portal_input":{"$ref":"#/components/schemas/common.PrintablePortalInput"},"status":{"type":"integer"},"to":{"type":"string"},"token_transfers":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenTransfer"}},"transaction_fee":{"type":"string"},"tx_hash":{"type":"string"},"type":{"type":"integer"},"value":{"type":"string"},"zap":{"type":"string"}}},"common.PrintablePortalInput":{"type":"object","properties":{"calls":{"type":"array","items":{"$ref":"#/components/schemas/common.PrintablePortalCall"}},"input_amount":{"type":"string"},"input_token":{"type":"string"},"min_output_amount":{"type":"string"},"output_token":{"type":"string"},"partner":{"type":"string"},"recipient":{"type":"string"}}},"common.PrintablePortalCall":{"type":"object","properties":{"amount_index":{"type":"string"},"data":{"type":"string"},"input_token":{"type":"string"},"target":{"type":"string"}}},"common.TokenTransfer":{"type":"object","properties":{"amount":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"token":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/transactions/{wallet_id}/history/{strategy_id}/{from}/{to}":{"get":{"description":"List wallet transactions for a wallet and strategy within a time range.","tags":["Transactions"],"summary":"Get wallet transactions history","parameters":[{"schema":{"type":"string"},"description":"Wallet ID","name":"wallet_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Strategy ID","name":"strategy_id","in":"path","required":true},{"schema":{"type":"integer"},"description":"From timestamp","name":"from","in":"path","required":true},{"schema":{"type":"integer"},"description":"To timestamp","name":"to","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/common.WalletTx"}}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get wallet transactions

> List wallet transactions by wallet id.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Track of actions: wallets transactions interacting with yifi","name":"Transactions"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.WalletTx":{"type":"object","properties":{"chain_id":{"description":"chain в котором была произведена транза и в котором накопились fees","type":"string"},"created_at":{"description":"millisecond","type":"integer"},"decimals":{"description":"decimals of the fee/input token, so downstream can scale InputAmount/fee from base units to human units","type":"integer"},"input_amount":{"description":"amount транзы прошедшей (чтобы посчитать notional amount) и обновить балансы партнёра","type":"string"},"input_amount_usd":{"type":"string"},"is_deposit":{"description":"deposit/withdrawal","type":"boolean"},"is_native":{"type":"boolean"},"is_wrapped":{"type":"boolean"},"meta":{"description":"full log","allOf":[{"$ref":"#/components/schemas/common.FullTxView"}]},"order_id":{"description":"берём  для  идемпотентности","type":"string"},"output_amount":{"description":"amount транзы прошедшей (чтобы посчитать notional amount) и обновить балансы партнёра","type":"string"},"output_amount_usd":{"type":"string"},"partner_fee":{"description":"BELOW IS NOT FOR FRONTEND\nTotalFee *decimal.Decimal `json:\"total_fee\"`\npartnerFee is attached by gateway service at buildZap","type":"string"},"partner_id":{"description":"партнёр через которого прошла транза","type":"string"},"strategy_id":{"description":"стртегия","type":"string"},"symbol":{"description":"Token metadata so downstream services (e.g. partners fee-balance) can\ndisplay the fee token without calling core on every read.","type":"string"},"token_id":{"description":"токен в котором партнёр получает fee","type":"string"},"token_id_actual":{"description":"TokenIDActual is the ERC20 that physically settled in the distributor\ncontract. When the zap input is a native coin (e.g. bsc:0x0…0), Portals\nwraps it 1:1 and delivers the fee as the wrapped token (WBNB), so the fee\non-chain is WBNB even though TokenID stays native for analytics/display.\nEmpty when core could not resolve it; downstream falls back to TokenID.","type":"string"},"token_price_usd":{"description":"инфo по транзакции","type":"string"},"tx_hash":{"description":"hash транзакции","type":"string"},"wallet_id":{"description":"юзер который отправляет запросы","type":"string"},"yifi_fee":{"description":"yifi Fee is attached by core service","type":"string"}}},"common.FullTxView":{"type":"object","properties":{"block_hash":{"type":"string"},"block_number":{"type":"integer"},"effective_gas_price":{"type":"string"},"from":{"type":"string"},"gas_limit":{"type":"integer"},"gas_price":{"type":"string"},"gas_used":{"type":"integer"},"nonce":{"type":"integer"},"portal_input":{"$ref":"#/components/schemas/common.PrintablePortalInput"},"status":{"type":"integer"},"to":{"type":"string"},"token_transfers":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenTransfer"}},"transaction_fee":{"type":"string"},"tx_hash":{"type":"string"},"type":{"type":"integer"},"value":{"type":"string"},"zap":{"type":"string"}}},"common.PrintablePortalInput":{"type":"object","properties":{"calls":{"type":"array","items":{"$ref":"#/components/schemas/common.PrintablePortalCall"}},"input_amount":{"type":"string"},"input_token":{"type":"string"},"min_output_amount":{"type":"string"},"output_token":{"type":"string"},"partner":{"type":"string"},"recipient":{"type":"string"}}},"common.PrintablePortalCall":{"type":"object","properties":{"amount_index":{"type":"string"},"data":{"type":"string"},"input_token":{"type":"string"},"target":{"type":"string"}}},"common.TokenTransfer":{"type":"object","properties":{"amount":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"token":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/transactions/{wallet_id}/stats":{"get":{"description":"List wallet transactions by wallet id.","tags":["Transactions"],"summary":"Get wallet transactions","parameters":[{"schema":{"type":"string"},"description":"wallet id","name":"wallet_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/common.WalletTx"}}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```

## Get wallet transaction

> Get a single wallet transaction by wallet id and order id.

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[{"description":"Track of actions: wallets transactions interacting with yifi","name":"Transactions"}],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerToken":[]},{"PartnerApiKey":[]}],"components":{"securitySchemes":{"BearerToken":{"description":"Admin key for privileged operations (create/edit/delete).","type":"apiKey","name":"Authorization","in":"header"},"PartnerApiKey":{"description":"Partner API key used for B2B attribution (wallets, platforms). Requests authenticated with this key are attributed to the owning partner.","type":"apiKey","name":"X-Partner-Api-Key","in":"header"}},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"common.WalletTx":{"type":"object","properties":{"chain_id":{"description":"chain в котором была произведена транза и в котором накопились fees","type":"string"},"created_at":{"description":"millisecond","type":"integer"},"decimals":{"description":"decimals of the fee/input token, so downstream can scale InputAmount/fee from base units to human units","type":"integer"},"input_amount":{"description":"amount транзы прошедшей (чтобы посчитать notional amount) и обновить балансы партнёра","type":"string"},"input_amount_usd":{"type":"string"},"is_deposit":{"description":"deposit/withdrawal","type":"boolean"},"is_native":{"type":"boolean"},"is_wrapped":{"type":"boolean"},"meta":{"description":"full log","allOf":[{"$ref":"#/components/schemas/common.FullTxView"}]},"order_id":{"description":"берём  для  идемпотентности","type":"string"},"output_amount":{"description":"amount транзы прошедшей (чтобы посчитать notional amount) и обновить балансы партнёра","type":"string"},"output_amount_usd":{"type":"string"},"partner_fee":{"description":"BELOW IS NOT FOR FRONTEND\nTotalFee *decimal.Decimal `json:\"total_fee\"`\npartnerFee is attached by gateway service at buildZap","type":"string"},"partner_id":{"description":"партнёр через которого прошла транза","type":"string"},"strategy_id":{"description":"стртегия","type":"string"},"symbol":{"description":"Token metadata so downstream services (e.g. partners fee-balance) can\ndisplay the fee token without calling core on every read.","type":"string"},"token_id":{"description":"токен в котором партнёр получает fee","type":"string"},"token_id_actual":{"description":"TokenIDActual is the ERC20 that physically settled in the distributor\ncontract. When the zap input is a native coin (e.g. bsc:0x0…0), Portals\nwraps it 1:1 and delivers the fee as the wrapped token (WBNB), so the fee\non-chain is WBNB even though TokenID stays native for analytics/display.\nEmpty when core could not resolve it; downstream falls back to TokenID.","type":"string"},"token_price_usd":{"description":"инфo по транзакции","type":"string"},"tx_hash":{"description":"hash транзакции","type":"string"},"wallet_id":{"description":"юзер который отправляет запросы","type":"string"},"yifi_fee":{"description":"yifi Fee is attached by core service","type":"string"}}},"common.FullTxView":{"type":"object","properties":{"block_hash":{"type":"string"},"block_number":{"type":"integer"},"effective_gas_price":{"type":"string"},"from":{"type":"string"},"gas_limit":{"type":"integer"},"gas_price":{"type":"string"},"gas_used":{"type":"integer"},"nonce":{"type":"integer"},"portal_input":{"$ref":"#/components/schemas/common.PrintablePortalInput"},"status":{"type":"integer"},"to":{"type":"string"},"token_transfers":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenTransfer"}},"transaction_fee":{"type":"string"},"tx_hash":{"type":"string"},"type":{"type":"integer"},"value":{"type":"string"},"zap":{"type":"string"}}},"common.PrintablePortalInput":{"type":"object","properties":{"calls":{"type":"array","items":{"$ref":"#/components/schemas/common.PrintablePortalCall"}},"input_amount":{"type":"string"},"input_token":{"type":"string"},"min_output_amount":{"type":"string"},"output_token":{"type":"string"},"partner":{"type":"string"},"recipient":{"type":"string"}}},"common.PrintablePortalCall":{"type":"object","properties":{"amount_index":{"type":"string"},"data":{"type":"string"},"input_token":{"type":"string"},"target":{"type":"string"}}},"common.TokenTransfer":{"type":"object","properties":{"amount":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"token":{"type":"string"}}},"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/transactions/{wallet_id}/stats/{order_id}":{"get":{"description":"Get a single wallet transaction by wallet id and order id.","tags":["Transactions"],"summary":"Get wallet transaction","parameters":[{"schema":{"type":"string"},"description":"Wallet ID","name":"wallet_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Order ID","name":"order_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/rest.Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/common.WalletTx"}}}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.Msg"}}}}}}}}}
```


# Admin Core

## Delete many strategies

> Deletes strategies and any markets/tokens that become orphaned

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"tags":[],"servers":[{"url":"https://core.yifi.io/api/v1"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{},"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}},"core.DeleteStrategiesReq":{"type":"object","properties":{"strategy_ids":{"type":"array","items":{"type":"string"}}}}}},"paths":{"/strategies/many":{"delete":{"description":"Deletes strategies and any markets/tokens that become orphaned","tags":["admin-core"],"summary":"Delete many strategies","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/rest.Response"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/core.DeleteStrategiesReq"}}},"description":"strategy ids","required":true}}}}}
```


# Models

## The auth.TOTPCancelResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"auth.TOTPCancelResponse":{"type":"object","properties":{"cancelled":{"type":"boolean"}}}}}}
```

## The auth.TOTPEnabledResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"auth.TOTPEnabledResponse":{"type":"object","properties":{"enabled":{"type":"boolean"}}}}}}
```

## The auth.TOTPResetResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"auth.TOTPResetResponse":{"type":"object","properties":{"reset":{"type":"boolean"}}}}}}
```

## The auth.TOTPSetupResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"auth.TOTPSetupResponse":{"type":"object","properties":{"qr_png_base64":{"type":"string"},"qr_uri":{"type":"string"},"secret":{"type":"string"}}}}}}
```

## The auth.TOTPVerifyResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"auth.TOTPVerifyResponse":{"type":"object","properties":{"valid":{"type":"boolean"}}}}}}
```

## The big.Int object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"big.Int":{"type":"object"}}}}
```

## The common.APYTVLMeta object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"}}}}
```

## The common.Address object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.Address":{"type":"object","properties":{"address":{"type":"string"},"chain_id":{"type":"string"},"decimals":{"type":"integer"}}}}}}
```

## The common.Category object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.Category":{"type":"object","properties":{"category_id":{"type":"string"},"description":{"type":"string"},"is_active":{"type":"boolean"},"name":{"type":"string"}}}}}}
```

## The common.Chain object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.Chain":{"type":"object","properties":{"chain_id":{"description":"e.g.: \"ethereum\"","type":"string"},"ecosystem":{"type":"string"},"explorer_url":{"type":"string"},"image_url":{"type":"string"}}}}}}
```

## The common.FullTxView object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.FullTxView":{"type":"object","properties":{"block_hash":{"type":"string"},"block_number":{"type":"integer"},"effective_gas_price":{"type":"string"},"from":{"type":"string"},"gas_limit":{"type":"integer"},"gas_price":{"type":"string"},"gas_used":{"type":"integer"},"nonce":{"type":"integer"},"portal_input":{"$ref":"#/components/schemas/common.PrintablePortalInput"},"status":{"type":"integer"},"to":{"type":"string"},"token_transfers":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenTransfer"}},"transaction_fee":{"type":"string"},"tx_hash":{"type":"string"},"type":{"type":"integer"},"value":{"type":"string"},"zap":{"type":"string"}}},"common.PrintablePortalInput":{"type":"object","properties":{"calls":{"type":"array","items":{"$ref":"#/components/schemas/common.PrintablePortalCall"}},"input_amount":{"type":"string"},"input_token":{"type":"string"},"min_output_amount":{"type":"string"},"output_token":{"type":"string"},"partner":{"type":"string"},"recipient":{"type":"string"}}},"common.PrintablePortalCall":{"type":"object","properties":{"amount_index":{"type":"string"},"data":{"type":"string"},"input_token":{"type":"string"},"target":{"type":"string"}}},"common.TokenTransfer":{"type":"object","properties":{"amount":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"token":{"type":"string"}}}}}}
```

## The common.GasEstimate object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.GasEstimate":{"type":"object","properties":{"amount":{"description":"base units of Token","type":"string"},"amount_usd":{"description":"USD value if the engine gives one","type":"number"},"token":{"description":"token_id ({chain}:{address})","type":"string"}}}}}}
```

## The common.GetTokensResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.GetTokensResponse":{"type":"object","properties":{"chain_ids":{"type":"array","items":{"type":"string"}},"image":{"type":"string"},"name":{"type":"string"},"symbol":{"type":"string"},"tag_ids":{"type":"array","items":{"type":"string"}},"token_group":{"type":"string"},"token_id":{"type":"string"}}}}}}
```

## The common.IRMMeta object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}}}}}
```

## The common.MetaLending object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.MetaLending":{"type":"object","properties":{"apy_tvl":{"$ref":"#/components/schemas/common.APYTVLMeta"},"atoken":{"type":"string"},"chain_id":{"type":"integer"},"irm":{"$ref":"#/components/schemas/common.IRMMeta"},"metadata":{"$ref":"#/components/schemas/common.ReserveMetadata"},"network":{"type":"string"},"underlying":{"type":"string"}}},"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"},"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}},"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}}}}}
```

## The common.Page object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.Page":{"type":"object","properties":{"currentPage":{"description":"page-based pagination","type":"integer"},"id":{"description":"keyset-based pagination","type":"string"},"limit":{"description":"common","type":"integer"},"nextCursor":{"type":"string"},"offset":{"description":"offset-based pagination","type":"integer"},"pageSize":{"type":"integer"},"prevCursor":{"description":"cursor-based pagination","type":"string"},"totalItems":{"type":"integer"},"totalPages":{"type":"integer"},"type":{"type":"string"}}}}}}
```

## The common.Pagination-common\_GetTokensResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.Pagination-common_GetTokensResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/common.GetTokensResponse"}},"page":{"$ref":"#/components/schemas/common.Page"}}},"common.GetTokensResponse":{"type":"object","properties":{"chain_ids":{"type":"array","items":{"type":"string"}},"image":{"type":"string"},"name":{"type":"string"},"symbol":{"type":"string"},"tag_ids":{"type":"array","items":{"type":"string"}},"token_group":{"type":"string"},"token_id":{"type":"string"}}},"common.Page":{"type":"object","properties":{"currentPage":{"description":"page-based pagination","type":"integer"},"id":{"description":"keyset-based pagination","type":"string"},"limit":{"description":"common","type":"integer"},"nextCursor":{"type":"string"},"offset":{"description":"offset-based pagination","type":"integer"},"pageSize":{"type":"integer"},"prevCursor":{"description":"cursor-based pagination","type":"string"},"totalItems":{"type":"integer"},"totalPages":{"type":"integer"},"type":{"type":"string"}}}}}}
```

## The common.Pagination-core\_MarketsResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.Pagination-core_MarketsResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/core.MarketsResponse"}},"page":{"$ref":"#/components/schemas/common.Page"}}},"core.MarketsResponse":{"type":"object","properties":{"annual_rate":{"description":"out of meta for effective search","type":"string"},"category":{"type":"string"},"chain":{"type":"string"},"market_id":{"type":"string"},"name":{"type":"string"},"participating_tokens":{"description":"slice of tokenIDs // no need for more for creating a market","type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platform":{"type":"string"},"rate_format":{"type":"string"},"tvl_usd":{"description":"in usd","type":"string"},"yield_type":{"description":"user inserts","type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"common.Page":{"type":"object","properties":{"currentPage":{"description":"page-based pagination","type":"integer"},"id":{"description":"keyset-based pagination","type":"string"},"limit":{"description":"common","type":"integer"},"nextCursor":{"type":"string"},"offset":{"description":"offset-based pagination","type":"integer"},"pageSize":{"type":"integer"},"prevCursor":{"description":"cursor-based pagination","type":"string"},"totalItems":{"type":"integer"},"totalPages":{"type":"integer"},"type":{"type":"string"}}}}}}
```

## The common.Pagination-core\_StrategiesResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.Pagination-core_StrategiesResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/core.StrategiesResponse"}},"page":{"$ref":"#/components/schemas/common.Page"}}},"core.StrategiesResponse":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"type":"array","items":{"$ref":"#/components/schemas/common.Chain"}},"description":{"type":"string"},"fee_breakdown":{"$ref":"#/components/schemas/core.Fees"},"input_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"metrics":{"$ref":"#/components/schemas/core.Metrics"},"name":{"type":"string"},"output_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/common.Platform"}},"rate_format":{"type":"string"},"risk":{"description":"upd (new)","allOf":[{"$ref":"#/components/schemas/common.Risk"}]},"status":{"type":"string"},"strategy_id":{"type":"string"},"updated_at":{"type":"integer"}}},"common.Chain":{"type":"object","properties":{"chain_id":{"description":"e.g.: \"ethereum\"","type":"string"},"ecosystem":{"type":"string"},"explorer_url":{"type":"string"},"image_url":{"type":"string"}}},"core.Fees":{"type":"object","properties":{"max_fee":{"description":"maximum possible fee","type":"string"},"partner_fee":{"type":"string"},"total_fee":{"type":"string"},"yifi_fee":{"type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"core.Metrics":{"type":"object","properties":{"annual_rate":{"description":"out of meta summin up all []meta metrics","type":"string"},"meta":{"description":"Meta carries the full point-in-time reserve snapshot for lending history.\nConcrete (not the common.Meta interface) so the response round-trips —\nclients can't unmarshal JSON into an interface. Populated on the history\nendpoint, omitted on getStrategies().","allOf":[{"$ref":"#/components/schemas/common.MetaLending"}]},"timestamp":{"type":"string"},"tvl_usd":{"type":"string"}}},"common.MetaLending":{"type":"object","properties":{"apy_tvl":{"$ref":"#/components/schemas/common.APYTVLMeta"},"atoken":{"type":"string"},"chain_id":{"type":"integer"},"irm":{"$ref":"#/components/schemas/common.IRMMeta"},"metadata":{"$ref":"#/components/schemas/common.ReserveMetadata"},"network":{"type":"string"},"underlying":{"type":"string"}}},"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"},"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}},"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}},"common.Platform":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"description":"\"ethereum\"","type":"array","items":{"type":"string"}},"image":{"type":"string"},"platform_id":{"description":"\"gyroscope\"","type":"string"},"platform_name":{"description":"\"Gyroscope\"","type":"string"}}},"common.Risk":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"risk_score":{"type":"integer"}}},"common.Page":{"type":"object","properties":{"currentPage":{"description":"page-based pagination","type":"integer"},"id":{"description":"keyset-based pagination","type":"string"},"limit":{"description":"common","type":"integer"},"nextCursor":{"type":"string"},"offset":{"description":"offset-based pagination","type":"integer"},"pageSize":{"type":"integer"},"prevCursor":{"description":"cursor-based pagination","type":"string"},"totalItems":{"type":"integer"},"totalPages":{"type":"integer"},"type":{"type":"string"}}}}}}
```

## The common.Platform object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.Platform":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"description":"\"ethereum\"","type":"array","items":{"type":"string"}},"image":{"type":"string"},"platform_id":{"description":"\"gyroscope\"","type":"string"},"platform_name":{"description":"\"Gyroscope\"","type":"string"}}}}}}
```

## The common.PrintablePortalCall object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.PrintablePortalCall":{"type":"object","properties":{"amount_index":{"type":"string"},"data":{"type":"string"},"input_token":{"type":"string"},"target":{"type":"string"}}}}}}
```

## The common.PrintablePortalInput object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.PrintablePortalInput":{"type":"object","properties":{"calls":{"type":"array","items":{"$ref":"#/components/schemas/common.PrintablePortalCall"}},"input_amount":{"type":"string"},"input_token":{"type":"string"},"min_output_amount":{"type":"string"},"output_token":{"type":"string"},"partner":{"type":"string"},"recipient":{"type":"string"}}},"common.PrintablePortalCall":{"type":"object","properties":{"amount_index":{"type":"string"},"data":{"type":"string"},"input_token":{"type":"string"},"target":{"type":"string"}}}}}}
```

## The common.ReserveMetadata object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}}}}}
```

## The common.Risk object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.Risk":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"risk_score":{"type":"integer"}}}}}}
```

## The common.TokenAddress object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}}}}}
```

## The common.TokenFullCurrent object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.TokenFullCurrent":{"type":"object","properties":{"addresses":{"type":"array","items":{"$ref":"#/components/schemas/common.Address"}},"circulating_supply":{"type":"string"},"fdv":{"type":"string"},"group_description":{"type":"string"},"group_name":{"type":"string"},"holders":{"type":"string"},"image":{"type":"string"},"logo_url":{"type":"string"},"market_cap":{"type":"string"},"name":{"type":"string"},"price_usd":{"type":"string"},"symbol":{"type":"string"},"tag_ids":{"type":"array","items":{"type":"string"}},"token_group":{"description":"TODO: add constraints eth, usd, euro, btc, other","type":"string"},"token_id":{"type":"string"},"volume_24h_usd":{"type":"string"}}},"common.Address":{"type":"object","properties":{"address":{"type":"string"},"chain_id":{"type":"string"},"decimals":{"type":"integer"}}}}}}
```

## The common.TokenGroup object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.TokenGroup":{"type":"object","properties":{"group_description":{"type":"string"},"group_name":{"type":"string"},"logo_url":{"type":"string"},"token_group":{"description":"TODO: add constraints eth, usd, euro, btc, other","type":"string"}}}}}}
```

## The common.TokenHistory object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.TokenHistory":{"type":"object","properties":{"metrics":{"$ref":"#/components/schemas/common.TokenStats"},"timestamp":{"type":"string"}}},"common.TokenStats":{"type":"object","properties":{"circulating_supply":{"type":"string"},"fdv":{"type":"string"},"holders":{"type":"string"},"market_cap":{"type":"string"},"price_usd":{"type":"string"},"volume_24h_usd":{"type":"string"}}}}}}
```

## The common.TokenStats object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.TokenStats":{"type":"object","properties":{"circulating_supply":{"type":"string"},"fdv":{"type":"string"},"holders":{"type":"string"},"market_cap":{"type":"string"},"price_usd":{"type":"string"},"volume_24h_usd":{"type":"string"}}}}}}
```

## The common.TokenStatsHistory object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.TokenStatsHistory":{"type":"object","properties":{"history":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenHistory"}},"token_id":{"type":"string"}}},"common.TokenHistory":{"type":"object","properties":{"metrics":{"$ref":"#/components/schemas/common.TokenStats"},"timestamp":{"type":"string"}}},"common.TokenStats":{"type":"object","properties":{"circulating_supply":{"type":"string"},"fdv":{"type":"string"},"holders":{"type":"string"},"market_cap":{"type":"string"},"price_usd":{"type":"string"},"volume_24h_usd":{"type":"string"}}}}}}
```

## The common.TokenTag object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.TokenTag":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"tag_id":{"type":"string"}}}}}}
```

## The common.TokenTransfer object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.TokenTransfer":{"type":"object","properties":{"amount":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"token":{"type":"string"}}}}}}
```

## The common.WalletTx object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.WalletTx":{"type":"object","properties":{"chain_id":{"description":"chain в котором была произведена транза и в котором накопились fees","type":"string"},"created_at":{"description":"millisecond","type":"integer"},"decimals":{"description":"decimals of the fee/input token, so downstream can scale InputAmount/fee from base units to human units","type":"integer"},"input_amount":{"description":"amount транзы прошедшей (чтобы посчитать notional amount) и обновить балансы партнёра","type":"string"},"input_amount_usd":{"type":"string"},"is_deposit":{"description":"deposit/withdrawal","type":"boolean"},"is_native":{"type":"boolean"},"is_wrapped":{"type":"boolean"},"meta":{"description":"full log","allOf":[{"$ref":"#/components/schemas/common.FullTxView"}]},"order_id":{"description":"берём  для  идемпотентности","type":"string"},"output_amount":{"description":"amount транзы прошедшей (чтобы посчитать notional amount) и обновить балансы партнёра","type":"string"},"output_amount_usd":{"type":"string"},"partner_fee":{"description":"BELOW IS NOT FOR FRONTEND\nTotalFee *decimal.Decimal `json:\"total_fee\"`\npartnerFee is attached by gateway service at buildZap","type":"string"},"partner_id":{"description":"партнёр через которого прошла транза","type":"string"},"strategy_id":{"description":"стртегия","type":"string"},"symbol":{"description":"Token metadata so downstream services (e.g. partners fee-balance) can\ndisplay the fee token without calling core on every read.","type":"string"},"token_id":{"description":"токен в котором партнёр получает fee","type":"string"},"token_id_actual":{"description":"TokenIDActual is the ERC20 that physically settled in the distributor\ncontract. When the zap input is a native coin (e.g. bsc:0x0…0), Portals\nwraps it 1:1 and delivers the fee as the wrapped token (WBNB), so the fee\non-chain is WBNB even though TokenID stays native for analytics/display.\nEmpty when core could not resolve it; downstream falls back to TokenID.","type":"string"},"token_price_usd":{"description":"инфo по транзакции","type":"string"},"tx_hash":{"description":"hash транзакции","type":"string"},"wallet_id":{"description":"юзер который отправляет запросы","type":"string"},"yifi_fee":{"description":"yifi Fee is attached by core service","type":"string"}}},"common.FullTxView":{"type":"object","properties":{"block_hash":{"type":"string"},"block_number":{"type":"integer"},"effective_gas_price":{"type":"string"},"from":{"type":"string"},"gas_limit":{"type":"integer"},"gas_price":{"type":"string"},"gas_used":{"type":"integer"},"nonce":{"type":"integer"},"portal_input":{"$ref":"#/components/schemas/common.PrintablePortalInput"},"status":{"type":"integer"},"to":{"type":"string"},"token_transfers":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenTransfer"}},"transaction_fee":{"type":"string"},"tx_hash":{"type":"string"},"type":{"type":"integer"},"value":{"type":"string"},"zap":{"type":"string"}}},"common.PrintablePortalInput":{"type":"object","properties":{"calls":{"type":"array","items":{"$ref":"#/components/schemas/common.PrintablePortalCall"}},"input_amount":{"type":"string"},"input_token":{"type":"string"},"min_output_amount":{"type":"string"},"output_token":{"type":"string"},"partner":{"type":"string"},"recipient":{"type":"string"}}},"common.PrintablePortalCall":{"type":"object","properties":{"amount_index":{"type":"string"},"data":{"type":"string"},"input_token":{"type":"string"},"target":{"type":"string"}}},"common.TokenTransfer":{"type":"object","properties":{"amount":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"token":{"type":"string"}}}}}}
```

## The common.ZapQuoteResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"common.ZapQuoteResponse":{"type":"object","properties":{"approval_address":{"description":"spender to approve (estimate.approvalAddress / context.target)","type":"string"},"approval_required":{"description":"sender must approve before build can execute","type":"boolean"},"engine":{"description":"Engine routing metadata (multi-engine support). Additive; a connector\nleaves empty anything it has no source for.","type":"string"},"engine_route_tool":{"description":"e.g. \"composer\", \"0x\", a DEX name","type":"string"},"fee_amount":{"type":"string"},"fee_amount_usd":{"type":"number"},"fee_recipient":{"description":"FeeSplitter address; filled core-side from config","type":"string"},"fee_token":{"type":"string"},"gas_estimate":{"description":"nullable; only lifi populates","allOf":[{"$ref":"#/components/schemas/common.GasEstimate"}]},"min_output_amount":{"type":"string"},"min_output_amount_usd":{"type":"number"},"order_id":{"type":"string"},"output_amount":{"type":"string"},"output_amount_usd":{"type":"number"},"output_token":{"type":"string"},"slippage_tolerance_percentage":{"type":"string"},"steps":{"type":"array","items":{"type":"string"}}}},"common.GasEstimate":{"type":"object","properties":{"amount":{"description":"base units of Token","type":"string"},"amount_usd":{"description":"USD value if the engine gives one","type":"number"},"token":{"description":"token_id ({chain}:{address})","type":"string"}}}}}}
```

## The core.ClaimAllFeesRequest object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.ClaimAllFeesRequest":{"type":"object","properties":{"chain_id":{"type":"string"},"claim_address":{"type":"string"}}}}}}
```

## The core.CreateAPIKeyRequest object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.CreateAPIKeyRequest":{"type":"object","properties":{"name":{"type":"string"}}}}}}
```

## The core.DeleteStrategiesReq object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.DeleteStrategiesReq":{"type":"object","properties":{"strategy_ids":{"type":"array","items":{"type":"string"}}}}}}}
```

## The core.Engine object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.Engine":{"type":"object","properties":{"routing_engine":{"type":"string"}}}}}}
```

## The core.ErrorResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}}}
```

## The core.EventBalance object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.EventBalance":{"type":"object","properties":{"share_balance":{"type":"string"},"share_balance_usd":{"type":"string"}}}}}}
```

## The core.EventFee object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.EventFee":{"type":"object","properties":{"amount":{"type":"string"},"amount_usd":{"type":"string"},"pct":{"type":"string"},"token_id":{"type":"string"}}}}}}
```

## The core.EventGas object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.EventGas":{"type":"object","properties":{"amount":{"description":"native token","type":"string"},"amount_usd":{"type":"string"}}}}}}
```

## The core.EventLeg object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.EventLeg":{"type":"object","properties":{"amount_gross":{"description":"before zap fee","type":"string"},"amount_net":{"description":"after zap fee","type":"string"},"amount_usd":{"description":"historical, at the event's block","type":"string"},"token_id":{"type":"string"}}}}}}
```

## The core.ExecutionConfig object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.ExecutionConfig":{"type":"object","properties":{"input_token_ids":{"type":"array","items":{"type":"string"}},"output_token_ids":{"type":"array","items":{"type":"string"}}}}}}}
```

## The core.FeePolicy object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.FeePolicy":{"type":"object","properties":{"common_fee":{"type":"string"},"strategies_fee":{"type":"array","items":{"$ref":"#/components/schemas/models.StrategyFee"}}}},"models.StrategyFee":{"type":"object","properties":{"partner_fee_preference":{"type":"string"},"strategy_id":{"type":"string"}}}}}}
```

## The core.Fees object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.Fees":{"type":"object","properties":{"max_fee":{"description":"maximum possible fee","type":"string"},"partner_fee":{"type":"string"},"total_fee":{"type":"string"},"yifi_fee":{"type":"string"}}}}}}
```

## The core.History object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.History":{"type":"object","properties":{"annual_rate":{"description":"out of meta for effective search. NEED ONLY FOR SEARCH. NOT OUTPUT. META ALREADY CONTAINS ALL INFO","type":"string"},"timestamp":{"description":"Meta      common.Meta `json:\"meta\"` // временно забиваем","type":"string"},"tvl_usd":{"description":"in usd","type":"string"}}}}}}
```

## The core.Limits object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.Limits":{"type":"object","properties":{"deposits_paused":{"type":"boolean"},"withdrawals_paused":{"type":"boolean"}}}}}}
```

## The core.MarketCurrentResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.MarketCurrentResponse":{"type":"object","properties":{"annual_rate":{"description":"out of meta for effective search","type":"string"},"category":{"type":"string"},"chain":{"type":"string"},"market_id":{"type":"string"},"meta":{},"name":{"type":"string"},"participating_tokens":{"description":"slice of tokenIDs // no need for more for creating a market","type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platform":{"type":"string"},"rate_format":{"type":"string"},"tvl_usd":{"description":"in usd","type":"string"},"yield_type":{"description":"user inserts","type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}}}}}
```

## The core.MarketHistoryResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.MarketHistoryResponse":{"type":"object","properties":{"history":{"description":"category specific history metrics","type":"array","items":{"$ref":"#/components/schemas/core.History"}},"market_id":{"description":"key in portals","type":"string"},"rate_format":{"type":"string"},"yield_type":{"description":"admin inserts","type":"string"}}},"core.History":{"type":"object","properties":{"annual_rate":{"description":"out of meta for effective search. NEED ONLY FOR SEARCH. NOT OUTPUT. META ALREADY CONTAINS ALL INFO","type":"string"},"timestamp":{"description":"Meta      common.Meta `json:\"meta\"` // временно забиваем","type":"string"},"tvl_usd":{"description":"in usd","type":"string"}}}}}}
```

## The core.MarketsResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.MarketsResponse":{"type":"object","properties":{"annual_rate":{"description":"out of meta for effective search","type":"string"},"category":{"type":"string"},"chain":{"type":"string"},"market_id":{"type":"string"},"name":{"type":"string"},"participating_tokens":{"description":"slice of tokenIDs // no need for more for creating a market","type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platform":{"type":"string"},"rate_format":{"type":"string"},"tvl_usd":{"description":"in usd","type":"string"},"yield_type":{"description":"user inserts","type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}}}}}
```

## The core.Metrics object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.Metrics":{"type":"object","properties":{"annual_rate":{"description":"out of meta summin up all []meta metrics","type":"string"},"meta":{"description":"Meta carries the full point-in-time reserve snapshot for lending history.\nConcrete (not the common.Meta interface) so the response round-trips —\nclients can't unmarshal JSON into an interface. Populated on the history\nendpoint, omitted on getStrategies().","allOf":[{"$ref":"#/components/schemas/common.MetaLending"}]},"timestamp":{"type":"string"},"tvl_usd":{"type":"string"}}},"common.MetaLending":{"type":"object","properties":{"apy_tvl":{"$ref":"#/components/schemas/common.APYTVLMeta"},"atoken":{"type":"string"},"chain_id":{"type":"integer"},"irm":{"$ref":"#/components/schemas/common.IRMMeta"},"metadata":{"$ref":"#/components/schemas/common.ReserveMetadata"},"network":{"type":"string"},"underlying":{"type":"string"}}},"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"},"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}},"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}}}}}
```

## The core.Msg object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.Msg":{"type":"object","properties":{"message":{"type":"string"}}}}}}
```

## The core.PartnerTransaction object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.PartnerTransaction":{"type":"object","properties":{"chain":{"type":"string"},"date":{"type":"string"},"fee_amount":{"type":"string"},"fee_amount_usd":{"type":"string"},"fee_token":{"type":"string"},"input_amount":{"type":"string"},"input_amount_usd":{"type":"string"},"input_token":{"type":"string"},"output_amount":{"type":"string"},"output_amount_usd":{"type":"string"},"output_token":{"type":"string"},"strategy":{"type":"string"},"strategy_name":{"type":"string"},"tx_hash":{"type":"string"},"type":{"type":"string"},"wallet":{"type":"string"}}}}}}
```

## The core.PartnerTransactionsResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.PartnerTransactionsResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/core.PartnerTransaction"}},"limit":{"type":"integer"},"offset":{"type":"integer"},"total":{"type":"integer"}}},"core.PartnerTransaction":{"type":"object","properties":{"chain":{"type":"string"},"date":{"type":"string"},"fee_amount":{"type":"string"},"fee_amount_usd":{"type":"string"},"fee_token":{"type":"string"},"input_amount":{"type":"string"},"input_amount_usd":{"type":"string"},"input_token":{"type":"string"},"output_amount":{"type":"string"},"output_amount_usd":{"type":"string"},"output_token":{"type":"string"},"strategy":{"type":"string"},"strategy_name":{"type":"string"},"tx_hash":{"type":"string"},"type":{"type":"string"},"wallet":{"type":"string"}}}}}}
```

## The core.Policy object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.Policy":{"type":"object","properties":{"allow_strategy_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"type":"array","items":{"type":"string"}},"deny_strategy_ids":{"type":"array","items":{"type":"string"}},"fees_policies":{"$ref":"#/components/schemas/core.FeePolicy"},"maxRiskScore":{"type":"integer","maximum":5,"minimum":1},"minApr":{"type":"string"},"minTvlUsd":{"type":"string"},"rate_format":{"type":"string","enum":["apr","apy"]},"updated_at":{"type":"string"}}},"core.FeePolicy":{"type":"object","properties":{"common_fee":{"type":"string"},"strategies_fee":{"type":"array","items":{"$ref":"#/components/schemas/models.StrategyFee"}}}},"models.StrategyFee":{"type":"object","properties":{"partner_fee_preference":{"type":"string"},"strategy_id":{"type":"string"}}}}}}
```

## The core.PositionEventView object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.PositionEventView":{"type":"object","properties":{"apy_snapshot_pct":{"type":"string"},"balance_after":{"$ref":"#/components/schemas/core.EventBalance"},"block_number":{"type":"integer"},"chain":{"type":"string"},"explorer_url":{"type":"string"},"fee":{"$ref":"#/components/schemas/core.EventFee"},"gas":{"$ref":"#/components/schemas/core.EventGas"},"received":{"$ref":"#/components/schemas/core.EventLeg"},"sent":{"$ref":"#/components/schemas/core.EventLeg"},"timestamp":{"description":"unix seconds","type":"integer"},"tx_hash":{"type":"string"},"type":{"description":"deposit | withdraw","type":"string"}}},"core.EventBalance":{"type":"object","properties":{"share_balance":{"type":"string"},"share_balance_usd":{"type":"string"}}},"core.EventFee":{"type":"object","properties":{"amount":{"type":"string"},"amount_usd":{"type":"string"},"pct":{"type":"string"},"token_id":{"type":"string"}}},"core.EventGas":{"type":"object","properties":{"amount":{"description":"native token","type":"string"},"amount_usd":{"type":"string"}}},"core.EventLeg":{"type":"object","properties":{"amount_gross":{"description":"before zap fee","type":"string"},"amount_net":{"description":"after zap fee","type":"string"},"amount_usd":{"description":"historical, at the event's block","type":"string"},"token_id":{"type":"string"}}}}}}
```

## The core.PositionEventsResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.PositionEventsResponse":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionEventView"}},"meta":{"$ref":"#/components/schemas/core.PositionMeta"},"pagination":{"$ref":"#/components/schemas/core.PositionPagination"},"pnl":{"$ref":"#/components/schemas/core.PositionPnL"},"tokens":{"$ref":"#/components/schemas/core.PositionTokens"}}},"core.PositionEventView":{"type":"object","properties":{"apy_snapshot_pct":{"type":"string"},"balance_after":{"$ref":"#/components/schemas/core.EventBalance"},"block_number":{"type":"integer"},"chain":{"type":"string"},"explorer_url":{"type":"string"},"fee":{"$ref":"#/components/schemas/core.EventFee"},"gas":{"$ref":"#/components/schemas/core.EventGas"},"received":{"$ref":"#/components/schemas/core.EventLeg"},"sent":{"$ref":"#/components/schemas/core.EventLeg"},"timestamp":{"description":"unix seconds","type":"integer"},"tx_hash":{"type":"string"},"type":{"description":"deposit | withdraw","type":"string"}}},"core.EventBalance":{"type":"object","properties":{"share_balance":{"type":"string"},"share_balance_usd":{"type":"string"}}},"core.EventFee":{"type":"object","properties":{"amount":{"type":"string"},"amount_usd":{"type":"string"},"pct":{"type":"string"},"token_id":{"type":"string"}}},"core.EventGas":{"type":"object","properties":{"amount":{"description":"native token","type":"string"},"amount_usd":{"type":"string"}}},"core.EventLeg":{"type":"object","properties":{"amount_gross":{"description":"before zap fee","type":"string"},"amount_net":{"description":"after zap fee","type":"string"},"amount_usd":{"description":"historical, at the event's block","type":"string"},"token_id":{"type":"string"}}},"core.PositionMeta":{"type":"object","properties":{"chain_id":{"type":"string"},"closed_at":{"type":"integer"},"from_block":{"type":"integer"},"last_indexed_block":{"type":"integer"},"opened_at":{"type":"integer"},"share_accrual_type":{"description":"ShareAccrualType is how the share token accrues yield and thus which PnL\nbranch was used: \"appreciating\" | \"rebasing\" | \"unknown\" (§4.7). When\n\"unknown\" the PnL block is omitted (we won't risk a wrong sign).","type":"string"},"status":{"description":"active | closed","type":"string"},"strategy_id":{"type":"string"},"to_block":{"type":"integer"},"wallet":{"type":"string"}}},"core.PositionPagination":{"type":"object","properties":{"limit":{"type":"integer"},"offset":{"type":"integer"},"total_events":{"type":"integer"}}},"core.PositionPnL":{"type":"object","properties":{"balance_share":{"description":"Current live balance of the share token.","type":"string"},"balance_share_usd":{"type":"string"},"costs":{"$ref":"#/components/schemas/core.PositionPnLCosts"},"days_held":{"type":"string"},"deposited_settle_gross":{"description":"Reporting totals over the whole range (gross = before zap fee, net = after).","type":"string"},"deposited_settle_net":{"type":"string"},"gross":{"$ref":"#/components/schemas/core.PositionPnLGross"},"n_deposits":{"type":"integer"},"n_withdrawals":{"type":"integer"},"net":{"$ref":"#/components/schemas/core.PositionPnLNet"},"received_share_gross":{"type":"string"},"received_share_net":{"type":"string"},"settle_token":{"$ref":"#/components/schemas/core.SettleToken"},"withdrawn_settle_gross":{"type":"string"},"withdrawn_settle_net":{"type":"string"},"withdrawn_share_gross":{"type":"string"},"withdrawn_share_net":{"type":"string"}}},"core.PositionPnLCosts":{"type":"object","properties":{"gas_native":{"type":"string"},"gas_settle":{"type":"string"},"gas_usd":{"type":"string"},"zap_fees_settle":{"description":"deposit-side zap fees, in settle token","type":"string"},"zap_fees_share":{"description":"withdraw-side zap fees, in share token","type":"string"},"zap_fees_usd":{"type":"string"}}},"core.PositionPnLGross":{"type":"object","properties":{"pnl_settle":{"type":"string"},"pnl_settle_pct":{"type":"string"},"pnl_usd":{"type":"string"},"pnl_usd_pct":{"type":"string"},"realized_pnl_settle":{"type":"string"},"realized_pnl_usd":{"type":"string"},"unrealized_pnl_settle":{"type":"string"},"unrealized_pnl_usd":{"type":"string"}}},"core.PositionPnLNet":{"type":"object","properties":{"pnl_settle":{"type":"string"},"pnl_settle_pct":{"type":"string"},"pnl_usd":{"type":"string"},"pnl_usd_pct":{"type":"string"},"realized_pnl_settle":{"type":"string"},"unrealized_pnl_settle":{"type":"string"}}},"core.SettleToken":{"type":"object","properties":{"symbol":{"type":"string"},"token_id":{"type":"string"}}},"core.PositionTokens":{"type":"object","properties":{"gas":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionToken"}},"reward":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionToken"}},"share":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionToken"}},"underlying":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionToken"}}}},"core.PositionToken":{"type":"object","properties":{"address":{"type":"string"},"decimals":{"type":"integer"},"id":{"description":"\"chain:address\"","type":"string"},"logo_url":{"type":"string"},"name":{"type":"string"},"price_usd":{"type":"string"},"symbol":{"type":"string"}}}}}}
```

## The core.PositionMeta object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.PositionMeta":{"type":"object","properties":{"chain_id":{"type":"string"},"closed_at":{"type":"integer"},"from_block":{"type":"integer"},"last_indexed_block":{"type":"integer"},"opened_at":{"type":"integer"},"share_accrual_type":{"description":"ShareAccrualType is how the share token accrues yield and thus which PnL\nbranch was used: \"appreciating\" | \"rebasing\" | \"unknown\" (§4.7). When\n\"unknown\" the PnL block is omitted (we won't risk a wrong sign).","type":"string"},"status":{"description":"active | closed","type":"string"},"strategy_id":{"type":"string"},"to_block":{"type":"integer"},"wallet":{"type":"string"}}}}}}
```

## The core.PositionPagination object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.PositionPagination":{"type":"object","properties":{"limit":{"type":"integer"},"offset":{"type":"integer"},"total_events":{"type":"integer"}}}}}}
```

## The core.PositionPnL object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.PositionPnL":{"type":"object","properties":{"balance_share":{"description":"Current live balance of the share token.","type":"string"},"balance_share_usd":{"type":"string"},"costs":{"$ref":"#/components/schemas/core.PositionPnLCosts"},"days_held":{"type":"string"},"deposited_settle_gross":{"description":"Reporting totals over the whole range (gross = before zap fee, net = after).","type":"string"},"deposited_settle_net":{"type":"string"},"gross":{"$ref":"#/components/schemas/core.PositionPnLGross"},"n_deposits":{"type":"integer"},"n_withdrawals":{"type":"integer"},"net":{"$ref":"#/components/schemas/core.PositionPnLNet"},"received_share_gross":{"type":"string"},"received_share_net":{"type":"string"},"settle_token":{"$ref":"#/components/schemas/core.SettleToken"},"withdrawn_settle_gross":{"type":"string"},"withdrawn_settle_net":{"type":"string"},"withdrawn_share_gross":{"type":"string"},"withdrawn_share_net":{"type":"string"}}},"core.PositionPnLCosts":{"type":"object","properties":{"gas_native":{"type":"string"},"gas_settle":{"type":"string"},"gas_usd":{"type":"string"},"zap_fees_settle":{"description":"deposit-side zap fees, in settle token","type":"string"},"zap_fees_share":{"description":"withdraw-side zap fees, in share token","type":"string"},"zap_fees_usd":{"type":"string"}}},"core.PositionPnLGross":{"type":"object","properties":{"pnl_settle":{"type":"string"},"pnl_settle_pct":{"type":"string"},"pnl_usd":{"type":"string"},"pnl_usd_pct":{"type":"string"},"realized_pnl_settle":{"type":"string"},"realized_pnl_usd":{"type":"string"},"unrealized_pnl_settle":{"type":"string"},"unrealized_pnl_usd":{"type":"string"}}},"core.PositionPnLNet":{"type":"object","properties":{"pnl_settle":{"type":"string"},"pnl_settle_pct":{"type":"string"},"pnl_usd":{"type":"string"},"pnl_usd_pct":{"type":"string"},"realized_pnl_settle":{"type":"string"},"unrealized_pnl_settle":{"type":"string"}}},"core.SettleToken":{"type":"object","properties":{"symbol":{"type":"string"},"token_id":{"type":"string"}}}}}}
```

## The core.PositionPnLCosts object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.PositionPnLCosts":{"type":"object","properties":{"gas_native":{"type":"string"},"gas_settle":{"type":"string"},"gas_usd":{"type":"string"},"zap_fees_settle":{"description":"deposit-side zap fees, in settle token","type":"string"},"zap_fees_share":{"description":"withdraw-side zap fees, in share token","type":"string"},"zap_fees_usd":{"type":"string"}}}}}}
```

## The core.PositionPnLGross object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.PositionPnLGross":{"type":"object","properties":{"pnl_settle":{"type":"string"},"pnl_settle_pct":{"type":"string"},"pnl_usd":{"type":"string"},"pnl_usd_pct":{"type":"string"},"realized_pnl_settle":{"type":"string"},"realized_pnl_usd":{"type":"string"},"unrealized_pnl_settle":{"type":"string"},"unrealized_pnl_usd":{"type":"string"}}}}}}
```

## The core.PositionPnLNet object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.PositionPnLNet":{"type":"object","properties":{"pnl_settle":{"type":"string"},"pnl_settle_pct":{"type":"string"},"pnl_usd":{"type":"string"},"pnl_usd_pct":{"type":"string"},"realized_pnl_settle":{"type":"string"},"unrealized_pnl_settle":{"type":"string"}}}}}}
```

## The core.PositionToken object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.PositionToken":{"type":"object","properties":{"address":{"type":"string"},"decimals":{"type":"integer"},"id":{"description":"\"chain:address\"","type":"string"},"logo_url":{"type":"string"},"name":{"type":"string"},"price_usd":{"type":"string"},"symbol":{"type":"string"}}}}}}
```

## The core.PositionTokens object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.PositionTokens":{"type":"object","properties":{"gas":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionToken"}},"reward":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionToken"}},"share":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionToken"}},"underlying":{"type":"array","items":{"$ref":"#/components/schemas/core.PositionToken"}}}},"core.PositionToken":{"type":"object","properties":{"address":{"type":"string"},"decimals":{"type":"integer"},"id":{"description":"\"chain:address\"","type":"string"},"logo_url":{"type":"string"},"name":{"type":"string"},"price_usd":{"type":"string"},"symbol":{"type":"string"}}}}}}
```

## The core.SettleToken object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.SettleToken":{"type":"object","properties":{"symbol":{"type":"string"},"token_id":{"type":"string"}}}}}}
```

## The core.Signature object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.Signature":{"type":"object","properties":{"approval_address":{"description":"spender to approve before sending","type":"string"},"chainId":{"description":"chain slug the tx executes on","type":"string"},"data":{"type":"string"},"engine":{"description":"Engine routing metadata (multi-engine support). Additive; portals leaves\nthem empty when it has no equivalent.","type":"string"},"from":{"type":"string"},"gasLimit":{"type":"string"},"min_output_amount":{"type":"string"},"orderId":{"type":"string"},"output_amount":{"type":"string"},"to":{"type":"string"},"value":{"type":"string"}}}}}}
```

## The core.StrategiesResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.StrategiesResponse":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"type":"array","items":{"$ref":"#/components/schemas/common.Chain"}},"description":{"type":"string"},"fee_breakdown":{"$ref":"#/components/schemas/core.Fees"},"input_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"metrics":{"$ref":"#/components/schemas/core.Metrics"},"name":{"type":"string"},"output_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/common.Platform"}},"rate_format":{"type":"string"},"risk":{"description":"upd (new)","allOf":[{"$ref":"#/components/schemas/common.Risk"}]},"status":{"type":"string"},"strategy_id":{"type":"string"},"updated_at":{"type":"integer"}}},"common.Chain":{"type":"object","properties":{"chain_id":{"description":"e.g.: \"ethereum\"","type":"string"},"ecosystem":{"type":"string"},"explorer_url":{"type":"string"},"image_url":{"type":"string"}}},"core.Fees":{"type":"object","properties":{"max_fee":{"description":"maximum possible fee","type":"string"},"partner_fee":{"type":"string"},"total_fee":{"type":"string"},"yifi_fee":{"type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"core.Metrics":{"type":"object","properties":{"annual_rate":{"description":"out of meta summin up all []meta metrics","type":"string"},"meta":{"description":"Meta carries the full point-in-time reserve snapshot for lending history.\nConcrete (not the common.Meta interface) so the response round-trips —\nclients can't unmarshal JSON into an interface. Populated on the history\nendpoint, omitted on getStrategies().","allOf":[{"$ref":"#/components/schemas/common.MetaLending"}]},"timestamp":{"type":"string"},"tvl_usd":{"type":"string"}}},"common.MetaLending":{"type":"object","properties":{"apy_tvl":{"$ref":"#/components/schemas/common.APYTVLMeta"},"atoken":{"type":"string"},"chain_id":{"type":"integer"},"irm":{"$ref":"#/components/schemas/common.IRMMeta"},"metadata":{"$ref":"#/components/schemas/common.ReserveMetadata"},"network":{"type":"string"},"underlying":{"type":"string"}}},"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"},"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}},"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}},"common.Platform":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"description":"\"ethereum\"","type":"array","items":{"type":"string"}},"image":{"type":"string"},"platform_id":{"description":"\"gyroscope\"","type":"string"},"platform_name":{"description":"\"Gyroscope\"","type":"string"}}},"common.Risk":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"risk_score":{"type":"integer"}}}}}}
```

## The core.StrategyFeeBreakdown object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.StrategyFeeBreakdown":{"type":"object","properties":{"fee_amount":{"type":"string"},"fee_amount_usd":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}}}}}
```

## The core.StrategyHistoryResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.StrategyHistoryResponse":{"type":"object","properties":{"history":{"type":"array","items":{"$ref":"#/components/schemas/core.Metrics"}},"rate_format":{"type":"string"},"strategy_id":{"description":"key in portals","type":"string"},"yield_type":{"type":"string"}}},"core.Metrics":{"type":"object","properties":{"annual_rate":{"description":"out of meta summin up all []meta metrics","type":"string"},"meta":{"description":"Meta carries the full point-in-time reserve snapshot for lending history.\nConcrete (not the common.Meta interface) so the response round-trips —\nclients can't unmarshal JSON into an interface. Populated on the history\nendpoint, omitted on getStrategies().","allOf":[{"$ref":"#/components/schemas/common.MetaLending"}]},"timestamp":{"type":"string"},"tvl_usd":{"type":"string"}}},"common.MetaLending":{"type":"object","properties":{"apy_tvl":{"$ref":"#/components/schemas/common.APYTVLMeta"},"atoken":{"type":"string"},"chain_id":{"type":"integer"},"irm":{"$ref":"#/components/schemas/common.IRMMeta"},"metadata":{"$ref":"#/components/schemas/common.ReserveMetadata"},"network":{"type":"string"},"underlying":{"type":"string"}}},"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"},"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}},"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}}}}}
```

## The core.StrategyPerformance object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.StrategyPerformance":{"type":"object","properties":{"deposits_amount":{"type":"string"},"deposits_amount_usd":{"type":"string"},"deposits_count":{"type":"integer"},"deposits_token":{"type":"string"},"fees_by_token":{"type":"array","items":{"$ref":"#/components/schemas/core.StrategyFeeBreakdown"}},"fees_earned_usd":{"type":"string"},"strategy_id":{"type":"string"},"strategy_name":{"type":"string"},"wallets_participated":{"type":"integer"},"withdrawals_amount":{"type":"string"},"withdrawals_amount_usd":{"type":"string"},"withdrawals_count":{"type":"integer"},"withdrawals_token":{"type":"string"}}},"core.StrategyFeeBreakdown":{"type":"object","properties":{"fee_amount":{"type":"string"},"fee_amount_usd":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}}}}}
```

## The core.StrategyPerformanceResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.StrategyPerformanceResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/core.StrategyPerformance"}},"limit":{"type":"integer"},"offset":{"type":"integer"},"total":{"type":"integer"}}},"core.StrategyPerformance":{"type":"object","properties":{"deposits_amount":{"type":"string"},"deposits_amount_usd":{"type":"string"},"deposits_count":{"type":"integer"},"deposits_token":{"type":"string"},"fees_by_token":{"type":"array","items":{"$ref":"#/components/schemas/core.StrategyFeeBreakdown"}},"fees_earned_usd":{"type":"string"},"strategy_id":{"type":"string"},"strategy_name":{"type":"string"},"wallets_participated":{"type":"integer"},"withdrawals_amount":{"type":"string"},"withdrawals_amount_usd":{"type":"string"},"withdrawals_count":{"type":"integer"},"withdrawals_token":{"type":"string"}}},"core.StrategyFeeBreakdown":{"type":"object","properties":{"fee_amount":{"type":"string"},"fee_amount_usd":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}}}}}
```

## The core.StrategyResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.StrategyResponse":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"description":"upd","type":"array","items":{"$ref":"#/components/schemas/common.Chain"}},"created_at":{"type":"integer"},"default_engine":{"description":"mirror of routing_engine","type":"string"},"description":{"type":"string"},"execution_config":{"$ref":"#/components/schemas/core.ExecutionConfig"},"fallback_engines":{"description":"ordered alternatives","type":"array","items":{"type":"string"}},"fee_breakdown":{"$ref":"#/components/schemas/core.Fees"},"input_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"limits":{"$ref":"#/components/schemas/core.Limits"},"market_ids":{"type":"array","items":{"type":"string"}},"metrics":{"$ref":"#/components/schemas/core.Metrics"},"name":{"type":"string"},"output_tokens":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenAddress"}},"platforms":{"description":"upd (new)","type":"array","items":{"$ref":"#/components/schemas/common.Platform"}},"rate_format":{"type":"string"},"risk":{"description":"upd (new)","allOf":[{"$ref":"#/components/schemas/common.Risk"}]},"routing_engine":{"description":"default engine (back-compat name)","type":"string"},"status":{"type":"string"},"strategy_id":{"type":"string"},"updated_at":{"type":"integer"},"yield_type":{"type":"string"}}},"common.Chain":{"type":"object","properties":{"chain_id":{"description":"e.g.: \"ethereum\"","type":"string"},"ecosystem":{"type":"string"},"explorer_url":{"type":"string"},"image_url":{"type":"string"}}},"core.ExecutionConfig":{"type":"object","properties":{"input_token_ids":{"type":"array","items":{"type":"string"}},"output_token_ids":{"type":"array","items":{"type":"string"}}}},"core.Fees":{"type":"object","properties":{"max_fee":{"description":"maximum possible fee","type":"string"},"partner_fee":{"type":"string"},"total_fee":{"type":"string"},"yifi_fee":{"type":"string"}}},"common.TokenAddress":{"type":"object","properties":{"address":{"type":"string"},"chain":{"type":"string"},"decimals":{"type":"integer"},"logo_url":{"description":"new","type":"string"},"price_usd":{"type":"string"},"role":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"core.Limits":{"type":"object","properties":{"deposits_paused":{"type":"boolean"},"withdrawals_paused":{"type":"boolean"}}},"core.Metrics":{"type":"object","properties":{"annual_rate":{"description":"out of meta summin up all []meta metrics","type":"string"},"meta":{"description":"Meta carries the full point-in-time reserve snapshot for lending history.\nConcrete (not the common.Meta interface) so the response round-trips —\nclients can't unmarshal JSON into an interface. Populated on the history\nendpoint, omitted on getStrategies().","allOf":[{"$ref":"#/components/schemas/common.MetaLending"}]},"timestamp":{"type":"string"},"tvl_usd":{"type":"string"}}},"common.MetaLending":{"type":"object","properties":{"apy_tvl":{"$ref":"#/components/schemas/common.APYTVLMeta"},"atoken":{"type":"string"},"chain_id":{"type":"integer"},"irm":{"$ref":"#/components/schemas/common.IRMMeta"},"metadata":{"$ref":"#/components/schemas/common.ReserveMetadata"},"network":{"type":"string"},"underlying":{"type":"string"}}},"common.APYTVLMeta":{"type":"object","properties":{"liquidity_index_ray":{"$ref":"#/components/schemas/big.Int"},"price_usd":{"type":"number"},"supply_apr_pct":{"type":"number"},"supply_apy_pct":{"type":"number"},"tvl_native":{"type":"number"},"updated_at_block":{"type":"integer"},"updated_at_ts":{"type":"integer"},"utilization_pct":{"type":"number"},"var_borrow_apr_pct":{"type":"number"},"var_borrow_apy_pct":{"type":"number"}}},"big.Int":{"type":"object"},"common.IRMMeta":{"type":"object","properties":{"base_rate_pct":{"type":"number"},"slope1_pct":{"type":"number"},"slope2_pct":{"type":"number"},"u_max_excess_pct":{"type":"number"},"u_optimal_pct":{"type":"number"}}},"common.ReserveMetadata":{"type":"object","properties":{"borrowing_enabled":{"type":"boolean"},"decimals":{"type":"integer"},"is_active":{"type":"boolean"},"is_frozen":{"type":"boolean"},"liquidation_bonus":{"type":"number"},"liquidation_threshold":{"type":"number"},"ltv_pct":{"type":"number"},"reserve_factor_pct":{"type":"number"},"stable_borrow_enabled":{"type":"boolean"},"use_as_collateral":{"type":"boolean"}}},"common.Platform":{"type":"object","properties":{"category_ids":{"type":"array","items":{"type":"string"}},"chain_ids":{"description":"\"ethereum\"","type":"array","items":{"type":"string"}},"image":{"type":"string"},"platform_id":{"description":"\"gyroscope\"","type":"string"},"platform_name":{"description":"\"Gyroscope\"","type":"string"}}},"common.Risk":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"risk_score":{"type":"integer"}}}}}}
```

## The core.WalletTxResponse object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.WalletTxResponse":{"type":"object","properties":{"chain_id":{"type":"string"},"created_at":{"type":"integer"},"decimals":{"type":"integer"},"input_amount":{"type":"string"},"input_amount_usd":{"type":"string"},"is_deposit":{"type":"boolean"},"is_native":{"type":"boolean"},"is_wrapped":{"type":"boolean"},"meta":{"$ref":"#/components/schemas/common.FullTxView"},"order_id":{"type":"string"},"output_amount":{"type":"string"},"output_amount_usd":{"type":"string"},"partner_fee":{"type":"string"},"partner_id":{"type":"string"},"strategy_id":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"},"token_id_actual":{"type":"string"},"token_price_usd":{"type":"string"},"tx_hash":{"type":"string"},"wallet_id":{"type":"string"},"yifi_fee":{"type":"string"}}},"common.FullTxView":{"type":"object","properties":{"block_hash":{"type":"string"},"block_number":{"type":"integer"},"effective_gas_price":{"type":"string"},"from":{"type":"string"},"gas_limit":{"type":"integer"},"gas_price":{"type":"string"},"gas_used":{"type":"integer"},"nonce":{"type":"integer"},"portal_input":{"$ref":"#/components/schemas/common.PrintablePortalInput"},"status":{"type":"integer"},"to":{"type":"string"},"token_transfers":{"type":"array","items":{"$ref":"#/components/schemas/common.TokenTransfer"}},"transaction_fee":{"type":"string"},"tx_hash":{"type":"string"},"type":{"type":"integer"},"value":{"type":"string"},"zap":{"type":"string"}}},"common.PrintablePortalInput":{"type":"object","properties":{"calls":{"type":"array","items":{"$ref":"#/components/schemas/common.PrintablePortalCall"}},"input_amount":{"type":"string"},"input_token":{"type":"string"},"min_output_amount":{"type":"string"},"output_token":{"type":"string"},"partner":{"type":"string"},"recipient":{"type":"string"}}},"common.PrintablePortalCall":{"type":"object","properties":{"amount_index":{"type":"string"},"data":{"type":"string"},"input_token":{"type":"string"},"target":{"type":"string"}}},"common.TokenTransfer":{"type":"object","properties":{"amount":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"token":{"type":"string"}}}}}}
```

## The core.ZapQuoteRequest object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"core.ZapQuoteRequest":{"type":"object","properties":{"engine":{"description":"Engine is an optional routing-engine override. Empty means use the\nstrategy's default_engine; the frontend sets this to a strategy fallback\nengine when the user picks \"use alternative route\" after a failure.","type":"string"},"input_amount":{"description":"The quantity of inputToken to spend in inputToken base units","type":"string"},"input_token":{"description":"The ERC20 token address to spend (e.g. DAI, USDC, etc.). Use address(0) for the native token. Address must be prepended with the network name. (e.g ethereum:0x6B175474E89094C44Da98b954EedeAC495271d0F for DAI)","type":"string"},"order_id":{"description":"OrderID is required and identifies the frozen quote returned by /zap/quote.\nBuild returns the same id and the transaction captured with that quote.","type":"string"},"output_token":{"description":"The ERC20 token address to receive (e.g. DAI, USDC, etc.). Use address(0) for the native token. Address must be prepended with the network name. (e.g ethereum:0x6B175474E89094C44Da98b954EedeAC495271d0F for DAI)","type":"string"},"partner_fee":{"description":"if partner has set a policy on this strategy, then its fee will be added to fees","type":"string"},"partner_id":{"description":"needed for gateway service to attach it from partners policy response","type":"string"},"sender":{"description":"The address of the owner of the inputToken.","type":"string"},"slippage_tolerance_percentage":{"description":"The maximum acceptable slippage for the portal. Must be a number between 0.1 and 10 (e.g. 0.25 for 0.25%, 2 for 2%). If not set, auto slippage will be used instead (requires that validate is set to true)","type":"string"},"strategy_id":{"type":"string"}}}}}}
```

## The models.APIKey object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.APIKey":{"type":"object","properties":{"api_key":{"description":"essential key to be used by","type":"string"},"created_at":{"type":"string"},"hash":{"description":"чтобы декриптнуть локально","type":"array","items":{"type":"integer"}},"meta":{},"name":{"type":"string"},"prefix":{"type":"string"},"revoked_at":{"type":"string"},"secret_byte":{"description":"this is his secret token to sign, shown just one time","type":"array","items":{"type":"integer"}},"status":{"type":"boolean"}}}}}}
```

## The models.APIKeyFull object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.APIKeyFull":{"type":"object","properties":{"api_key":{"description":"essential key to be used by","type":"string"},"created_at":{"type":"string"},"hash":{"description":"чтобы декриптнуть локально","type":"array","items":{"type":"integer"}},"meta":{},"name":{"type":"string"},"prefix":{"type":"string"},"revoked_at":{"type":"string"},"secret":{"type":"string"},"secret_byte":{"description":"this is his secret token to sign, shown just one time","type":"array","items":{"type":"integer"}},"status":{"type":"boolean"}}}}}}
```

## The models.Balance object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.Balance":{"type":"object","properties":{"claimable_usd":{"type":"string"},"partner_id":{"type":"string"},"pending_usd":{"type":"string"},"tokens":{"type":"array","items":{"$ref":"#/components/schemas/models.TokenBalanceView"}},"total_usd":{"type":"string"},"updated_at":{"type":"string"}}},"models.TokenBalanceView":{"type":"object","properties":{"amount":{"$ref":"#/components/schemas/models.TokenAmount"},"amount_usd":{"type":"string"},"chain_id":{"type":"integer"},"claimable_usd":{"type":"string"},"decimals":{"type":"integer"},"is_native":{"type":"boolean"},"is_wrapped":{"type":"boolean"},"pending_usd":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"models.TokenAmount":{"type":"object","properties":{"free":{"description":"Free is accrued but not yet pushed to the TokenDistributor.","type":"string"},"pending":{"description":"Pending is pushed to the TokenDistributor and claimable on-chain.","type":"string"},"total":{"description":"Total = Free + Pending, the whole fee balance for the token.","type":"string"}}}}}}
```

## The models.Chain object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.Chain":{"type":"object","properties":{"chain_id":{"type":"integer"},"chain_name":{"type":"string"},"distributor":{"description":"Distributor is the TokenDistributor contract address on this chain (empty if not deployed)","type":"string"},"is_evm":{"type":"boolean"},"provider":{"type":"string"}}}}}}
```

## The models.ClaimAddress object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.ClaimAddress":{"type":"object","properties":{"address":{"type":"string"},"chain_id":{"type":"integer"},"created_at":{"type":"string"},"name":{"type":"string"},"partner_id":{"type":"string"},"status":{"type":"boolean"},"updated_at":{"type":"string"}}}}}}
```

## The models.Metric object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.Metric":{"type":"object","properties":{"deposits_usd":{"type":"string"},"fees_earned_usd":{"type":"string"},"strategy_id":{"type":"string"},"transactions_count":{"type":"integer"},"users_count":{"type":"integer"},"withdrawals_usd":{"type":"string"}}}}}}
```

## The models.Metrics object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.Metrics":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/models.Metric"}},"partner_id":{"type":"string"},"updated_at":{"description":"last time user updated (or us) his summuary (хранится в кэше, обновлять можно руками, можем сами)","type":"string"}}},"models.Metric":{"type":"object","properties":{"deposits_usd":{"type":"string"},"fees_earned_usd":{"type":"string"},"strategy_id":{"type":"string"},"transactions_count":{"type":"integer"},"users_count":{"type":"integer"},"withdrawals_usd":{"type":"string"}}}}}}
```

## The models.PartnerFeeClaimRequest object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.PartnerFeeClaimRequest":{"type":"object","properties":{"chain_id":{"type":"string"},"claim_address":{"type":"string"},"partner_id":{"type":"string"},"token_id":{"type":"string"}}}}}}
```

## The models.StrategyFee object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.StrategyFee":{"type":"object","properties":{"partner_fee_preference":{"type":"string"},"strategy_id":{"type":"string"}}}}}}
```

## The models.Summary object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.Summary":{"type":"object","properties":{"deposits_usd":{"type":"string"},"fees_earned_usd":{"type":"string"},"from":{"type":"string"},"partner_id":{"type":"string"},"to":{"type":"string"},"transactions_count":{"type":"integer"},"updated_at":{"description":"last time user updated (or us) his summuary (хранится в кэше, обновлять можно руками, можем сами)","type":"string"},"users_count":{"type":"integer"},"withdrawals_usd":{"type":"string"}}}}}}
```

## The models.TokenAmount object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.TokenAmount":{"type":"object","properties":{"free":{"description":"Free is accrued but not yet pushed to the TokenDistributor.","type":"string"},"pending":{"description":"Pending is pushed to the TokenDistributor and claimable on-chain.","type":"string"},"total":{"description":"Total = Free + Pending, the whole fee balance for the token.","type":"string"}}}}}}
```

## The models.TokenBalanceView object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.TokenBalanceView":{"type":"object","properties":{"amount":{"$ref":"#/components/schemas/models.TokenAmount"},"amount_usd":{"type":"string"},"chain_id":{"type":"integer"},"claimable_usd":{"type":"string"},"decimals":{"type":"integer"},"is_native":{"type":"boolean"},"is_wrapped":{"type":"boolean"},"pending_usd":{"type":"string"},"symbol":{"type":"string"},"token_id":{"type":"string"}}},"models.TokenAmount":{"type":"object","properties":{"free":{"description":"Free is accrued but not yet pushed to the TokenDistributor.","type":"string"},"pending":{"description":"Pending is pushed to the TokenDistributor and claimable on-chain.","type":"string"},"total":{"description":"Total = Free + Pending, the whole fee balance for the token.","type":"string"}}}}}}
```

## The models.TxInfo object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"models.TxInfo":{"type":"object","properties":{"amount_sent":{"type":"string"},"chain_id":{"type":"integer"},"claim_id":{"type":"string"},"data":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"token_id":{"type":"string"},"tx_hash":{"type":"string"},"value":{"type":"string"}}}}}}
```

## The partnertotp.TOTPCancelRequest object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"partnertotp.TOTPCancelRequest":{"type":"object","properties":{"totp_code":{"type":"string"}}}}}}
```

## The partnertotp.TOTPResetRequest object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"partnertotp.TOTPResetRequest":{"type":"object","properties":{"email_code":{"type":"string"}}}}}}
```

## The partnertotp.TOTPVerifyRequest object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"partnertotp.TOTPVerifyRequest":{"type":"object","properties":{"code":{"type":"string"}}}}}}
```

## The rest.Response object

```json
{"openapi":"3.1.1","info":{"title":"YiFi Yield Aggregator – Data Gateway API","version":"v1"},"components":{"schemas":{"rest.Response":{"type":"object","properties":{"code":{"type":"string"},"data":{},"isError":{"type":"boolean"},"message":{"type":"string"},"success":{"type":"boolean"}}}}}}
```


# Guides

Practical walkthroughs for getting things done. Each guide is self-contained — pick the one that matches what you're trying to do.

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><h4><i class="fa-globe" style="color:$primary;">:globe:</i></h4></td><td><strong>Custom domains</strong></td><td>Point your own domain at a project, with automatic SSL.</td><td><a href="broken://pages/9e6489391e0b8b3710eb3e8b11f3f2c0ab53ae7a">Broken link</a></td></tr><tr><td><h4><i class="fa-gear" style="color:$primary;">:gear:</i></h4></td><td><strong>Automations</strong></td><td>React to deploys, comments, or external events with workflows.</td><td><a href="broken://pages/1961a0c0dfd8029b5b32862472404bead171c798">Broken link</a></td></tr></tbody></table>

***

## More guides coming soon

We're adding new guides based on what people actually ask about. Some that are in the pipeline:

* Importing data from another platform
* Setting up SSO with your identity provider
* Building a custom CI/CD pipeline on top of the API
* Configuring per-environment secrets

{% hint style="info" %}
Have a guide you'd like to see? [Suggest one in the community](https://gitbook.com).
{% endhint %}


# Custom domains

Replace your auto-generated subdomain with your own domain, with automatic SSL.

By default, every project is published at a subdomain of the platform. You can replace this with your own domain on any paid plan.

{% hint style="success" %}
SSL certificates are issued automatically once your domain is verified — there's nothing to install or renew yourself.
{% endhint %}

## Before you start

You'll need:

* A paid plan (Pro or above)
* Access to your domain registrar's DNS settings
* A successful deploy of the project you want to attach

## Steps

{% stepper %}
{% step %}

#### Add your domain in the dashboard

Go to **Project settings → Domains** and click **Add domain**. Enter the domain or subdomain you want to use:

```
docs.yourcompany.com
```

The dashboard will show you the DNS record values you need.
{% endstep %}

{% step %}

#### Configure your DNS

Add a CNAME record pointing your subdomain at the platform:

```
Type:  CNAME
Name:  docs
Value: sites.example-platform.com
TTL:   3600
```

For an apex domain (e.g. `yourcompany.com` without a subdomain), you'll need an ALIAS or ANAME record instead — not all DNS providers support these. Check your provider's docs.

{% hint style="info" %}
DNS changes can take up to 48 hours to propagate, but in practice most see them resolve within a few minutes.
{% endhint %}
{% endstep %}

{% step %}

#### Verify and activate

Return to **Project settings → Domains** and click **Verify**. Once verified, the platform will issue an SSL certificate automatically — usually within a couple of minutes.

When verification completes, your domain is live.
{% endstep %}
{% endstepper %}

## Multiple domains per project

You can attach multiple domains to a single project — useful for redirecting old URLs or supporting multiple regions:

```yaml
domains:
  primary: docs.yourcompany.com
  redirects:
    - from: help.yourcompany.com
      to: docs.yourcompany.com
      status: 301
```

## Troubleshooting

<details>

<summary>Verification keeps failing</summary>

Make sure there are no conflicting DNS records for the same subdomain. An existing A record will block the CNAME.

Also check that the value of your CNAME exactly matches the one shown in the dashboard — typos in domain names are very common.

</details>

<details>

<summary>SSL certificate not provisioning</summary>

SSL is issued after DNS verification succeeds. If it hasn't appeared after 30 minutes:

1. Confirm your domain still verifies in the dashboard
2. Check that your DNS provider isn't using CAA records that block our certificate authority
3. Click **Re-verify** to trigger a fresh attempt

</details>

<details>

<summary>Browser shows "Your connection is not private"</summary>

This usually means the certificate hasn't been provisioned yet, or your browser cached an old certificate. Wait a few minutes, then try in an incognito window.

</details>

<details>

<summary>The domain works but redirects break</summary>

Redirect chains often get cached aggressively. Test in an incognito window or with `curl -I` to see what's actually being served, ignoring local cache.

```bash
curl -I https://docs.yourcompany.com
```

</details>

## Removing a domain

To remove a domain, go to **Project settings → Domains**, click the menu next to the domain, and select **Remove**.

{% hint style="warning" %}
Removing a domain stops serving traffic immediately. If you've shared this URL externally, set up a redirect first to avoid breaking inbound links.
{% endhint %}


# Automations

React to deploys, comments, and external events with workflows that run on the platform.

Automations let you run code in response to things that happen on the platform — a deploy completing, a comment being posted, or an external webhook firing. They're a flexible way to wire the platform into the rest of your toolchain.

{% hint style="info" %}
Automations run in a managed environment with a 30-second timeout. For long-running work, have your automation enqueue a job in your own infrastructure.
{% endhint %}

## Triggers

Automations start in response to a **trigger**. The platform supports the following:

| Trigger            | Fires when…                                   |
| ------------------ | --------------------------------------------- |
| `deploy.succeeded` | A build completes and goes live               |
| `deploy.failed`    | A build fails                                 |
| `comment.created`  | Someone comments on a deploy preview          |
| `member.invited`   | A new member is invited to the workspace      |
| `domain.verified`  | A custom domain finishes verification         |
| `webhook.received` | An external service POSTs to your inbound URL |
| `schedule`         | On a cron schedule                            |

Each automation has exactly one trigger and one or more actions.

## Writing your first automation

Create a new file under `.platform/automations/` in your project:

{% tabs %}
{% tab title="JavaScript" %}

```javascript
export default {
  trigger: 'deploy.succeeded',
  async run(event, ctx) {
    await ctx.notify('slack', {
      channel: '#deploys',
      message: `${event.project} is live at ${event.url}`
    });
  }
};
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import type { Automation, DeployEvent } from '@platform/automations';

export default {
  trigger: 'deploy.succeeded',
  async run(event: DeployEvent, ctx) {
    await ctx.notify('slack', {
      channel: '#deploys',
      message: `${event.project} is live at ${event.url}`
    });
  }
} satisfies Automation;
```

{% endtab %}

{% tab title="Python" %}

```python
from platform_automations import automation, slack

@automation(trigger='deploy.succeeded')
async def notify_deploy(event, ctx):
    await slack.post(
        channel='#deploys',
        message=f"{event.project} is live at {event.url}"
    )
```

{% endtab %}
{% endtabs %}

The file is detected on your next deploy and registered automatically.

## A more useful example

Here's an automation that posts a summary to a chat channel whenever a pull request preview is ready:

```javascript
export default {
  trigger: 'deploy.succeeded',
  filter: (event) => event.environment === 'preview',
  async run(event, ctx) {
    const summary = await ctx.ai.summarise({
      diff: event.diff,
      maxLength: 200
    });

    await ctx.notify('slack', {
      channel: '#previews',
      message: `Preview ready: ${event.url}\n\n${summary}`
    });
  }
};
```

This shows three patterns worth knowing:

* **`filter`** — narrow the events your automation responds to
* **`ctx.ai`** — a built-in helper for AI summarisation
* **`ctx.notify`** — send to any configured notification channel

## Local testing

Test your automations locally before deploying:

{% tabs %}
{% tab title="CLI" %}

```bash
platform automations test deploy.succeeded \
  --fixture fixtures/deploy.json
```

{% endtab %}

{% tab title="Dashboard" %}
Open your automation in the dashboard and click **Test run**. You can paste in any payload or pick a saved fixture.
{% endtab %}
{% endtabs %}

## Scheduling

Use the `schedule` trigger with a cron expression for time-based automations:

```javascript
export default {
  trigger: 'schedule',
  schedule: '0 9 * * 1', // every Monday at 09:00 UTC
  async run(event, ctx) {
    const stats = await ctx.api.deploys.weekly();
    await ctx.notify('email', {
      to: 'team@example.com',
      subject: 'Weekly deploy report',
      body: stats.summary
    });
  }
};
```

{% hint style="warning" %}
Schedule times are always in UTC. Adjust your cron expression accordingly if your team works in a different timezone.
{% endhint %}

## What's next?

{% columns %}
{% column %}
**Common patterns**

* Slack notifications on deploy
* Posting summaries to issue trackers
* Daily/weekly digests
  {% endcolumn %}

{% column %}
**Advanced**

* Chaining automations
* Calling external APIs
* Storing state across runs
  {% endcolumn %}
  {% endcolumns %}


# Reference

Detailed reference material for when you need to look something up rather than learn how to do it.

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><h4><i class="fa-sliders" style="color:$primary;">:sliders:</i></h4></td><td><strong>Configuration</strong></td><td>Every setting available in <code>platform.yaml</code>, with defaults and examples.</td><td><a href="broken://pages/d9d0c491bd6ddc44b62870815e0c5f8084161db7">Broken link</a></td></tr><tr><td><h4><i class="fa-bookmark" style="color:$primary;">:bookmark:</i></h4></td><td><strong>Glossary</strong></td><td>Definitions of terms used throughout the docs and dashboard.</td><td><a href="broken://pages/dff362f27d99ce4f3ce1097edb0452720f00b694">Broken link</a></td></tr></tbody></table>

{% hint style="info" %}
Looking for the API reference? It lives separately at [api.example.com](https://api.example.com/) — including OpenAPI spec, code samples, and a live test panel.
{% endhint %}


# Configuration

The `platform.yaml` file at the root of your project controls how it builds and deploys. Most fields are optional — sensible defaults are chosen based on framework auto-detection.

## Build

Settings that control how your project is built.

| Setting         | Type   | Default         | Description                                       |
| --------------- | ------ | --------------- | ------------------------------------------------- |
| `build.command` | string | *auto-detected* | The shell command that produces your build output |
| `build.output`  | string | *auto-detected* | The folder containing the built files             |
| `build.install` | string | `npm ci`        | The command to install dependencies               |
| `build.node`    | string | `20`            | The Node.js version to use                        |
| `build.env`     | object | `{}`            | Environment variables available during build      |

Example:

```yaml
build:
  command: npm run build
  output: dist/
  node: 20
  env:
    NODE_OPTIONS: --max-old-space-size=4096
```

## Deploy

Settings that control how your project is deployed and routed.

| Setting            | Type   | Default | Description                                     |
| ------------------ | ------ | ------- | ----------------------------------------------- |
| `deploy.framework` | string | `auto`  | Framework hint (e.g. `next`, `astro`, `static`) |
| `deploy.routes`    | array  | `[]`    | Custom routing rules                            |
| `deploy.headers`   | array  | `[]`    | Custom HTTP headers per path                    |
| `deploy.redirects` | array  | `[]`    | URL redirects                                   |
| `deploy.region`    | string | `auto`  | Preferred deploy region                         |

Example:

```yaml
deploy:
  framework: next
  region: eu-west-1
  routes:
    - source: /api/*
      destination: /api/[...path].js
  headers:
    - path: /*
      headers:
        - key: X-Frame-Options
          value: DENY
```

## Preview

Settings that control preview deploys for branches and pull requests.

| Setting                    | Type    | Default  | Description                                |
| -------------------------- | ------- | -------- | ------------------------------------------ |
| `preview.enabled`          | boolean | `true`   | Whether previews are enabled at all        |
| `preview.branches.include` | array   | `["**"]` | Branch patterns to deploy                  |
| `preview.branches.exclude` | array   | `[]`     | Branch patterns to skip                    |
| `preview.comments`         | boolean | `true`   | Comment on pull requests with preview URLs |
| `preview.password`         | string  | *none*   | Password-protect preview URLs              |

## Notifications

Where to send build and deploy events.

| Setting                | Type   | Default             | Description                        |
| ---------------------- | ------ | ------------------- | ---------------------------------- |
| `notifications.email`  | array  | `[]`                | Email addresses to notify          |
| `notifications.slack`  | object | *none*              | Slack webhook configuration        |
| `notifications.events` | array  | `["deploy.failed"]` | Which events trigger notifications |

Example:

```yaml
notifications:
  events: [deploy.succeeded, deploy.failed]
  slack:
    webhook: https://hooks.example.com/...
    channel: "#deploys"
```

## Plan limits

Limits that apply at the workspace level, by plan:

| Limit                      | Free   | Pro   | Business  | Enterprise |
| -------------------------- | ------ | ----- | --------- | ---------- |
| Active projects            | 3      | 25    | Unlimited | Unlimited  |
| Concurrent builds          | 1      | 3     | 10        | Custom     |
| Build minutes / month      | 500    | 6,000 | 24,000    | Custom     |
| Bandwidth / month          | 100 GB | 1 TB  | 5 TB      | Custom     |
| Team members               | 1      | 10    | 50        | Unlimited  |
| Custom domains per project | 1      | 10    | Unlimited | Unlimited  |

{% hint style="info" %}
Need higher limits than Business offers? [Contact sales](https://gitbook.com/contact) to discuss Enterprise pricing.
{% endhint %}


# Glossary

Definitions of terms you'll encounter in the docs and dashboard.

Plain-language definitions of terms used across the platform. Click any entry to expand it.

***

## A — F

<details>

<summary><strong>API key</strong></summary>

A secret token that authenticates requests to the platform's API. Keys are scoped to a workspace and inherit the permissions of whoever created them. See [Broken mention](broken://pages/fb922e107b31a3e9e9fcf81410029e993b0a9afc).

</details>

<details>

<summary><strong>Automation</strong></summary>

A piece of code that runs in response to a trigger — for example, a deploy completing or a comment being posted. See [Automations](https://docs.yifi.io/docs/earn/guides/automations).

</details>

<details>

<summary><strong>Build</strong></summary>

The process of turning your source code into deployable output. Each build produces an artefact, which is then promoted to a deploy.

</details>

<details>

<summary><strong>Custom domain</strong></summary>

Your own domain (like `docs.yourcompany.com`) attached to a project, in place of the auto-generated subdomain. See [Custom domains](https://docs.yifi.io/docs/earn/guides/custom-domains).

</details>

<details>

<summary><strong>Deploy</strong></summary>

A live version of your project, served from a URL. Each successful build can be promoted to a deploy. The current production deploy is the one served at your primary URL.

</details>

<details>

<summary><strong>Environment</strong></summary>

The set of variables, secrets, and configuration that applies when your project runs. Most projects have at least two environments: production and preview.

</details>

***

## G — P

<details>

<summary><strong>Guest</strong></summary>

A workspace role that can view published deploys but nothing else. Guests don't count towards your member limit. See [Broken mention](broken://pages/fb922e107b31a3e9e9fcf81410029e993b0a9afc).

</details>

<details>

<summary><strong>Member</strong></summary>

Anyone with access to a workspace. Each member has a role that determines what they can do. Different from a guest, which is a special role that doesn't count towards your member limit.

</details>

<details>

<summary><strong>Preview deploy</strong></summary>

A deploy created automatically for a branch or pull request, served at a unique URL. Used to test changes before they reach production.

</details>

<details>

<summary><strong>Project</strong></summary>

A deployable unit. Each project has its own source, builds, deploys, environment, and domains. Projects are isolated from each other within a workspace. See [Broken mention](broken://pages/8d7897a648fcd91cdfe61c6055c3fc9a2774e089).

</details>

***

## R — Z

<details>

<summary><strong>Role</strong></summary>

A workspace-level designation that determines what a member can do. Roles are: Guest, Viewer, Reviewer, Editor, and Admin. See [Broken mention](broken://pages/fb922e107b31a3e9e9fcf81410029e993b0a9afc).

</details>

<details>

<summary><strong>Source</strong></summary>

The repository or upload that produces your project's builds. A project has exactly one source.

</details>

<details>

<summary><strong>SSO</strong></summary>

Single sign-on. Lets your team authenticate with your identity provider (Okta, Azure AD, etc.) instead of platform-specific credentials. Available on Business and Enterprise plans.

</details>

<details>

<summary><strong>Trigger</strong></summary>

The event that starts an automation — for example, `deploy.succeeded` or `webhook.received`. See [Automations](https://docs.yifi.io/docs/earn/guides/automations).

</details>

<details>

<summary><strong>Workspace</strong></summary>

The top-level container for a team's work. Owns billing, members, and projects. See [Broken mention](broken://pages/8d7897a648fcd91cdfe61c6055c3fc9a2774e089).

</details>

***

{% hint style="info" %}
A term missing? [Suggest it in the community](https://community.example.com/) — we update this glossary regularly.
{% endhint %}


