Prerequisites
- A yield.xyz API key, sent as
x-api-keyon every request. See Projects & API keys. - At least one yield enabled for your project.
GET /v1/yieldsis project-scoped and returns nothing for a project with no yields enabled.
1
Confirm what's enabled
Call
GET /v1/yields with no filters and a small limit to check what your project has access to before building any UI around it.total in the response tells you how many yields your project has enabled overall, regardless of limit. A total of 0 means the project has nothing enabled yet: see Step 3.2
Filter and paginate
Narrow the list with query parameters, combined as needed. For an integration that only offers stablecoin lending on Base, for example, filter by
network, inputToken, and types:Response (excerpt)
base-usdc-aave-v3-lending is a discovered result here, not a fixed value: pick items[0].id, or let the user pick from the list, rather than hardcoding an ID in your app. limit defaults to 20 and caps at 100 per request; page through a larger result set with offset. See Discover for the full filter list, including provider, search, prime, hasCooldownPeriod, and sort.3
Handle an empty result
An empty
items array with total: 0 means either the filters matched nothing, or the project has no yields enabled at all. Distinguish the two by re-running the same request with every filter removed:- If the unfiltered call also returns
total: 0, no yields are enabled for this project yet. Enable some from the dashboard or through Programmatic access, then retry. - If the unfiltered call returns results, the filters were too narrow. Relax them (drop
inputTokenortypefirst) rather than showing a dead end.
4
Fetch one yield
Once a user picks a yield (or your backend needs full detail on one), fetch it by A yield not enabled for your project, including one from a stale ID your app cached earlier, returns
id for the complete metadata object:400 Bad Request here. Re-run discovery instead of assuming a previously seen ID stays valid.5
Read the fields before offering it
Before showing an enter or exit button, read the fields that tell you whether the action is currently possible and what it needs:
Response (excerpt)
entryLimits, cooldownPeriod, and warmupPeriod are each optional and can be entirely absent, not just null: base-usdc-aave-v3-lending above has no cooldown, since Aave V3 lending has no unbonding step. Check for the field before reading its sub-values. See Yield metadata for the full object reference.6
Optional: build an asset-first picker
To let a user start from a network or a token instead of a yield list, query the two supporting catalogs. Both are project-scoped the same way as Use the returned networks or tokens to pre-filter
GET /v1/yields.GET /v1/yields (Step 2) once the user picks one, rather than fetching every yield and filtering client-side.Next steps
Enter and exit flows
Turn a discovered yield into a signed, submitted, and tracked position.
Validator selection
Choose a validator when a staking yield requires one.
Check RWA eligibility
Confirm KYC status before entering a yield that requires it.
Yield metadata
Full reference for every field on the yield object.

