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

# List rebalance opportunities

> Cross-protocol APY comparison to suggest better yield destinations.

<ParamField header="x-api-key" type="string" required placeholder="your-api-key">
  Your StarkFi API key. You can find it in your [dashboard](https://app.starkfi.io).
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url https://api.starkfi.io/yield/rebalance-opportunities \
    --header 'x-api-key: <api_key>'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://api.starkfi.io/yield/rebalance-opportunities",
    { headers: { "x-api-key": "<api_key>" } }
  );
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.starkfi.io/yield/rebalance-opportunities",
      headers={"x-api-key": "<api_key>"},
  )
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "statusCode": 200,
    "success": true,
    "status": "get_rebalance_opportunities_ok",
    "message": "Rebalance opportunities retrieved successfully",
    "data": {
      "opportunities": [],
      "sources": null
    }
  }
  ```

  ```json 502 - Bad Gateway theme={null}
  {
    "statusCode": 502,
    "success": false,
    "status": "get_rebalance_opportunities_failed",
    "message": "Could not compute rebalance opportunities",
    "data": {
      "opportunities": [],
      "sources": null
    }
  }
  ```
</ResponseExample>

### Response

<ResponseField name="data.opportunities" type="array">
  Opportunity rows derived from provider data.
</ResponseField>

<ResponseField name="data.sources" type="object">
  Upstream diagnostics (may be `null`).
</ResponseField>
