> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pan.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Obtener Yields

> GET /v1/yields

Obtiene las tasas APY disponibles en protocolos DeFi.

## Endpoint

```
GET https://api.pan.tech/v1/yields
```

## Autenticación

API Key o X402

## Response

### 200 OK

```json theme={null}
{
  "chains": ["arbitrum", "base", "ethereum"],
  "assets": ["USDC", "USDT", "DAI", "WETH"],
  "rates": [
    {
      "chain": "base",
      "asset": "USDC",
      "apy": 8.52
    },
    {
      "chain": "arbitrum",
      "asset": "USDC",
      "apy": 7.23
    },
    {
      "chain": "ethereum",
      "asset": "USDC",
      "apy": 5.15
    }
  ],
  "best": {
    "chain": "base",
    "asset": "USDC",
    "apy": 8.52,
    "reasoning": "Highest APY available for USDC"
  },
  "updatedAt": "2024-01-15T10:30:00Z"
}
```

### Campos de Respuesta

| Campo       | Tipo      | Descripción                    |
| ----------- | --------- | ------------------------------ |
| `chains`    | string\[] | Chains consultadas             |
| `assets`    | string\[] | Assets soportados              |
| `rates`     | array     | Lista de tasas por chain/asset |
| `best`      | object    | Mejor opcion recomendada       |
| `updatedAt` | string    | Timestamp de actualizacion     |

### Campos de Rate

| Campo   | Tipo   | Descripción              |
| ------- | ------ | ------------------------ |
| `chain` | string | Nombre de la chain       |
| `asset` | string | Token soportado          |
| `apy`   | number | APY actual en porcentaje |

### Campos de Best

| Campo       | Tipo   | Descripción                      |
| ----------- | ------ | -------------------------------- |
| `chain`     | string | Chain con mejor yield            |
| `asset`     | string | Asset recomendado                |
| `apy`       | number | APY de la mejor opcion           |
| `reasoning` | string | Razonamiento de la recomendación |

## Ejemplos

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.pan.tech/v1/yields" \
    -H "Authorization: Bearer $PAN_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.pan.tech/v1/yields', {
    headers: {
      'Authorization': `Bearer ${process.env.PAN_API_KEY}`
    }
  });

  const { rates, best } = await response.json();
  console.log('Mejor APY:', best.apy, '% en', best.chain);
  console.log('Razon:', best.reasoning);
  ```

  ```typescript SDK theme={null}
  const yields = await pan.yields.getAll();
  console.log('Mejor APY:', yields.best.apy);
  console.log('Todas las rates:', yields.rates);
  ```
</CodeGroup>

## Notas

* Los APYs se actualizan cada 5 minutos
* `best` indica la mejor oportunidad actual con `reasoning`
* Cache recomendado: 1-5 minutos
