> For the complete documentation index, see [llms.txt](https://andrecronje.gitbook.io/yearn-finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://andrecronje.gitbook.io/yearn-finance/developers/integration-guide.md).

# Integration Guide

## Integration Points

* [Vault Registry](/yearn-finance/developers/integration-guide.md#Vault-Registry)
* [Subgraph](/yearn-finance/developers/integration-guide.md#Subgraph)
* [API](/yearn-finance/developers/integration-guide.md#API)

### Vault Registry <a href="#vault-registry" id="vault-registry"></a>

The Yearn Vault Registry (aka yRegistry) is a smart contract deployed on the ethereum mainnet. The Vault Registry is the single source of truth for active Yearn vaults. The registry allows users to query for active Yearn vaults and vault metadata (see "[available data](/yearn-finance/developers/integration-guide.md#Vault-Registry-Available-Data)" below).

#### Details

* Currently vaults are added manually by Yearn governance.
* In the future the vault registry may be integrated into the vault lifecycle (meaning new vaults would get added into the registry during their deployment process).

#### Interact

* ENS: [registry.ychad.eth](https://etherscan.io/enslookup-search?search=registry.ychad.eth)
* Address: [0x3ee41c098f9666ed2ea246f4d2558010e59d63a0](https://etherscan.io/address/0x3ee41c098f9666ed2ea246f4d2558010e59d63a0#readContract)

#### Code

* <https://github.com/iearn-finance/yearn-protocol/blob/develop/contracts/registries/YRegistry.sol>

#### Available data <a href="#vault-registry-available-data" id="vault-registry-available-data"></a>

* Vault addresses (methods: `getVaults`).
* Active controller address per vault (methods: `getVaultInfo`, `getVaultsInfo`).
* Active strategy address per vault (methods: `getVaultInfo`, `getVaultsInfo`).
* Vault type (normal, wrapped, delegated) (methods: `isDelegated`, `isWrapped`).
* Governance address (methods: `governance`).

#### Integrations

* Yearn API - utilizes vault registry as the single source of truth in many API calls.

#### Future Integrations

* Yearn Subgraph - in the future we would like the Yearn subgraph to index new vaults automatically using the Vault registry. In order to accomplish this the vault registry must first be incorporated into the vault lifecycle.

### Subgraph <a href="#subgraph" id="subgraph"></a>

The Yearn Subgraph is a GraphQL-based public API running on [The Graph](https://thegraph.com) that can be utilized to extract current and historical data from the Yearn ecosystem.

#### Details

* See [README](https://github.com/juanmardefago/subgraph-y/blob/master/README.md) for detailed integration details.

#### Interact

* [Graph Explorer](https://thegraph.com/explorer/subgraph/iearn-finance/yearn-finance)

#### Code

* [Github](https://github.com/juanmardefago/subgraph-y)

#### Available data

* Vault snapshot (current contract values).
* Vault metrics per vault (net deposits, withdrawals, transfers, earnings, etc.).
* Vault metrics per user (net deposits, withdrawals, transfers, earnings, etc.).
* Active controller address per vault.
* Active strategy address per vault.
* Historical harvest events and earnings.

#### Integrations

**Examples of projects using the Yearn Subgraph**

| Link                             | Code                                        | By                                                                                                                       |
| -------------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| <https://yearn.tools>            | <https://github.com/yearn-integrations/api> | [x48](https://twitter.com/x48_crypto), [Lucinao](https://twitter.com/lbertenasco), [Graham](https://twitter.com/grahamu) |
| <https://yvault-roi.netlify.app> | <https://github.com/rrridges/yvault-roi>    | [Matt Ridges](https://twitter.com/rrridges)                                                                              |
| <https://www.yfistats.com>       |                                             | [Bob\_The\_Builder](https://twitter.com/Bob_The_Buidler)                                                                 |

### API <a href="#api" id="api"></a>

Yearn API is a collection of Serverless API endpoints focused on Yearn integrations.

#### Details

**Goals**

* Provide free API endpoints to simplify 3rd party integration with Yearn.
* Provide an "API playground" (Swagger UI) anyone can use to quickly browse and test available APIs.
* Document all existing APIs.
* Allow the entire API stack to be forked to enable community involvement in API development.

**Data Sources**

* Vault Registry - Yearn API utilizes the vault registry in a number of endpoints to maintain a list of active vaults.
* Subgraph - Yearn API utilizes the Yearn Subgraph for various metrics endpoints.

#### Interact

* Yearn API Playground (Swagger UI): <https://yearn.tools>.

#### Code

* [Github](https://github.com/yearn-integrations/api)

#### Available data

* Current vault snapshots.
* Vault listings from vault registry (with injected strategy/controller/token metadata).
* Vault metrics per user (net deposits, withdrawals, transfers, earnings, etc.).
* Vault transactions per user.
* Vault APY data.

#### Integrations

**Examples of projects using the API**

| Link                         | Code                                             | By                                        |
| ---------------------------- | ------------------------------------------------ | ----------------------------------------- |
| <https://yearn.finance>      | <https://github.com/iearn-finance/iearn-finance> | [Yearn](https://twitter.com/iearnfinance) |
| <https://yearn.party>        | <https://github.com/x48-crypto/yearn-party>      | [x48](https://twitter.com/x48_crypto)     |
| <https://feel-the-yearn.app> |                                                  | [Graham](https://twitter.com/grahamu)     |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://andrecronje.gitbook.io/yearn-finance/developers/integration-guide.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
