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

# Programmatic access

> Create an admin API key, then provision projects, enable yields, request fee configurations, and pull reporting without the dashboard UI.

Automate dashboard configuration: create projects, issue project API keys, enable yields, request fee configurations, and pull revenue and campaign data into your own systems. See [Programmatic access](https://docs.yield.xyz/documentation/advanced-setup/programmatic-access.md) for what this covers and when to reach for it instead of the dashboard.

## Prerequisites

The owner or admin role to create an admin API key. This is a separate credential from the project-level `x-api-key` your integration uses against the Yield, Perps, or Borrow API; see [Manage team roles](https://docs.yield.xyz/guides/dashboards/rbac.md#dashboard-roles-vs-api-keys).

> [!NOTE]
>
> Every programmatic route in this guide is served from `https://api.stakek.it`, the host the current admin API key documentation and dashboard Swagger reference both declare. This is a different host from `https://api.yield.xyz`, which serves the Earn API.

## Create an admin API key

**1. Open the admin API keys page**

In the dashboard, go to **Programmatic Access** (`/admin-api-keys`), the page listed as admin API keys in the navigation.

**2. Create the key**

Click **Create API Key**, give it a **Name** and an optional **Note**, then create it.

**3. Copy it immediately**

The key value is shown once. Store it in a secrets manager; there's no way to retrieve it again.

## Authenticate

Send the key on every request as the `X-ADMIN-API-KEY` header:

```bash cURL theme={null}
curl https://api.stakek.it/v1/programmatic/projects \
  -H "X-ADMIN-API-KEY: $ADMIN_API_KEY"
```

## Provision a project

**1. Create a project**

```bash cURL theme={null}
curl -X POST https://api.stakek.it/v1/programmatic/projects \
  -H "X-ADMIN-API-KEY: $ADMIN_API_KEY" \
  -H "content-type: application/json" \
  -d '{ "name": "Acme", "description": "Production integration" }'
```

```json Response (excerpt) theme={null}
{ "id": "...", "name": "Acme", "teamId": "..." }
```

**2. Create a project API key**

This is the `x-api-key` your integration will use against the Yield, Perps, or Borrow API, scoped to the project you just created.

```bash cURL theme={null}
curl -X POST https://api.stakek.it/v1/programmatic/projects/{projectId}/keys \
  -H "X-ADMIN-API-KEY: $ADMIN_API_KEY" \
  -H "content-type: application/json" \
  -d '{ "name": "Production key" }'
```

```json Response (excerpt) theme={null}
{ "id": "...", "name": "Production key", "apiKey": "...", "projectId": "..." }
```

`apiKey` is shown once, the same as a key created from the dashboard. An optional `expiresAt` (date only) sets an expiration; omitted, it defaults to 30 days.

**3. Enable yields**

A project only serves yields it has enabled. Pass an array of yield ids:

```bash cURL theme={null}
curl -X POST https://api.stakek.it/v1/programmatic/projects/{projectId}/yields/enabled \
  -H "X-ADMIN-API-KEY: $ADMIN_API_KEY" \
  -H "content-type: application/json" \
  -d '[{ "integrationId": "base-usdc-aave-v3-lending" }]'
```

List what's currently enabled with `GET` on the same path (paginated, `page`/`limit`, max 50 per page); remove one with `DELETE .../yields/enabled/{integrationId}`, or several at once with `DELETE .../yields/enabled` and a body.

**4. Request a fee configuration**

```bash cURL theme={null}
curl -X POST https://api.stakek.it/v1/programmatic/projects/{projectId}/fee-configuration \
  -H "X-ADMIN-API-KEY: $ADMIN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "integrationId": "base-usdc-aave-v3-lending",
    "managementFeeBps": 100,
    "performanceFeeBps": 1000,
    "depositFeeBps": 50
  }'
```

```json Response (excerpt) theme={null}
{ "id": "...", "integrationId": "base-usdc-aave-v3-lending", "status": "REQUESTED", "managementFeeBps": 100, "performanceFeeBps": 1000, "depositFeeBps": 50 }
```

Each fee type accepts 1 to 10,000 bps. Keep `performanceFeeBps` at or below 2,000 (20%); Yield.xyz doesn't charge the portion of a performance fee above that, so a higher value doesn't get you more revenue. A new configuration starts `REQUESTED`, moves to `PROCESSING` while Yield.xyz deploys the fee contracts, then `LIVE`; only a `LIVE` configuration is applied to transactions. Updating a configuration sets it back to `REQUESTED`. `GET` (paginated) and `PATCH`/`DELETE .../fee-configuration/{feeConfigurationId}` manage existing ones. See [Reporting](https://docs.yield.xyz/documentation/advanced-setup/reporting.md) for where the resulting revenue shows up, and register a payout wallet in the dashboard for each network you charge fees on; see [Set up fees and payouts](https://docs.yield.xyz/guides/dashboards/fees-payouts.md).

## Manage what you provisioned

The same pattern, `GET` to list, `PATCH` to update, `DELETE` to remove, applies to projects and project API keys:

| Resource | Path |
| - | - |
| Projects | `GET /v1/programmatic/projects`; `PATCH`/`DELETE /v1/programmatic/projects/{projectId}` |
| Project API keys | `/v1/programmatic/projects/{projectId}/keys/{keyId}` |

## Reporting

Pull the same revenue and performance data reporting shows in the dashboard, scoped to a project:

```bash cURL theme={null}
curl "https://api.stakek.it/v1/programmatic/projects/{projectId}/reporting/revenue?date=2026-09-29" \
  -H "X-ADMIN-API-KEY: $ADMIN_API_KEY"
```

That route returns one project's daily revenue by integration; `/reporting/revenue/aggregate` (with `from`/`to`) totals it across integrations for a date range. `/reporting/performance` and `/reporting/performance/aggregate` return the same shapes for volume and TVL instead of revenue. A team-wide, non-project-scoped feed of individual actions is available at `GET /v1/programmatic/report-entries`, filterable by project, integration, status, type, and address. See [Reporting](https://docs.yield.xyz/documentation/advanced-setup/reporting.md) for what each figure means.

Perps and Borrow activity have their own project-scoped routes under the same `/v1/programmatic/projects/{projectId}/reporting` prefix. List routes are paginated with `page`/`limit` (default 10; a `limit` above 50 is capped at 50). Dates take `YYYY-MM-DD` or ISO 8601 in UTC, and a date-only `to` covers that whole day.

| Route | Returns | Key query params |
| - | - | - |
| `/perps/actions` | Perp actions | Optional `address`, `status`, `type`, `marketId`, `providerId` |
| `/perps/activity` | Chronological feed of perp actions and timeline events | Same filters, plus optional `from`/`to` (together, up to 10 days; the last 10 days when omitted) |
| `/perps/revenue` | Daily perps fee revenue rows (builder, bridge, and referral fees) plus totals for the range | Required `startDate`, `endDate` (`YYYY-MM-DD`, up to 90 days); optional `provider`, `source` (`BUILDER_FEE`, `BRIDGE_FEE`, or `REFERRAL_FEE`); not paginated |
| `/borrow/actions` | Borrow actions, dated by completion time | Optional `address`, `status`, `type`, `marketId`, `integrationId`, `from`/`to` (together, up to 10 days; the last 10 days when omitted) |
| `/borrow/revenue` | On-chain borrow fee revenue per period, market, and token | Required `from`, `to` (up to 90 days), `granularity` (`day`, `week`, or `month`); optional `marketIds`, `integrationIds` (comma-separated) |
| `/borrow/revenue/summary` | USD fee totals for the range, the previous equal-length window, and the percent change | Same as `/borrow/revenue`, not paginated |
| `/borrow/overview` | Current collateral, borrowed amount, active borrowers, and average LLTV, plus fees for the range | Required `from`, `to` (up to 90 days, applies to fees only); optional `integrationIds`, `marketIds` or `includeAllMarkets=true` (not both) |

## Campaign reporting

[Incentive campaign](https://docs.yield.xyz/documentation/earn/incentive-campaigns.md) data is readable, not configurable, through the programmatic campaign routes:

```bash cURL theme={null}
curl "https://api.stakek.it/v2/programmatic/projects/{projectId}/campaigns" \
  -H "X-ADMIN-API-KEY: $ADMIN_API_KEY"
```

```json Response (excerpt) theme={null}
{ "data": [{ "id": "camp_...", "integrationId": "...", "status": "active", "rewardToken": "...", "totalBudget": "..." }] }
```

Per-campaign routes under `/v2/programmatic/projects/{projectId}/campaigns/{campaignId}/` cover balances (per-user earned, paid, and unpaid totals), accrual details by window, TVL stats, payout runs and their per-batch detail, the campaign multi-sig's live balance, and a payout-eligibility summary. All of them are read-only.

## Manage tenants

If you onboard your own clients, you can create a tenant for each one. The same admin API key works on the projects inside every tenant you own: use the project-scoped key, yield, fee-configuration, reporting, and campaign routes above with a tenant project's `projectId`. See [Manage tenants](https://docs.yield.xyz/guides/enterprise/manage-tenants.md) for the step-by-step flow.

## Next steps

> [card] [Programmatic access](https://docs.yield.xyz/documentation/advanced-setup/programmatic-access.md)
>
> What this credential covers and who can create one.

> [card] [Reporting](https://docs.yield.xyz/documentation/advanced-setup/reporting.md)
>
> Dashboard and programmatic reporting side by side.

> [card] [Incentive Campaigns](https://docs.yield.xyz/documentation/earn/incentive-campaigns.md)
>
> How a campaign accrues and pays out.

> [card] [Manage team roles](https://docs.yield.xyz/guides/dashboards/rbac.md)
>
> Who can create an admin API key.

> [card] [Manage tenants](https://docs.yield.xyz/guides/enterprise/manage-tenants.md)
>
> Create a tenant per client and manage its projects.

> [card] [Set up fees and payouts](https://docs.yield.xyz/guides/dashboards/fees-payouts.md)
>
> Register payout wallets for the fees you configure.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.