Developers and integrators: REST API, agent integration, protocol and wallet internals.
# Developer guides
> Integrate with YieldSeeker through the API and secure agent infrastructure.
These guides cover the REST API, agent-type integrations, protocol behavior, and AgentWalletKit security. ## API [Section titled “API”](#api) * [API overview](/developers/api/) * [API Quickstart](/developers/api/quickstart/) * [API authentication](/developers/api/authentication/) * [Creating an agent via API](/developers/api/creating-an-agent/) * [Generated API v1 reference](/api-v1) ## Agent integrations [Section titled “Agent integrations”](#agent-integrations) * [Agent type integration contract](/developers/agents/types/) * [Vault Agent API integration](/developers/agents/vault/) ## Platform internals [Section titled “Platform internals”](#platform-internals) * [Platform architecture](/developers/protocol/architecture/) * [Execution framework](/developers/protocol/execution/) * [Governance, registries, pauses, and timelocks](/developers/protocol/governance/) * [AgentWalletKit integration and security](/developers/security/agent-wallet-kit/) [Getting started](/getting-started/) and the [Vault Agent pages](/agent-types/vault/) explain how to use the app without implementation knowledge.
# Agent type integration contract
> The stable boundary for adding a new YieldSeeker agent type.
An agent type defines a strategy runtime inside the shared YieldSeeker account, wallet, authorization, and safety model. ## Required type definition [Section titled “Required type definition”](#required-type-definition) Every type should specify: * a stable type identifier, goal, success metrics, and supported chains and assets * creation and activation fields, plus permitted operations * rule types and their parser, where the type supports rules or memory compilation * monitoring metrics and status states * user controls and exit behavior * API errors and retry/idempotency rules * strategy-specific risks ## Type-specific rules and monitoring [Section titled “Type-specific rules and monitoring”](#type-specific-rules-and-monitoring) When a type supports rules, it registers a parser to validate rule configurations and identify which rule types can be compiled from memories. Without a registered parser, the rule system allows no rules for that type. Each type-specific `Monitor` passes its `agentType` and typed rule class to the shared `Monitor` base, then implements `_build_rule_boundaries(agent, snapshot, rules)` to build boundaries from holdings and effective typed rules, and `_list_metric_values()` to supply metric values keyed by `(chainId, subjectKey, metric)`. The base handles boundary refresh, evaluation, states, and shared queries. Rules without measurable limits may produce no boundaries. ## Shared platform boundary [Section titled “Shared platform boundary”](#shared-platform-boundary) A type does not receive unrestricted wallet access. It operates through the same ownership, authorization, adapter, registry, and emergency controls described in [Security](/security/) and [AgentWalletKit integration](/developers/security/agent-wallet-kit/). ## Current type [Section titled “Current type”](#current-type) `vault` is the currently available type. It allocates supported assets across approved DeFi vaults and exposes Vault Agent-specific yield, position, and Autoseek operations. See [Creating an agent via API](/developers/api/creating-an-agent/) and [Vault Agent API integration](/developers/agents/vault/). ## Adding a future type [Section titled “Adding a future type”](#adding-a-future-type) A future borrowing, basis-trade, or other type should be a sibling integration with its own rule parser, monitor, API guide, user guide, metrics, risk disclosure, and support matrix entry. Do not make Vault Agent fields, APY metrics, vault addresses, or rebalance semantics mandatory for every type.
# Vault Agent API integration
> Integrate with the current Vault Agent lifecycle and operations.
The Vault Agent is the current YieldSeeker agent type. Its API manages a base asset across approved DeFi vault opportunities and exposes yield, position, activity, and preference operations. ## Lifecycle [Section titled “Lifecycle”](#lifecycle) 1. Create the agent with `type: vault`. 2. Get its Agent Wallet address. 3. Fund the wallet with a supported base asset. 4. For a standard user request, deploy after the Agent Wallet holds at least $10 worth of its base asset. A validated integrator request may deploy before funding. 5. Read positions, activity, and performance as the agent operates. 6. Withdraw positions and wallet balances before deactivation. A deactivated agent can be reactivated later. See [Creating an agent via API](/developers/api/creating-an-agent/) for the generic create operation. ## Deposits and withdrawals [Section titled “Deposits and withdrawals”](#deposits-and-withdrawals) Deposits and wallet withdrawals use unsigned transactions that the user signs. `prepareDeposit` transfers from the connected wallet to the Agent Wallet; `prepareWithdrawal` moves the idle base asset back to the user’s wallet. `withdrawFromPosition` uses the Agent Wallet’s permitted execution path to move a vault position back into the Agent Wallet. None of these routes give integrators owner-key access or accept an arbitrary recipient. ### Deposit [Section titled “Deposit”](#deposit) 1. Call `prepareDeposit` to get unsigned transaction data for transferring the base asset from the user’s connected wallet to the Agent Wallet. 2. Have the user sign and submit that transaction with their own wallet. 3. After the transaction confirms, call:
```http
POST /v1/users/{userId}/agents/{agentId}/deposit-made
GET /v1/users/{userId}/agents/{agentId}/snapshot?shouldForceRefresh=true
```
`notifyAgentDeposit` tells the agent the deposit landed, so it allocates it straight away instead of on its next scheduled check (every 30 minutes). It queues an Autoseek run that reads the wallet live; idle base asset worth at least the funding minimum skips the usual frequency limit. It does nothing for an agent that isn’t deployed yet, or within an hour of a manual withdrawal. The snapshot call refreshes the agent snapshot so the API reflects the confirmed deposit. ### Withdraw from a vault position [Section titled “Withdraw from a vault position”](#withdraw-from-a-vault-position) Call `withdrawFromPosition` to move assets from an approved vault position back into the Agent Wallet. This operation is executed through the agent’s permitted session-key path. It does not send assets to the user or to an arbitrary address. ### Withdraw from the Agent Wallet [Section titled “Withdraw from the Agent Wallet”](#withdraw-from-the-agent-wallet) 1. Call `prepareWithdrawal` to get unsigned transaction data for withdrawing the idle base-asset balance to the user’s connected wallet. 2. Have the user sign and submit the transaction with their own wallet. 3. After the transaction confirms, call:
```http
GET /v1/users/{userId}/agents/{agentId}/snapshot?shouldForceRefresh=true
```
This refreshes the agent snapshot so the API reflects the confirmed withdrawal. Without `shouldForceRefresh=true`, the snapshot endpoint returns the stored snapshot straight away and refreshes it in the background when it is more than 10 minutes old. See the [API authentication guide](/developers/api/authentication/) for signed API requests and the [generated API reference](/api-v1) for exact request and response schemas. ## List vaults [Section titled “List vaults”](#list-vaults)
```http
GET /v1/chains/{chainId}/assets/{assetAddress}/vault-options
```
This public operation lists the vaults a new agent can allocate to, without forcing a refresh. Vaults YieldSeeker has disabled (for example 40acres and Moonwell), gated behind an experiment, or that the agent wallet can’t use are left out, so a vault picker built on this list follows those changes automatically. Add `shouldIncludeUnavailable=true` to also get those vaults, for example to show the name of a vault an agent still holds. `GET /v1/chains/{chainId}/assets/{assetAddress}/yield-options` is a deprecated alias that returns the same vaults under `yieldOptions`. The backend also defines `POST /v1/vault-options/refresh` (vault list and metrics) and `POST /v1/vault-metrics/refresh` (metrics only), which refresh every supported chain and asset, but they are cron-authenticated rather than client refresh operations. Availability, APY, liquidity, and rewards can change. ## Expected APY [Section titled “Expected APY”](#expected-apy)
```http
GET /v1/chains/{chainId}/assets/{assetAddress}/apy-stats?rulePreset=explorative
```
This public operation returns active agents’ 7-day and 30-day APY for a supported base asset, weighted by how much each agent holds: `apyMoneyWeighted7d`/`apyMoneyWeighted30d` are the averages, and the 25th/50th/75th percentiles split the money, not the agents. Omit `rulePreset` to include every preset. These are realized returns, so they are already after the platform fee. For each window, only agents worth at least $100 with at least that many days of history count, users in a YieldSeeker reward campaign (Merkl or boost) that ran during the window are left out because campaign rewards inflate their APY, and the fields are `null` when fewer than 20 agents qualify. Show `expectedApy7d` or `expectedApy30d`, which are never `null`. When enough agents qualify each is the matching money-weighted average. Otherwise it is an estimate: the APY the allocation engine would earn today for a $10,000 deposit on that preset, from each chosen vault’s 7-day or 30-day average APY, after the platform fee. Present it as a guide based on recent results, not a promise. ## Preferences and simulations [Section titled “Preferences and simulations”](#preferences-and-simulations) All preference and simulation endpoints are user-scoped. Authenticate them with the user’s signed wallet token. They change agent configuration or return projections; they do not give an integrator owner permission over the Agent Wallet. ### Read preferences and rules [Section titled “Read preferences and rules”](#read-preferences-and-rules)
```http
GET /v1/users/{userId}/agents/{agentId}/memories
GET /v1/users/{userId}/agents/{agentId}/memories/effective-rules
GET /v1/users/{userId}/agents/{agentId}/memories/active-limit
```
Use `memories` for saved natural-language preferences, `effective-rules` to inspect the rules applied to allocation decisions, and `active-limit` for the agent’s active-memory capacity. `effective-rules` returns memory-derived `userRules` and computed `defaultRules` separately. A user rule replaces a default of the same type. ### Save a preference [Section titled “Save a preference”](#save-a-preference)
```http
POST /v1/users/{userId}/agents/{agentId}/memories
POST /v1/users/{userId}/agents/{agentId}/memories/{memoryId}
POST /v1/users/{userId}/agents/{agentId}/memories/{memoryId}/delete
```
Create a memory with the preference you want the agent to retain. Update its content or active state when it changes. Delete it when it should no longer be part of the agent’s configuration. A memory is interpreted as an allocation preference, not as arbitrary transaction calldata. When replacing a filter or list-based preference, read the current effective rules first and write the complete desired end state. A new memory can replace or constrain an existing rule rather than merging with it. To set the vaults an agent may use from an app’s vault picker, write the one managed `ignored_vault` memory instead of a free-text memory: see [vault selection for integrators](/integrators/#vault-selection). Its allowlist always applies; other memories can only add blocked vaults. For a broad profile change, update the agent with:
```http
PATCH /v1/users/{userId}/agents/{agentId}
```
The supported presets are `conservative` and `explorative` (the default). Use memories for detailed preferences that should be compiled into allocation rules. ### Simulate before saving [Section titled “Simulate before saving”](#simulate-before-saving)
```http
POST /v1/users/{userId}/agents/{agentId}/simulate
GET /v1/users/{userId}/simulate/credits
```
`runAgentSimulation` previews how one or more memory strings would change derived rules, vault scores, and target allocations. A saved managed `ignored_vault` memory is always included. It does not save the memories or execute an allocation. Each simulation consumes one credit. Use `getSimulationCreditsStatus` to show the remaining daily credits; credits reset daily in UTC and Pro users receive a higher limit. ## Positions and activity [Section titled “Positions and activity”](#positions-and-activity)
```http
GET /v1/users/{userId}/agents/{agentId}/vault-positions
GET /v1/users/{userId}/agents/{agentId}/actions
```
These operations return current positions and previous allocation decisions. Treat position data as a snapshot that can become stale while blockchain/provider data is updated. `GET /v1/users/{userId}/agents/{agentId}/yield-positions` is a deprecated alias that returns the same positions under `yieldPositions`, each with `yieldOption` in place of `vaultOption`. Each vault position has `netApy`: the vault’s current `riskAdjustedApy` after the agent’s platform fee. In a rebalance action’s `details`, each entry in `deposits` and `withdrawals` has `apy` and `netApy`, the vault’s APY when the move ran, before and after the fee. Older actions don’t have them. Both after-fee values are estimates, because the fee is only charged on realized positive yield. ## Deactivation [Section titled “Deactivation”](#deactivation) Deactivation fails while the Agent Wallet still holds value. Withdraw vault positions and the remaining wallet balance before deactivating. YieldSeeker also deactivates deployed Vault Agents that stay empty (below $0.001) for 7 days in a row, in batches, including ones that were deployed but never funded. An agent that was never deployed is left alone. ### Reactivate an agent [Section titled “Reactivate an agent”](#reactivate-an-agent)
```http
POST /v1/users/{userId}/agents/{agentId}/reactivate
```
`reactivateAgent` brings a deactivated agent back with the same Agent Wallet, memories (including a managed vault allow-list), rules, rule preset and history, so nothing has to be copied to a new agent. Deactivated agents don’t appear in the user’s agent list; integrators can find them with `deactivatedDate` in `GET /integrators/v1/{integratorId}/agents`. * **Current wallet version only:** agents whose Agent Wallet is an older version (`walletType` on the agent’s wallet) return `AGENT_WALLET_OUTDATED`; create a new agent for those. * **Same limits as creating an agent:** `USER_MAX_ACTIVE_AGENTS_REACHED` when the user is at their active-agent limit, `USER_ALREADY_HAS_AGENT_FOR_ASSET` when another active agent already uses that asset (assets other than USDC), and `AGENT_TYPE_NOT_SUPPORTED` when the user can no longer create that agent type. * **Only deactivated agents:** an active agent returns `AGENT_NOT_DEACTIVATED`. * **Allocation resumes on the next run:** Autoseek picks the agent up again once its wallet holds at least the funding minimum. After funding, call `notifyAgentDeposit` to allocate straight away. Do not retry deactivation blindly; inspect the returned error and current wallet state first. ## Authoritative reference [Section titled “Authoritative reference”](#authoritative-reference) The [generated API reference](/api-v1) owns exact request/response schemas. The [Vault Agent pages](/agent-types/vault/) explain the same behavior without requiring API knowledge.
# Vault Agent decision pipeline
> How the Vault Agent evaluates and selects allocations.
The Vault Agent’s Autoseek pipeline turns the current vault options and portfolio into target allocations, then hands required actions to the shared Execution Framework.
```
flowchart LR
Options[Active vault options] --> Scope[Wallet execution checks]
Scope --> Rules[Effective rule filters]
Rules --> Scores[Model and rule-adjusted scores]
Scores --> Targets[Capacity and portfolio utility]
Targets --> Actions[Planned actions]
Actions --> Execution[Execution Framework]
Monitoring[Monitoring] -. new breach: eligible early .-> Autoseek[Autoseek run]
Autoseek --> Options
```
## Candidate discovery [Section titled “Candidate discovery”](#candidate-discovery) Autoseek loads vault options for the agent’s base asset and removes inactive options. It also excludes experiment-blocked and permanently disabled vaults. The wallet’s execution path applies its own target checks, such as requiring a registered adapter or an approved address. The public vault-options API already leaves out disabled, experiment-gated and unregistered vaults, but a vault it returns can still be filtered out by the agent’s rules. ## Rules and eligibility [Section titled “Rules and eligibility”](#rules-and-eligibility) The Rule Manager supplies the effective Vault Agent rules: memory-derived user rules and computed defaults from the selected preset. `explorative` is the default preset; `conservative` is the other supported profile. The `effective-rules` API returns the user and default rules separately, and a user rule replaces a default of the same type. Autoseek also injects ignored-vault rules for blocked or non-depositable targets. `VaultRulesEngine` applies exclusion and eligibility rules first: ignored vaults, vault-type filters, collateral exclusions, and configured liquidity floors. It then applies per-vault capacity and withdrawable-liquidity allocation limits. Forced allocations are considered only for eligible vaults and remain subject to their capacity, available balance, and the portfolio’s vault-count limit. ## Scores and target allocations [Section titled “Scores and target allocations”](#scores-and-target-allocations) The inference model scores options; an optional yield-curve rule can adjust those scores. APY alone does not determine the result. The engine evaluates candidate portfolios using adjusted scores, liquidity and concentration risk, and estimated transition costs, within the agent’s vault-count limit. It may keep a current allocation or choose a different target portfolio. ## Monitoring and early runs [Section titled “Monitoring and early runs”](#monitoring-and-early-runs) Monitoring is a separate feedback path, not an allocation or execution step. The Vault Monitor builds measurable rule boundaries for held vault positions and checks them continuously against live metrics. If a breach becomes triggered after the agent’s last Autoseek, the agent becomes eligible for its next run without waiting for the normal frequency limit. Monitoring does not choose a target or move funds; Autoseek re-evaluates the portfolio. ## Execution handoff [Section titled “Execution handoff”](#execution-handoff) Autoseek plans actions from the target allocation. The shared Execution Framework validates and submits only permitted protocol interactions. See [Execution framework](/developers/protocol/execution/). ## Explaining a decision [Section titled “Explaining a decision”](#explaining-a-decision) The agent actions API can return recorded action and decision details for supported runs. They describe the inputs and outcome for that run, not a promise about future allocations.
# Vault Agent vault selection
> The checks used before a Vault Agent can allocate to a vault.
Vault selection is a sequence of execution checks, typed rules, score adjustments, and portfolio constraints—not a single APY ranking. ## Candidate universe [Section titled “Candidate universe”](#candidate-universe) Autoseek starts with active vault options for the agent’s base asset. It removes experiment-blocked and permanently disabled vaults, then filters targets for the wallet’s execution path, such as registered adapters or approved addresses. The public vault-options list leaves out the same disabled, experiment-gated and unregistered vaults, but a returned vault can still be ruled out by the agent’s rules. ## Rule filters and presets [Section titled “Rule filters and presets”](#rule-filters-and-presets) The Vault Agent’s registered rule types include: * `ignored_vault` to exclude listed vaults or, with `allowedVaultAddresses`, allow only listed vaults; an empty `allowedVaultAddresses` list allows no vault, so the agent exits its vaults and keeps its funds idle * `vault_type_filter` to exclude vault types * `collateral_exclusion` to exclude vaults with specified collateral exposure * `liquidity_filter` to require minimum total deposits, withdrawable value, or withdrawable ratio * `capacity_cap` to cap a vault’s allocation using its deposits and configured capacity factor * `liquidity_allocation_filter` to cap an allocation relative to withdrawable liquidity * `forced_vault_allocation` to request a target for a vault, subject to eligibility, capacity, remaining balance, and the portfolio’s vault-count limit * `yield_curve_scoring` to adjust a model score for yield-curve and stability inputs; it is registered but not memory-compilable * `vault_safety` to withdraw from a vault its provider no longer lists; it is always on and not memory-compilable The `explorative` preset is the default when an agent is created without one; `conservative` is the other supported preset. Presets generate platform defaults rather than saved user rules. `GET /v1/users/{userId}/agents/{agentId}/memories/effective-rules` returns `userRules` and `defaultRules` separately; a user rule replaces a default of the same type. ## Scoring and allocation [Section titled “Scoring and allocation”](#scoring-and-allocation) Eligible options receive inference-model scores, which an optional yield-curve rule can adjust. The engine evaluates candidate allocations using those scores alongside liquidity and concentration risk and estimated transition costs. It also respects vault-count and capacity limits, so a high-scoring vault may receive only part of the portfolio or no allocation. ## Monitoring boundaries [Section titled “Monitoring boundaries”](#monitoring-boundaries) Some rules also produce measurable boundaries for held vault positions, including liquidity, capacity, and collateral limits, and whether the vault is still listed. The Vault Monitor checks those boundaries continuously; a triggered breach can make the agent eligible for an early Autoseek run that bypasses the normal frequency limit. Monitoring itself does not select or execute an allocation. ## Inspecting current data [Section titled “Inspecting current data”](#inspecting-current-data) Use the current `effective-rules` and [vault-options API](/developers/agents/vault/#list-vaults) responses instead of hard-coding profile defaults, availability, APY, liquidity, or rewards. The list endpoint does not force a refresh, and these values can change. See [Vault Agent decision pipeline](/developers/agents/vault/decision-pipeline/) for how the engine combines these inputs and [Vault Agent preferences](/agent-types/vault/preferences/) for user-facing configuration.
# API overview
> Conventions for integrating with the YieldSeeker REST API.
The core YieldSeeker REST API lets applications create accounts and agents, read agent state, and call operations available for each agent type. ## Base URL and versioning [Section titled “Base URL and versioning”](#base-url-and-versioning) Core API endpoints use `/v1`. The companion integrator API uses `/integrators/v1`; keep the appropriate base URL and prefix in client configuration. The [interactive reference](/api-v1) is generated from API source in the same repository, not fetched from a deployed production service during the docs build. ## Requests and responses [Section titled “Requests and responses”](#requests-and-responses) Send JSON request bodies with `Content-Type: application/json`. Successful responses are JSON unless an operation is explicitly streamed. Scalar owns the exact parameters, request bodies, response models, and authentication requirements. ## Authentication [Section titled “Authentication”](#authentication) User-scoped core operations require a SIWE wallet signature in the `Authorization` header. `createUser` instead verifies `signatureString` in its request body. A valid `X-Api-Key` never replaces user authentication: it adds integrator context on a signed route only when the signed-in user was referred by that integrator, and on `createUser` it attributes the new account. The read-only integrator routes separately accept an API key instead of SIWE. Read [API authentication](/developers/api/authentication/). ## Agent types [Section titled “Agent types”](#agent-types) Agent-specific operations are not automatically valid for every type. Check the operation’s type scope and support matrix before calling it. The [Vault Agent API integration](/developers/agents/vault/) documents the current type-specific operations. ## Errors and limits [Section titled “Errors and limits”](#errors-and-limits) Use an operation’s returned status and error details. The generated reference shows its rate limit; a `429` response includes `Retry-After`. See [Rate limits](/developers/api/rate-limits/).
# API authentication
> Authenticate user-scoped YieldSeeker API requests.
User-scoped endpoints require proof that the caller controls the user’s wallet. YieldSeeker uses a Sign-In with Ethereum message and its signature as the authentication token. ## Create the token [Section titled “Create the token”](#create-the-token) 1. Create a SIWE message for the user’s wallet. 2. Use an allowed authentication domain. 3. Set `issued_at` to no more than 30 days before the request. 4. Have the wallet sign the complete message. 5. Base64-encode a JSON object containing the message and its hexadecimal signature.
```json
{
"message": "",
"signature": ""
}
```
## Resolve your userId [Section titled “Resolve your userId”](#resolve-your-userid) After `loginWithWallet`, user-scoped resource routes use `userId` rather than wallet address. Resolve it for a wallet: 1. Build the token above from a SIWE message signed by that wallet. 2. Send `POST /v1/users/login-with-wallet` with `walletAddress` in the JSON body and the token in `Authorization: Signature `. 3. On success, use `user.userId` from the response. 4. If the API returns `NO_USER`, send `POST /v1/users` with `walletAddress`, `username`, and the same token as `signatureString` in the JSON body. `createUser` does not require `Authorization`; its response also contains `user.userId`. For resource-owner routes, the supplied `userId` must match the account recovered from the signature. Call `loginWithWallet` before `createUser`; only create an account after `NO_USER`. See the [generated API reference](/api-v1) for both endpoints’ exact schemas. ## Send the token [Section titled “Send the token”](#send-the-token) For the documented v1 API, send the complete value in the `Authorization` header:
```http
Authorization: Signature
```
## Integrator API keys [Section titled “Integrator API keys”](#integrator-api-keys) For `GET /integrators/v1/{integratorId}` and its read-only `/users`, `/revenue-summary`, and `/agents` routes, `X-Api-Key: ysk_...` can be used instead of a SIWE signature. The key must belong to the same integrator identified in the request. If both credentials are sent, either valid matching credential is sufficient. Keys are not individually endpoint-scoped: any active key for that integrator can use all four routes. Listing integrators and API-key or dashboard-member management routes still require a SIWE signature. For routes scoped to an integrator, the signer must be a member; adding or removing dashboard members requires the master user. On core API routes, `X-Api-Key` only adds integrator context where the route supports it; it never replaces that route’s authentication. On signed user routes, a valid key adds context only when the signed-in user was referred by that integrator. For other users, the key is ignored as context after validation; an invalid or origin-disallowed key is still rejected. On `createUser`, a valid key attributes the new account to the integrator. Keys may have allowed origins. A configured origin list is checked against the request’s `Origin` header. Treat the key as a bearer secret: keep it server-side and never embed it in browser code. ## Rejected requests [Section titled “Rejected requests”](#rejected-requests) Requests can be rejected when the signature is missing or invalid, the SIWE domain is not allowed, `expirationTime` has passed, or `issued_at` is too old. Use the returned HTTP status, `exceptionType`, and `message` for diagnosis; do not retry an invalid credential. A request can also be rejected for exceeding the operation’s [rate limit](/developers/api/rate-limits/), which returns a `429` with a `Retry-After` header rather than an authentication error. ## Security [Section titled “Security”](#security) Never log signature tokens, private keys, seed phrases, or API keys. A signature proves control for its intended message, so construct and display the message before asking a user to sign it.
# Creating an agent via API
> Create an agent and its associated wallet programmatically.
Creation registers an agent and computes its deterministic Agent Wallet address. It does not deploy the wallet or move funds. ## Request [Section titled “Request”](#request)
```http
POST /v1/users/{userId}/agents
Content-Type: application/json
Authorization: Signature
```
The request model requires `userId`, `name`, and `emoji`; the signed-in wallet must own that `userId`. If omitted, `chainId`, `assetAddress`, and `type` default to the configured Base chain, its USDC asset, and `vault`. `rulePreset` is optional; `null` or omitted creates an `explorative` agent. The request has no generic type-configuration object. See the generated [API reference](/api-v1) for the full schema. ## Agent type [Section titled “Agent type”](#agent-type) The `type` field currently supports `vault` only. Other values fail with `AGENT_TYPE_NOT_SUPPORTED`. Do not assume that Vault Agent operations apply to another type. ## Result [Section titled “Result”](#result) The response shape is `{ agent: Agent }`; `Agent` includes `agentId`, `createdDate`, `name`, `emoji`, `chainId`, `assetAddress`, `type`, and `rulePreset`. Call `GET /v1/users/{userId}/agents/{agentId}/wallet` for `{ agentWallet: AgentWallet }`, which includes `walletAddress`. That deterministic address is available before deployment. ## Next steps [Section titled “Next steps”](#next-steps) Creation is followed by the type-specific funding and activation flow: * [Vault Agent API integration](/developers/agents/vault/) for the current type. * [User guide: Choosing and creating an agent](/getting-started/) for the app flow. ## Validation and errors [Section titled “Validation and errors”](#validation-and-errors) Unsupported types fail with `AGENT_TYPE_NOT_SUPPORTED`; unsupported chain/asset pairs fail with `AGENT_ASSET_NOT_SUPPORTED`. The signed-in wallet must own the requested `userId`. Correct input or authentication errors before retrying.
# API Quickstart
> Make the first YieldSeeker API calls.
This flow resolves or creates a wallet account, creates an agent, and reads its state. Use the [interactive API reference](/api-v1) for the complete schemas and current operation details. ## 1. Authenticate the wallet [Section titled “1. Authenticate the wallet”](#1-authenticate-the-wallet) Create a SIWE message, have the user’s wallet sign it, and encode the message/signature pair as the token described in [API authentication](/developers/api/authentication/). ## 2. Resolve or create the user [Section titled “2. Resolve or create the user”](#2-resolve-or-create-the-user) Call `loginWithWallet` first. Send the wallet address in the JSON body and the signed token in `Authorization`. If the wallet has an account, the response contains `user.userId`. If the API returns `NO_USER`, create the account with the same wallet address and signed token:
```http
POST /v1/users/login-with-wallet
Content-Type: application/json
Authorization: Signature
{"walletAddress":"0x..."}
```
```http
POST /v1/users
Content-Type: application/json
{"walletAddress":"0x...","username":"...","signatureString":""}
```
`createUser` verifies `signatureString` from the request body; it does not use the `Authorization` header. A valid integrator `X-Api-Key` may be included to attribute the new account. `referralCode` is optional. ## 3. Create an agent [Section titled “3. Create an agent”](#3-create-an-agent)
```http
POST /v1/users/{userId}/agents
Content-Type: application/json
Authorization: Signature
```
The signed-in wallet must own the `userId`. Provide the required `name` and `emoji`; chain, base asset, type, and rule-preset fields and defaults are listed in [Creating an agent via API](/developers/api/creating-an-agent/). ## 4. Fund and activate it [Section titled “4. Fund and activate it”](#4-fund-and-activate-it) Funding and deployment are separate from agent creation. For the current Vault Agent, follow [Vault Agent API integration](/developers/agents/vault/) for the type-specific flow. ## 5. Read state [Section titled “5. Read state”](#5-read-state) Use the type’s balance, position, activity, and statistics operations to verify the agent’s state after each lifecycle step. ## Safe client behavior [Section titled “Safe client behavior”](#safe-client-behavior) * Validate the response before moving to the next step. * Preserve transaction hashes and request IDs for support. * Do not blindly retry mutations. * Treat unsupported type/asset combinations as configuration errors. * Keep signature tokens and API keys out of logs.
# Rate limits
> Current API rate limit tiers and how to handle a 429 response.
Rate limits are declared per route and count calls within configured time windows. Public-read and public-account tiers are keyed by IP. Standard signed user operations are keyed by the authenticated user; API-key requests to integrator analytics use the integrator as the key. The public-account tier remains IP-keyed for wallet login and account creation, including `loginWithWallet`, which also requires SIWE. A request over the limit receives a `429` response with a `Retry-After` header giving the number of seconds to wait before retrying. Treat that header as authoritative — read it and back off accordingly rather than hard-coding a client-side assumption about the limit. ## Current tiers [Section titled “Current tiers”](#current-tiers) The table summarizes current route metadata. Check each operation in the [generated API reference](/api-v1) for its configured tier; some routes have no explicit limit. | Tier | Typical limit | Used for | | ---------------- | -------------------------- | ------------------------------------------------------------------------------ | | Public read | 30/minute, 300/hour | Public lookups (health, supported assets, onchain status, vault opportunities) | | Public account | 5/minute, 20/hour, 100/day | Wallet login and account creation (IP-keyed) | | Standard read | 30/minute, 300/hour | Authenticated reads (agent snapshots, positions, activity, memories) | | Standard write | 15/minute, 120/hour | Authenticated writes (creating/updating an agent, saving a memory) | | Expensive mutate | 5/minute, 30/hour | Expensive mutations, including deposit and withdrawal operations | | Chat | 6/minute, 20/5 minutes | Sending a message to an agent conversation | | Simulate | 3/minute, 10/hour | Preview-only allocation simulations | | OAuth | 5/minute, 20/hour | OAuth login requests (Twitter, Discord, Telegram) | `GET /v1/platform-stats` currently has no explicit route limit; the platform stats detail and activity-feed routes do. ## Handling a 429 [Section titled “Handling a 429”](#handling-a-429) 1. Read the `Retry-After` header on the response. 2. Wait at least that many seconds before retrying the same operation. 3. Avoid tight retry loops. Retry only after the indicated delay, and honor any later `Retry-After` values. ## Next steps [Section titled “Next steps”](#next-steps) * [API authentication](/developers/api/authentication/) * [Generated API reference](/api-v1)
# Platform architecture
> How YieldSeeker's platform components fit together.
This page is the contract-level and API-level companion to [Architecture](/introduction/architecture/), which explains the same layers in plain language. YieldSeeker separates the user, agent runtime, wallet, execution controls, and supported protocols. Agent type determines the runtime goal; the wallet and safety boundary are shared.
```
flowchart LR
User[User wallet] --> Account[YieldSeeker account]
Account --> Agent[Agent type runtime]
Agent --> Wallet[Isolated Agent Wallet]
Wallet --> Registry[Adapter Registry]
Registry --> Adapter[Approved adapter]
Adapter --> Protocol[Supported protocol]
Monitoring[Offchain monitoring] -. breach wakes .-> Agent
```
## User and account [Section titled “User and account”](#user-and-account) A user’s connected wallet owns the account relationship and authorizes user-scoped actions. An account can contain multiple agents where product limits allow it. ## Agent runtime [Section titled “Agent runtime”](#agent-runtime) The runtime is type-specific. The current Vault Agent uses Autoseek to evaluate approved vault opportunities; future types can pursue different goals without changing the shared wallet boundary. Agent intelligence may interpret user preferences or explain decisions, while the type-specific strategy determines what those preferences mean. ## Monitoring [Section titled “Monitoring”](#monitoring) Monitoring continuously evaluates active rule boundaries against current vault data. A triggered breach can bypass the normal run-frequency limit and make the agent eligible for its next run. Monitoring wakes the runtime; it does not choose an allocation or execute a transaction. ## Agent Wallet [Section titled “Agent Wallet”](#agent-wallet) Each agent has an isolated smart wallet that holds its assets and submits validated operations. Read [AgentWalletKit integration](/developers/security/agent-wallet-kit/) for the contract-level model. ## Execution infrastructure [Section titled “Execution infrastructure”](#execution-infrastructure) The wallet does not call arbitrary targets directly. The Adapter Registry maps approved targets to adapters, and adapters validate protocol-specific parameters before interacting with a target. ## Source boundaries [Section titled “Source boundaries”](#source-boundaries) * API routes expose account, agent, and type-specific operations. * Smart contracts enforce wallet ownership and execution constraints. * Offchain runtimes evaluate data and propose actions. * Supported protocols remain independent contracts with their own risks. ## Related guides [Section titled “Related guides”](#related-guides) * [Execution framework](/developers/protocol/execution/) * [Governance and timelocks](/developers/protocol/governance/) * [Security](/security/)
# Execution framework
> How agent actions are constrained before reaching DeFi protocols.
The execution framework turns a type-specific strategy decision into a constrained blockchain operation. It is shared by current and future agent types. ## Execution flow [Section titled “Execution flow”](#execution-flow)
```
flowchart LR
Decision[Strategy decision] --> Wallet[Agent Wallet]
Wallet --> Registry[Adapter Registry]
Registry --> Adapter[Registered adapter]
Adapter --> Target[Registered target]
```
1. The runtime prepares an ERC-4337 UserOperation. An owner signature can authorize supported wallet actions; an agent-operator signature is accepted only for `executeViaAdapter` or `executeViaAdapterBatch`. 2. The wallet rejects the unrestricted `execute` and `executeBatch` entry points, applies its owner-controlled adapter and target blocklists, and checks the requested adapter against the target’s registry mapping. 3. The wallet delegatecalls the approved adapter. That adapter validates its supported operation and parameters before calling the protocol target. ## Adapter-only execution [Section titled “Adapter-only execution”](#adapter-only-execution) Each adapter accepts defined operations and validates their protocol-specific parameters. The wallet’s ordinary `execute` and `executeBatch` methods revert, so agent operations cannot use an unrestricted arbitrary-call path. ## Registry controls [Section titled “Registry controls”](#registry-controls) The Adapter Registry’s admin role registers adapters and maps targets; its emergency role can remove a target, unregister an adapter, or pause the `getTargetAdapter` lookup. Pausing that lookup blocks adapter-backed calls through the registry; removing a target or unregistering an adapter blocks calls through the affected mapping or mappings. Neither action blocks direct owner-only withdrawals of ETH or withdrawable base asset, and neither can reverse a settled transaction. Owners can also block adapters or targets for their own wallet. A registered target is approved for a particular adapter, not a guarantee that the underlying protocol is safe or liquid. ## Adapter context [Section titled “Adapter context”](#adapter-context) Adapters run by `delegatecall`, so their code executes in the Agent Wallet’s context and makes protocol calls from that wallet. The adapter supplies protocol-specific validation and call encoding. ## Agent-type boundary [Section titled “Agent-type boundary”](#agent-type-boundary) The framework is shared, but the operations and risk checks are type-specific. Vault Agent adapters support vault, lending, reward, and swap operations; a future type must document its own adapters and validation rules. See [Security](/security/) for the user explanation and [AgentWalletKit integration](/developers/security/agent-wallet-kit/) for implementation details.
# Governance, registries, pauses, and timelocks
> How platform capabilities are approved and disabled.
YieldSeeker’s governance controls determine which wallet implementations, adapters, and protocol targets can be used by agents. ## Registry administration [Section titled “Registry administration”](#registry-administration) The deployment assigns `DEFAULT_ADMIN_ROLE` on the Adapter Registry and Wallet Factory to the `AdminTimelock`. The registry admin registers adapters and maps targets; the Factory admin updates wallet implementation, registry, and fee-tracker settings. A separate registry `EMERGENCY_ROLE` can remove a target mapping, unregister an adapter (disabling its mappings until re-registered), or pause the `getTargetAdapter` lookup. The default admin can unpause. Registry approval allows an interaction to be attempted. It does not guarantee protocol solvency, liquidity, or performance. ## Wallet Factory [Section titled “Wallet Factory”](#wallet-factory) The Factory creates deterministic Agent Wallet proxies and stores the approved implementation, Adapter Registry, and fee tracker. The `AGENT_OPERATOR_ROLE` authorizes wallet creation. Wallets cache registry and operator settings at initialization or when synchronized. Factory implementation changes do not automatically upgrade existing wallets; the owner must call `upgradeToLatest` to install the currently approved implementation. ## Timelocked changes [Section titled “Timelocked changes”](#timelocked-changes) The production deployment script sets the AdminTimelock’s initial minimum delay to four days (testing mode uses zero). Its configuration batch schedules adapter registration and Factory updates through the timelock. The vault-registration script reads the current `getMinDelay()` and schedules the target-to-adapter mapping there; under the production four-day setting, registration waits four days before execution. Governance can change the live delay, so read `AdminTimelock.getMinDelay()` on the deployed contract before relying on a duration. A scheduled operation is visible onchain during the delay, giving users time to inspect it and decide whether to continue participating or exit, subject to the liquidity and withdrawal rules of their positions. ## Deployed contracts [Section titled “Deployed contracts”](#deployed-contracts) Current addresses for the Adapter Registry, Wallet Factory, AdminTimelock, and each adapter are published in [`deployments.json`](https://github.com/tokenpage/yieldseeker-contracts/blob/main/deployments.json) in the contracts repository. This file is the source of truth; addresses are not reproduced here because they change across deployments and networks. ## Emergency response [Section titled “Emergency response”](#emergency-response) The emergency role can stop new adapter-backed operations by pausing registry lookups, removing a target mapping, or unregistering an adapter. These emergency actions bypass the timelock; unpausing requires `DEFAULT_ADMIN_ROLE`. Pausing or disabling a registry route does not create liquidity or reverse a settled transaction. It does not block direct owner-only withdrawals of ETH or withdrawable base asset, but a pause can block adapter-backed withdrawals of non-base positions. Underlying-protocol withdrawal conditions remain separate. ## Adding a new agent type [Section titled “Adding a new agent type”](#adding-a-new-agent-type) A new agent type should reuse the shared governance and execution boundary unless the platform changes. Its own adapters, targets, metrics, and risks must be reviewed before being enabled. See [Security](/security/) and the [AgentWalletKit integration guide](/developers/security/agent-wallet-kit/) for the broader threat model.
# AgentWalletKit integration and security
> Contract-level details behind YieldSeeker Agent Wallets.
This page is the technical companion to [Security](/security/). It explains how the reusable AgentWalletKit design constrains autonomous wallet operations. ## Wallet deployment [Section titled “Wallet deployment”](#wallet-deployment) The Factory deploys a deterministic proxy for an owner and agent index; its address can be calculated before deployment. Initialization sets the owner, base asset, Adapter Registry, cached agent operators, and fee tracker. See [AgentWalletFactory](https://github.com/tokenpage/yieldseeker-contracts/blob/main/src/AgentWalletFactory.sol) and [YieldSeeker AgentWalletV2](https://github.com/tokenpage/yieldseeker-contracts/blob/main/src/AgentWalletV2.sol). ## ERC-4337 authorization [Section titled “ERC-4337 authorization”](#erc-4337-authorization) The deployed AgentWalletV2 validates ERC-4337 v0.6 UserOperations. The owner can sign supported wallet operations; a cached agent-operator signature is accepted only for `executeViaAdapter` and `executeViaAdapterBatch`. Wallets cache the Factory’s operator list, registry address, and fee tracker. After a Factory-level change, the owner or a cached operator must call `syncFromFactory` on each wallet to update that cached configuration; pausing a wallet’s currently cached registry immediately blocks that wallet’s adapter-backed operations. ## Adapter-only execution [Section titled “Adapter-only execution”](#adapter-only-execution) The wallet uses `executeViaAdapter` or its batch form; its standard `execute` and `executeBatch` entry points revert. It checks per-wallet adapter and target blocklists, then requires the registry to map the requested target to the requested registered adapter. The wallet delegatecalls the adapter, which runs in the wallet’s context. Each adapter accepts specific selectors and validates its own protocol parameters before making an external call; adapter code is not a separate custody wallet. ## Registry and emergency controls [Section titled “Registry and emergency controls”](#registry-and-emergency-controls) The registry can remove one target mapping, unregister an adapter (its existing mappings stay stored and become active again if the adapter is re-registered), or pause the `getTargetAdapter` lookup. These controls affect wallets sharing that registry and can block future adapter-backed operations, but cannot guarantee protocol liquidity or undo a settled transaction. ## User controls [Section titled “User controls”](#user-controls) The owner can block adapters and targets, withdraw ETH, and withdraw the configured base asset subject to accrued fees. Supported non-base tokens and protocol positions must be handled through approved adapters. The owner alone can use the wallet’s approved upgrade path; platform administration has no server-only withdrawal path. ## Upgrade and timelock model [Section titled “Upgrade and timelock model”](#upgrade-and-timelock-model) Factory implementation and configuration changes are subject to the AdminTimelock, giving users time to review a change or exit where appropriate. Production deployment sets its initial minimum delay to four days, but governance can change that live value. Approving an implementation does not upgrade deployed wallets: the owner must call `upgradeToLatest`, which only accepts the Factory-approved implementation. Check the deployed `AdminTimelock.getMinDelay()` and contract addresses before relying on a specific delay or deployment. ## Threat model [Section titled “Threat model”](#threat-model) A compromised server may use a cached operator key to authorize adapter-call operations, but it cannot sign the wallet’s owner-only withdrawals or upgrades, and unrestricted `execute` and `executeBatch` revert. Its calls remain subject to the wallet’s per-wallet blocklists, registry mapping, and adapter implementation. This limits arbitrary-call authority; it does not eliminate risks from a flawed adapter, protocol, or execution infrastructure. This is a risk-reduction model, not a guarantee that adapters, registries, protocols, infrastructure, or future implementations are bug-free. ## Sources [Section titled “Sources”](#sources) * [AgentWalletKit documentation](https://agentwalletkit.tokenpage.xyz/) * [Contracts README](https://github.com/tokenpage/yieldseeker-contracts/blob/main/README.md) * [Adapter Registry](https://github.com/tokenpage/yieldseeker-contracts/blob/main/src/agentwalletkit/AWKAdapterRegistry.sol) * [Nethermind audits](https://github.com/tokenpage/yieldseeker-contracts/tree/main/audits)
# Integrator guides
> Manage your integrator's API keys and dashboard access, and pull revenue-share analytics for the users and agents referred through it.
This companion API lets integrators manage API keys and dashboard members, then read analytics for users and agents attributed to their integrator. Read the [Developer guides](/developers/) first if you haven’t already; they cover authentication and the User and Agent resource models this API builds on. ## Authentication [Section titled “Authentication”](#authentication) Read-only integrator details and analytics routes — `GET /integrators/v1/{integratorId}`, `GET /integrators/v1/{integratorId}/users`, `GET /integrators/v1/{integratorId}/revenue-summary`, and `GET /integrators/v1/{integratorId}/agents` — accept either a SIWE signature from an integrator member or master user, or an active `X-Api-Key` for that integrator. The key must match the path’s `integratorId` and pass its configured `Origin` allowlist, if one is set. Listing, creating, or deactivating API keys and listing dashboard members require a SIWE signature from an integrator member. Only the master can add or remove dashboard members. A new key’s secret is returned once at creation; later listings expose key metadata only. On the core API’s `createUser` endpoint, the wallet signature is still verified; a valid `X-Api-Key` attributes the new account to its integrator and takes precedence over a referral code in that request. On other signed-in core routes that support optional integrator context, the key does not replace the user’s signature and adds context only if the signed-in user was referred through that integrator; it does not re-attribute other users. Treat API keys as bearer secrets: keep them server-side and never embed them in browser code. An origin allowlist does not make a key safe to expose. ## Why integrate with YieldSeeker? [Section titled “Why integrate with YieldSeeker?”](#why-integrate-with-yieldseeker) Give your users an automated way to seek yield across supported DeFi vaults while retaining control of their wallets. YieldSeeker configures a revenue-share rate for each integrator and reports its share of eligible platform fees for users attributed to that integrator. The dashboard and API let you manage access and track referred users, agents, performance, and revenue-share analytics. To get started, email . We can help set up your integration, API access, and revenue-share terms. ## Referred users and revenue share [Section titled “Referred users and revenue share”](#referred-users-and-revenue-share) Attribution follows the user’s referrer: referred users are users whose `referrerUserId` is the integrator’s master user. A dashboard member gets access to integrator data but does not become a referred user. Revenue summaries report all-time counts, cumulative yield, platform-fee totals, and transaction totals, alongside current holdings, APY percentiles, and the configured `revenueShareBps`. `integratorFeeShareUsd` is calculated from collected and owed platform fees; estimated pending fees are reported separately and are not included in that share. These routes provide analytics, not a revenue-share payout. Each agent in `GET /integrators/v1/{integratorId}/agents` also carries the same APYs the agent’s owner sees on its snapshot: `apy1d`, `apy7d`, `apy30d`, `apy90d`, `apyAllTime`, `apyStartDate`, and `hasEnoughHistory`. Show the APYs only once `hasEnoughHistory` is true; before that they cover too few days to be meaningful. Agents that aren’t yield products (for example Borrow Agents) report 0 and `hasEnoughHistory` false. `deactivatedDate` is set once an agent is deactivated, by its user or because it stayed empty; [reactivate it](/developers/agents/vault/#reactivate-an-agent) to keep its vault selection and other memories instead of creating a new agent. ## Vault selection [Section titled “Vault selection”](#vault-selection) To limit an agent to the vaults a user picked, save one managed memory with `POST /v1/users/{userId}/agents/{agentId}/memories` and `managedRuleType: "ignored_vault"`, listing the vault addresses in the content (for example `Only allocate to these vaults and never to any other vault: 0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB (Aave Base USDC)`). This is a core API route, so it needs the user’s SIWE signature; `X-Api-Key` does not replace it. * **No language model:** the vault addresses are read from the content directly. * **Only our vaults count:** addresses YieldSeeker doesn’t list for the agent’s chain and asset (another chain, another asset, another provider’s pools) are ignored. Listed vaults autoseek can’t deposit into are skipped when it runs. * **Nothing left means no vault:** for example when the user picked only pools YieldSeeker doesn’t offer, the agent exits every vault and keeps its funds idle. Withdrawing to the user is usually better than leaving funds idle. * **Changing it:** call the endpoint again to replace the list; deactivate or delete the memory to remove the restriction. The user’s chat agent can’t change it. * **Picking vaults:** build the picker from [`vault-options`](/developers/agents/vault/#list-vaults), which only returns vaults a new agent can use. ## API [Section titled “API”](#api) * [Generated Integrator API reference](/integrator-api-v1) The reference lists the exact routes and schemas generated from the API’s request and response models. This page describes authentication, attribution and vault selection behavior.