Documentation · API reference
Public Sepolia API
Use app.nelosia.com as the API origin. JSON action amounts use ordinary decimal input strings. Returned token amounts use base units.
| Method | Path | Purpose |
|---|---|---|
GET | /api/health | Workspace mode and network. |
GET | /api/sepolia/release | Client entry for the currently deployed release. |
POST | /api/sepolia/status | Verified balances and guard classes at one accepted block. |
POST | /api/sepolia/swap/quote | Available Ekubo and AVNU quotes for the selected pair and amount. |
POST | /api/sepolia/swap/prepare | Fresh simulation and an unsigned guarded review for an executable route. |
POST | /api/sepolia/swap/ready | Recheck the authenticated review before opening the wallet. |
POST | /api/sepolia/earn | Verified Endur and Ekubo holdings for the supplied account. |
POST | /api/sepolia/vesu | Verified lending market and account position. |
POST | /api/sepolia/vesu/prepare | Simulate an eligible action for the verified Vesu lending pair. |
POST | /api/sepolia/vesu/receipt | Verify the accepted Vesu transaction and position event. |
POST | /api/sepolia/ekubo/position | Verified position range for the NFT ID and canonical transaction. |
POST | /api/sepolia/ekubo/prepare | Simulate an eligible liquidity action for a verified STRK–ETH range. |
POST | /api/sepolia/ekubo/ready | Refresh the authenticated liquidity review before the wallet opens. |
POST | /api/sepolia/ekubo/receipt | Verify the accepted Ekubo transaction and position outcome. |
POST | /api/sepolia/bridge | StarkGate preparation, deposit delivery, and reverse claim status. |
POST | /api/sepolia/prepare | Simulate a guarded test STRK transfer. |
POST | /api/sepolia/receipt | Check an existing transfer hash against its authenticated review. |
curl -X POST https://app.nelosia.com/api/sepolia/status \
-H "Content-Type: application/json" \
--data '{}'The empty status request reads the public demo. Supply a Starknet Sepolia address to read that account. Your wallet makes all signature decisions.
Self-hosted Mainnet API reference
Terminal API
The terminal uses three distinct layers: current-state reads, authenticated action reviews and provider settlement observation. Examples are illustrative request shapes with public placeholders. They are not live quotes, usable tokens or instructions to send funds.
| POST endpoint | Purpose | Boundary |
|---|---|---|
/api/assets | Published trading registry | Current canonical underlying/LST allowlist. Contract classes and onchain decimals are verified before a route. |
/api/markets | Verified Vesu and Endur markets | Live registry and contract checks; unavailable entries remain explicit. |
/api/positions | Read owner-held positions and queued withdrawals | Requires a public Starknet address; no signing access. |
/api/action/prepare | Prepare a swap, position action or bridge-funding action | Returns schema-version-3 unsigned calls and an authenticated action review. |
/api/action/simulate | Simulate an authentic prepared action | Current-state reads, exact calls, fee-charged simulation and account checks. |
/api/action/ready | Revalidate immediately before the wallet request | Requires the latest ready token; changed fees or state can require renewed review. |
/api/action/receipt | Verify an existing transaction | Binds owner, nonce and exact calls to a canonical receipt; never resubmits. |
/api/bridge/networks | Read the verified provider catalogue | Catalogue availability is not a guaranteed executable route. |
/api/bridge/quote | Preview or request a signed deposit quote | Selected routes in either direction between Starknet STRK and listed EVM native USDC. |
/api/bridge/status | Observe the saved signed bridge quote | Provider status and independent destination verification stay distinct. |
Prepare a direct swap
{
"kind": "swap",
"address": "<owner Starknet address>",
"sellAsset": "ETH",
"buyAsset": "USDC",
"amount": "<ordinary decimal amount>",
"slippageBps": 50
}Send this shape to /api/action/prepare. Inputs use ordinary decimal strings in the selected asset’s precision; returned amounts use base units. The response binds the exact input, output constraints, calls and wallet handoff deadline. Preserve the returned reviewToken exactly.
POST /api/action/prepare → authenticated review
POST /api/action/simulate → latest ready review
POST /api/action/ready → unchanged calls or renewed review
owner wallet → personal confirmation
POST /api/action/receipt → verified existing transactionA review response requiring renewed consent is not permission to open the wallet. Replace the displayed review, clear prior consent and review again. Do not change or reconstruct authenticated calls on the client.
Market and position actions
| Field | Type | Meaning |
|---|---|---|
kind | string | position |
address | public address | The owner of the position and transaction. |
protocol | string | vesu-v2 or endur. |
marketId | string | A market ID returned by the verified market registry. |
action | string | Vesu: deposit, withdraw or redeem. Endur: deposit, redeem or claim. |
amount | decimal string | Underlying asset units for deposit/withdraw; share units for redeem. Not used for a claim. |
requestId | integer string | Required for an eligible Endur queued withdrawal claim. |
slippageBps | integer | Position preview tolerance from 0 to 100 basis points. |
Use kind: position with /api/action/prepare for an authenticated terminal review. The lower-level /api/position/prepare returns an adapter draft for inspection; it is not a substitute for simulation, signing readiness or an authenticated review.
Vesu deposits prepare an exact-share mint with bounded underlying spend. Vesu withdrawals/redemptions and Endur claims require the configured verified balance guard for protected outcomes. Endur redemption requests join the withdrawal queue; their receipt is not proof of an immediate underlying payout or a guaranteed future minimum.
Bridge previews, deposits and observation
{
"sourceNetwork": "starknet",
"destinationNetwork": "base",
"account": "<source Starknet owner>",
"recipient": "<destination EVM address>",
"amount": "<STRK decimal amount>",
"slippageBps": 50,
"preview": true
}A dry preview supplies no funding instructions. Use a fresh request identifier for a new preview: false attempt. The quote returns a provider-signed quote and server-authenticated bridge review. The source account is the refund destination. The selected recipient must belong to the destination network.
For supported source funding, prepare a terminal bridge action with kind: bridge, address and the authentic bridgeReviewToken, then follow the terminal simulation/review lifecycle. Keep both the bridge quote and terminal action record. Never fund a saved deposit a second time after a timeout or observation error.
Outbound source signing is STRK on Starknet to listed native-USDC destinations. Inbound EVM-native-USDC funding uses the separate authenticated EVM source-wallet flow below. A provider SUCCESS and independently verified destination receipts are reported separately; provider-reported refunds are not independently verified source refund receipts.
Collateral, debt and health
| POST endpoint | Purpose | Boundary |
|---|---|---|
/api/lending/pools | Verify supported Vesu v2 collateral/debt pairs | Canonical factory bindings, pinned pool/oracle classes and current pair configuration. |
/api/lending/positions | Read current loans for a public account | Native shares, nominal debt, accrued debt and protocol max-LTV health; unknown reads remain explicit. |
/api/lending/prepare | Inspect an unsigned lending draft | Not an authenticated signing review; use the terminal action lifecycle to execute. |
{
"kind": "position",
"protocol": "vesu-v2-lending",
"address": "<owner Starknet address>",
"marketId": "<verified lending pair ID>",
"action": "borrow",
"amount": "<ordinary decimal debt-asset amount>",
"minimumHealthFactorBps": 15000,
"slippageBps": 50
}Supported lending actions are add-collateral, withdraw-collateral, borrow, repay, repay-all and close. Amounts use the selected collateral or debt asset. Repay-all and close pin current native nominal debt and collateral shares; their underlying spend is capped and any allowance is reset.
The dedicated lending guard constrains the post-state collateral interval, maximum nominal/current debt and chosen health floor in the same atomic transaction. Health means protocol maximum LTV × collateral oracle value / debt oracle value. The separate liquidation factor is not used as a substitute threshold. Borrow and collateral removal default to a 1.50 floor and require at least 1.00. Risk-reducing add/repay may use zero so an unhealthy loan can still be improved.
The lending-state guard passed Scarb 2.21 and local Snforge integration checks with class pinning enabled. Signing requires a verified mainnet deployment.
Ekubo liquidity ranges
| POST endpoint | Purpose | Boundary |
|---|---|---|
/api/ekubo/pools | Discover supported pools or a registered pair | Bounded curated discovery plus same-block contract and token checks; not every extension or token. |
/api/ekubo/positions | Read owner-held liquidity ranges | Range identity includes NFT, full pool key and bounds. An NFT can contain several positions. |
/api/ekubo/prepare | Inspect an unsigned LP action | Use the authenticated terminal lifecycle for owner-approved execution. |
{
"kind": "position",
"protocol": "ekubo",
"address": "<owner Starknet address>",
"action": "create",
"poolId": "<verified pool ID>",
"token0": "<verified asset0 contract>",
"token1": "<verified asset1 contract>",
"lowerTick": "<aligned integer lower tick>",
"upperTick": "<aligned integer upper tick>",
"amount0": "<decimal asset0 budget>",
"amount1": "<decimal asset1 budget>",
"slippageBps": 50
}Use integer tick values returned by verified decimal-oriented range conversion. Display the actual outward-aligned range before consent. Human prices mean token1 per one token0, adjusted for both decimals; they are not USD prices.
Actions are create, add, remove, collect and close. Add/remove/collect/close use the returned opaque positionId. Removal uses integer amountBps from 1 to 10000. Deposits have exact asset budgets, native liquidity minima and unused-budget refunds. Removals have native per-asset minima. Fee collection and fee-bearing close require the balance guard for accepted net receipts.
Closing a range retains its NFT, which may hold other ranges or orders. Unsupported extensions, stableswap curves, rewards, order/DCA execution, leverage and automatic rebalancing remain outside this adapter. A wallet LST balance and its corresponding protocol exposure must not be counted twice.
EVM-source funding into Starknet
{
"sourceNetwork": "base",
"destinationNetwork": "starknet",
"account": "<source EVM owner and refund address>",
"recipient": "<Starknet recipient>",
"amount": "<ordinary decimal native-USDC amount>",
"slippageBps": 50,
"preview": false,
"requestId": "<fresh UUID>"
}| POST endpoint | Input | Behavior |
|---|---|---|
/api/bridge/evm/prepare | reviewToken + account | Verify the original signed provider quote, source USDC/gas, nonce and exact simulated native-USDC transfer. Return a preparedToken and immutable type-2 transaction. |
/api/bridge/evm/prepare | action: ready + preparedToken + account | Recheck the same transaction and original fee cap immediately before the owner wallet. Do not create another deposit or increase the accepted fee. |
/api/bridge/evm/receipt | preparedToken + hash | Observe exact source transaction identity and canonical finalized receipt. Read-only recovery remains available beyond signing expiry. |
The matching source EVM wallet signs and broadcasts the exact native-USDC transfer. No token approval or backend signer is used. Discovery does not request accounts; connect and network-switch are separate owner actions. Starknet STRK is the only inbound destination asset. EVM-to-EVM routes and full EVM DeFi execution are outside this flow.
A plain ERC20 transfer has no onchain expiry: the interface can stop initiating an expired review but cannot cancel a pending transaction or already open wallet request. Reject stale prompts. Preserve unknown outcomes and original deposits; do not automatically retry a transfer. Only explicit wallet rejection is a known decline. Imported EVM records are non-executable recovery data.
Source confirmation, provider status and destination verification are separate evidence stages. L2 acceptance is distinguished from L1 finality for Starknet delivery. Provider-reported refunds are not independently verified source refund receipts, and no refund deadline or complete recovery is promised.
Configuration and unavailable states
A 503 GUARD_NOT_CONFIGURED, LENDING_GUARD_NOT_CONFIGURED or guard-class mismatch blocks protected preparation. Compilation and arithmetic tests do not configure a verified deployment. Treat missing provider access, stale state and failed simulation as unavailable, never as permission to bypass a check.
Action observations can authenticate an existing record beyond its signing deadline. They do not refresh or renew signing authority. Token formats and schemas differ between terminal actions, bridge reviews and legacy funds goals; keep each token with its original record.
OPTIONAL FUNDS-GOAL API
Prepare a particular wallet balance
The endpoints below describe the original amount-based planner. They remain available alongside the terminal, with their own authenticated lifecycle. They are not the direct-swap or general position API.
Funds-goal request conventions
Send JSON to the same-origin Worker with Content-Type: application/json. Requests are bounded to 200 KB. Token and transaction amounts in responses are integer strings in base units; 300000000 native-USDC units means 300 USDC.
Examples below are representative selected fields, not live balances, usable review tokens or complete response fixtures. Replace the public sample address with the intended owner. Keep reviewToken exactly as returned.
curl http://127.0.0.1:4317/api/portfolio -H "Content-Type: application/json" --data '{"address":"0x0000000000000000000000000000000000000000000000000000000000000123","network":"mainnet"}'POST/api/portfolio
Read a scoped portfolio
Reads canonical balances at one recorded block and verifies supported Vesu v2 share positions. Unknown is explicit and is never counted as funding.
| Field | Type | Meaning |
|---|---|---|
address | string · required | Public Starknet owner address. Hexadecimal; nonzero and within the supported address bound. |
network | string · optional | mainnet. Other networks cannot execute in this release. |
{
"address": "0x0000000000000000000000000000000000000000000000000000000000000123",
"network": "mainnet"
}{
"schemaVersion": 2,
"owner": "0x0000000000000000000000000000000000000000000000000000000000000123",
"network": "mainnet",
"chainId": "0x534e5f4d41494e",
"block": 18000000,
"balances": [
{
"asset": {
"id": "USDC",
"symbol": "USDC",
"decimals": 6,
"address": "0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb"
},
"amount": "80000000",
"status": "available"
}
],
"positions": [],
"unknowns": []
}POST/api/plan
Prepare a funding goal
Builds canonical unsigned calls from freshly read sources. The response is authenticated by a server-only HMAC key. An address can be inspected without connecting a signing wallet.
| Field | Type | Meaning |
|---|---|---|
address | string · required | Owner whose wallet balance is the goal. |
targetAsset | string · optional | USDC (native, default), USDC.e, ETH or USDT. Exact STRK goals are disabled because fees consume STRK. |
amount | decimal string · required | Goal wallet balance in human token units. No scientific notation or excess asset precision. |
slippageBps | integer · optional | 10–100; default 50 basis points (0.50%). |
allowSwap | boolean · optional | Defaults true. False restricts funding to the target wallet balance and supported target-asset withdrawals. |
excluded | string[] · optional | Vault IDs or wallet-<asset ID> source IDs to retain; at most 30 entries. |
minimumHealthFactor | number · optional | Stored preference, clamped to 1.5–5. Borrowed collateral is excluded entirely; no debt-aware exit is enabled. |
{
"address": "0x0000000000000000000000000000000000000000000000000000000000000123",
"targetAsset": "USDC",
"amount": "300",
"slippageBps": 50,
"allowSwap": true,
"excluded": [
"wallet-ETH"
]
}{
"schemaVersion": 2,
"id": "00000000-0000-4000-8000-000000000001",
"status": "review",
"owner": "0x0000000000000000000000000000000000000000000000000000000000000123",
"amount": "300000000",
"sources": [
{
"kind": "wallet",
"label": "Available USDC",
"amount": "80000000"
},
{
"kind": "withdraw",
"label": "Prime · USDC",
"amount": "220000000"
}
],
"reviewToken": "nelo1.<authenticated-payload>.<signature>",
"shortfall": "0",
"simulation": null,
"fee": null
}POST/api/preview
Estimate and simulate exact calls
Accepts an authentic review token. Revalidates current sources and nonce, estimates nonzero resource bounds, checks the STRK fee budget, then simulates with fee charging. Account signature validation is skipped; nothing is signed or submitted.
| Field | Type | Meaning |
|---|---|---|
reviewToken | string · required | The unmodified authenticated token returned by /api/plan. It is not a wallet signature. |
{
"reviewToken": "nelo1.<authenticated-payload>.<signature>"
}{
"status": "ready",
"simulation": {
"status": "passed",
"block": 18000000,
"cairoVersion": "1",
"skipsSignatureValidation": true,
"traceType": "INVOKE"
},
"fee": {
"overall_fee": "3200000000000000000",
"maximum_fee": "3200000000000000000",
"review_limit": "3520000000000000000",
"planner_estimate_cap": "5000000000000000000",
"wallet_fee_independent": true,
"unit": "FRI"
},
"reviewToken": "nelo1.<authenticated-ready-payload>.<signature>"
}POST/api/ready
Recheck immediately before wallet review
Requires the authentic ready token from a successful simulation. Rechecks nonce, chain, source capacity, account implementation and STRK funding, then freshly estimates and fee-charge-simulates the exact unchanged calls. A verified AMM quotation block is context. The server checks quoted deadlines before handing the exact calls to the wallet. A fee increase beyond the authenticated review limit returns a new review without opening a wallet. The original wallet handoff deadline never extends.
| Field | Type | Meaning |
|---|---|---|
reviewToken | string · required | The latest ready token from /api/preview. Caller-supplied calls or a ready flag cannot replace the signed plan. |
{
"reviewToken": "nelo1.<authenticated-ready-payload>.<signature>"
}{
"requiresReview": false,
"id": "00000000-0000-4000-8000-000000000001",
"owner": "0x0000000000000000000000000000000000000000000000000000000000000123",
"chainId": "0x534e5f4d41494e",
"nonce": "0x4",
"calls": "<complete authenticated multicall including required guards>",
"fee": {
"maximum_fee": "3300000000000000000",
"review_limit": "3520000000000000000",
"wallet_fee_independent": true
},
"executionReview": {
"checkedBlock": 18000005,
"checkedAt": 1794787200000,
"callsHash": "<unchanged-canonical-call-digest>",
"hardExpiresAt": 1794787230000,
"walletFeeIndependent": true,
"quoteSourceBlocks": []
},
"reviewToken": "nelo1.<authenticated-ready-payload>.<signature>"
}A successful HTTP 200 can still require renewed review. When requiresReview is true, replace the displayed plan with the complete returned plan, clear consent and return before any wallet request. Review again using its new token. These selected fields omit unchanged goal and calls.
{
"requiresReview": true,
"code": "FEE_REVIEW_REQUIRED",
"plan": {
"status": "ready",
"fee": {
"maximum_fee": "3700000000000000000",
"review_limit": "4070000000000000000",
"planner_estimate_cap": "5000000000000000000"
},
"reviewToken": "nelo1.<newly-authenticated-ready-payload>.<signature>"
}
}POST/api/receipt
Verify the transaction and current outcome
Authenticates the ready plan and binds the actual transaction sender, nonce and complete Cairo multicall. It then reads finality and the current target balance. Browser-supplied owner, token or goal overrides do not change the signed plan. This endpoint never resubmits a transaction.
| Field | Type | Meaning |
|---|---|---|
reviewToken | string · required | Authentic ready token, available for observation for 90 days; it cannot renew signing authority. |
hash | string · required | Starknet transaction hash returned by the owner wallet. |
{
"reviewToken": "nelo1.<authenticated-ready-payload>.<signature>",
"hash": "0x0000000000000000000000000000000000000000000000000000000000000456"
}{
"status": "complete",
"planId": "00000000-0000-4000-8000-000000000001",
"hash": "0x456",
"balance": "300000000",
"target": {
"id": "USDC",
"symbol": "USDC",
"decimals": 6
},
"receipt": {
"execution_status": "SUCCEEDED",
"finality_status": "ACCEPTED_ON_L2",
"block_number": 18000001
},
"message": "The reviewed transaction confirmed and the target amount is available in your wallet."
}Status and error handling
| Status | Meaning | Recovery |
|---|---|---|
400 | Invalid input | Correct the address, asset, decimal precision, body or bounds. |
409 | State / review changed | Codes include QUOTE_EXPIRED, STATE_CHANGED, INVALID_REVIEW, SIMULATION_FAILED, INSUFFICIENT_GAS, TRANSACTION_MISMATCH and RECEIPT_NONCE_MISMATCH. Keep a saved attempt and check the wallet or explorer when a transaction hash already exists. |
429 | Busy | The Worker concurrency bound was reached. Retry later. |
502 | Provider failure | A bounded read, response or required provider is unavailable. No passing preview is inferred. |
503 | Runtime not configured | The deployment needs a valid server-only PREVIEW_SIGNING_KEY. |
{
"error": "Your account state changed. Refresh and review a new plan.",
"code": "STATE_CHANGED"
}Receipt states are pending, confirming, failed, partial and complete. Waiting is an observation state. It does not authorize a duplicate submission.
Execution and fee boundaries
The app can open a wallet prompt for at most 60 seconds from plan creation, shortened by any provider expiry. The API field hardExpiresAt reports this cutoff. If the prompt is still open after that time, decline it. Only calls with an explicit onchain deadline enforce one at inclusion. Verified AMM routes are identified from both quote metadata and immutable calldata; their source block is quotation context, while the same calls must pass a fresh estimate and fee-charged simulation before wallet review. Other routes require a hard provider expiry or remain unavailable. Rechecking never extends the original deadline. Authenticated observation can continue for 90 days. The planner fee review limit is at most 10% above the displayed maximum estimate and no more than 5 STRK; exceeding it requires renewed consent. The owner wallet independently selects the nonce and confirms its final fee. When it chooses a different nonce for the same calls, keep the original attempt and verify the transaction in the wallet or explorer.
The server has no blockchain signer, private key or broadcast endpoint. HMAC authenticates the review data. It does not sign a financial transaction.