HTTP API
Base URL: https://dayprotocol.com/api/v1
Auth: X-API-Key: <your-key>
OpenAPI: openapi.json
SDK: npm install github:dayprotocol/sdk
Related: API reference · Integration contract · Route catalog
Quick start
Section titled “Quick start”export BASE=https://dayprotocol.com/api/v1export KEY=$DAY_OWNER_API_KEYexport WALLET=0xYOUR_WALLET
# Statuscurl -sS "$BASE/day/status" | jq .
# Strategiescurl -sS "$BASE/day/strategies" | jq '.strategies[:3]'
# Deposit plan (prepare only — you sign)curl -sS -X POST "$BASE/day/strategies/deposit/plan" \ -H 'content-type: application/json' \ -d '{"strategyId":"suilend","amountMicros":"1000000"}' | jq .
# Positioncurl -sS -H "X-API-Key: $KEY" "$BASE/wallets/$WALLET/position" | jq .import { DayClient } from "@dayprotocol/sdk";
const day = new DayClient({ baseUrl: "https://dayprotocol.com", apiKey: process.env.DAY_OWNER_API_KEY,});
await day.readiness();await day.listStrategies();await day.prepareStrategyDeposit({ strategyId: "suilend", amountMicros: "1000000" });await day.getPosition(process.env.DAY_WALLET_ADDRESS!);Rules of the road
Section titled “Rules of the road”| Topic | Rule |
|---|---|
| Auth | X-API-Key only. Do not send X-Role — it is ignored. |
| Roles | Key maps to owner, agent, or keeper. |
| strategyId | Bare id: suilend, navi, kamino. Not suilend-sui-usdc. |
| Amounts | Integer micros strings ("1000000" = 1 USDC). No floats. |
| Fees | 0 on principal. All rates: Fees · live: GET /api/v1/day/fees. |
| Writes | Plans are prepare-only until the owner signs. ownerMustSign: true, submitted: false unless a real on-chain digest exists. |
| APY / yield | Live value or null — never invented. |
| Money paths | /api/v1/wallets/{address}/… |
| Public paths | /api/v1/day/… |
Execution modes
Section titled “Execution modes”From GET /api/v1/day/venues (and status):
| Mode | Meaning |
|---|---|
disabled | Plans still prepare; nothing is broadcast by the server |
owner_sign_prepare | Owner signs; server does not broadcast |
broadcast | Server may submit only when env allows and a real digest exists |
Phase-1 execution homes: Sui + Solana. Base / Arbitrum are discovery / prepare until write is live.
X-API-Key: <your-key>| Role | Can do |
|---|---|
| owner | Route, withdraw, policy, bridge rescue |
| agent | Read position / portfolio / preview (scoped to allowed wallets) |
| keeper | Harvest batch, ops health |
| public | Status, venues, strategies, deposit plans, balances |
| HTTP | Code | When |
|---|---|---|
| 401 | INVALID_API_KEY | Key unknown |
| 403 | UNAUTHORIZED | Missing key or wrong role |
| 403 | WALLET_SCOPE | Key not allowed for that wallet |
Core endpoints
Section titled “Core endpoints”Status & markets
Section titled “Status & markets”| Method | Path | Auth | What it does |
|---|---|---|---|
GET | /day/status | public | Phase, fees, execution flags |
GET | /day/venues | public | Venues + readiness + optional live APY (?live=1) |
GET | /day/strategies | public | Strategies (venues + DAY Autopilot) |
GET | /day/strategies/{id} | public | One strategy |
GET | /day/venues/apy | public | APY table (null if unavailable) |
GET | /day/discover | public | Market map (not execution truth) |
GET | /day/errors | public | Error catalog |
GET | /day/packages | public | On-chain package ids |
GET | /openapi.json | public | OpenAPI 3.1 |
Deposit & withdraw plans
Section titled “Deposit & withdraw plans”Deposit plan — POST /day/strategies/deposit/plan · public
{ "strategyId": "suilend", "amountMicros": "1000000", "owner": "0x…" }{ "status": "prepared", "submitted": false, "ownerMustSign": true, "feeMicros": "0", "strategyId": "suilend", "amountMicros": "1000000"}Withdraw plan — POST /day/strategies/withdraw/plan · public
Same id rules; principal fee 0.
Optional execute (owner-signed bytes only — never private keys):
POST /day/strategies/deposit/execute.
Wallet money
Section titled “Wallet money”| Method | Path | Auth | What it does |
|---|---|---|---|
GET | /wallets/{address}/position | owner | agent | Liquid / staked / by chain |
GET | /wallets/{address}/portfolio | owner | agent | Balances + venues |
GET | /wallets/{address}/performance | owner | agent | Realized yield / APY (null if unknown) |
POST | /wallets/{address}/preview | owner | agent | Dry-run route (no mutation) |
POST | /wallets/{address}/route | owner | Credit liquid (optional stake) |
POST | /wallets/{address}/harvest | permissionless | Claim yield; profit fee 1%/$10 (currently off) |
POST | /wallets/{address}/withdraw | owner | Exit principal (fee 0) |
POST | /wallets/{address}/auto-pay | owner | Residual yield → payees |
POST | /wallets/batch/positions | owner | agent | Up to 50 wallets |
Route example
{ "amountMicros": "1000000", "token": "USDC", "stake": false, "chain": "sui" }Harvest
| Situation | Result |
|---|---|
| Nothing staked | mode: "no_op_harvest", gross "0" |
| Yield unavailable | gross "0", reason set |
| Real yield | net + compound (profit fee 1%/$10 currently off) |
Bridge & swaps (prepare only)
Section titled “Bridge & swaps (prepare only)”| Method | Path | Notes |
|---|---|---|
POST | /day/bridge/plan | Cross-chain plan; owner signs |
POST | /day/bridge/rescue | Failed bridge → owner only destination |
POST | /day/bridge/delivery | Credit only after confirmed delivery |
POST | /day/jupiter/plan | Solana swap |
POST | /day/turbos/plan | Sui swap |
POST | /day/evm/swap/plan | Base / Arb (prepare until live) |
POST | /day/gas-sponsor/plan | Gas sizing |
Bridge plan needs source/dest chain, amount, and both addresses. Failed delivery never redirects away from the owner.
Autopilot
Section titled “Autopilot”| Method | Path | Auth |
|---|---|---|
GET | /wallets/{address}/autopilot | owner | agent |
GET | /wallets/{address}/autopilot/history | owner | agent |
POST | /wallets/{address}/autopilot/enable | owner |
POST | /wallets/{address}/autopilot/disable | owner |
POST | /wallets/{address}/autopilot/preview | owner | agent |
POST | /wallets/{address}/autopilot/tick | owner | agent |
POST | /wallets/{address}/autopilot/decide | owner | agent |
Autopilot is within-chain only. Cross-chain moves use an explicit bridge plan — never a silent rebalance.
Featured strategy: day-autopilot-top-30d-monthly — monthly re-rank to top 30d APY; switches only if the challenger is ≥7 percentage points better; fees: see Fees.
Full deposit walkthrough
Section titled “Full deposit walkthrough”BASE=https://dayprotocol.com/api/v1KEY=$DAY_OWNER_API_KEYWALLET=walkthrough-1
# 1. Pick a strategycurl -sS "$BASE/day/strategies" | jq '.strategies[] | select(.strategyId=="suilend")'
# 2. Preview (no chain submit)curl -sS -X POST -H "X-API-Key: $KEY" -H 'content-type: application/json' \ -d '{"amountMicros":"1000000","stake":false}' \ "$BASE/wallets/$WALLET/preview" | jq .
# 3. Route (credit liquid)curl -sS -X POST -H "X-API-Key: $KEY" -H 'content-type: application/json' \ -H "Idempotency-Key: oy_route_${WALLET}_1" \ -d '{"amountMicros":"1000000","token":"USDC","stake":false,"chain":"sui"}' \ "$BASE/wallets/$WALLET/route" | jq .
# 4. Positioncurl -sS -H "X-API-Key: $KEY" "$BASE/wallets/$WALLET/position" | jq '{liquidMicros,stakedMicros}'
# 5. Venue deposit plan (owner signs offline)curl -sS -X POST -H 'content-type: application/json' \ -d '{"strategyId":"suilend","amountMicros":"1000000"}' \ "$BASE/day/strategies/deposit/plan" | jq '{status,ownerMustSign,submitted,feeMicros}'
# 6. Harvest (no stake → no_op)curl -sS -X POST -H "X-API-Key: $KEY" -H 'content-type: application/json' \ -d '{"execute":true}' \ "$BASE/wallets/$WALLET/harvest" | jq '{mode,reason,grossYieldMicros,protocolFeeMicros}'
# 7. Withdraw principalcurl -sS -X POST -H "X-API-Key: $KEY" -H 'content-type: application/json' \ -d '{"amountMicros":"1000000"}' \ "$BASE/wallets/$WALLET/withdraw" | jq .Expect: route/withdraw fee 0. Harvest fee: see Fees.
| Action | Fee |
|---|---|
| Deposit / route / withdraw principal | 0 |
| Harvest realized yield (profit fee) | 1% (100 bps), cap $10 — currently off |
| Swap plan (Jupiter / Turbos / EVM) | DAY swap fee (see Fees) + pool fee (disclosed) |
| Bridge plan | DAY bridge fee (see Fees) + rail fee (disclosed) |
With the profit fee currently disabled, gross yield 20000 micros → net 20000. Rates and status: Fees.
Errors
Section titled “Errors”{ "code": "UNAUTHORIZED", "message": "owner required" }| Code | HTTP | Meaning |
|---|---|---|
UNAUTHORIZED | 403 | Missing or wrong role |
INVALID_API_KEY | 401 | Unknown key |
WALLET_SCOPE | 403 | Wallet not allowed for this key |
NOT_FOUND | 404 | Unknown strategy or route |
RATE_LIMITED | 429 | Slow down |
Many plan endpoints return HTTP 200 with status: "blocked" and blockers: [...] — always check the body, not only the status code.
| Method | HTTP |
|---|---|
readiness | GET /day/status |
listVenues / listStrategies | GET /day/venues · /day/strategies |
getStrategy | GET /day/strategies/{id} |
prepareStrategyDeposit / prepareStrategyWithdraw | POST …/plan |
getPosition | GET /wallets/{address}/position |
previewRoute / routeYield | POST preview · route |
harvest / withdraw / enableAutoPay | money posts |
bridgePlan / bridgeRescuePlan | bridge |
const day = new DayClient({ baseUrl: "https://dayprotocol.com", // origin only — SDK adds /api/v1 apiKey: process.env.DAY_OWNER_API_KEY,});Full route list
Section titled “Full route list”- Machine:
GET /api/v1/day/routes - OpenAPI:
GET /api/v1/openapi.json - Human tables: Route catalog · API reference