API REFERENCE

Reads. Actions. Evidence.

Same-origin JSON. No server-side financial signer.

Offline example explorer

Inputs you can inspect.
Boundaries you can follow.

Full API contract
POST /api/sepolia/status
{
  "address": "<public Starknet Sepolia address>"
}
Selected response fieldsIllustrative
{
  "chainId": "0x534e5f5345504f4c4941",
  "block": "<verified block>",
  "account": "<public account>",
  "assets": [],
  "guards": []
}

Selected fields illustrate a block-scoped Sepolia portfolio response. No network request, wallet connection or signing action is made here.

StarknetAccount · calldata · receipt
PositionsVesu · Endur · Ekubo
RoutesAVNU · NEAR Intents
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.

Public Sepolia endpoints
MethodPathPurpose
GET/api/healthWorkspace mode and network.
GET/api/sepolia/releaseClient entry for the currently deployed release.
POST/api/sepolia/statusVerified balances and guard classes at one accepted block.
POST/api/sepolia/swap/quoteAvailable Ekubo and AVNU quotes for the selected pair and amount.
POST/api/sepolia/swap/prepareFresh simulation and an unsigned guarded review for an executable route.
POST/api/sepolia/swap/readyRecheck the authenticated review before opening the wallet.
POST/api/sepolia/earnVerified Endur and Ekubo holdings for the supplied account.
POST/api/sepolia/vesuVerified lending market and account position.
POST/api/sepolia/vesu/prepareSimulate an eligible action for the verified Vesu lending pair.
POST/api/sepolia/vesu/receiptVerify the accepted Vesu transaction and position event.
POST/api/sepolia/ekubo/positionVerified position range for the NFT ID and canonical transaction.
POST/api/sepolia/ekubo/prepareSimulate an eligible liquidity action for a verified STRK–ETH range.
POST/api/sepolia/ekubo/readyRefresh the authenticated liquidity review before the wallet opens.
POST/api/sepolia/ekubo/receiptVerify the accepted Ekubo transaction and position outcome.
POST/api/sepolia/bridgeStarkGate preparation, deposit delivery, and reverse claim status.
POST/api/sepolia/prepareSimulate a guarded test STRK transfer.
POST/api/sepolia/receiptCheck an existing transfer hash against its authenticated review.
Sepolia status request
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.

Terminal endpoints
POST endpointPurposeBoundary
/api/assetsPublished trading registryCurrent canonical underlying/LST allowlist. Contract classes and onchain decimals are verified before a route.
/api/marketsVerified Vesu and Endur marketsLive registry and contract checks; unavailable entries remain explicit.
/api/positionsRead owner-held positions and queued withdrawalsRequires a public Starknet address; no signing access.
/api/action/preparePrepare a swap, position action or bridge-funding actionReturns schema-version-3 unsigned calls and an authenticated action review.
/api/action/simulateSimulate an authentic prepared actionCurrent-state reads, exact calls, fee-charged simulation and account checks.
/api/action/readyRevalidate immediately before the wallet requestRequires the latest ready token; changed fees or state can require renewed review.
/api/action/receiptVerify an existing transactionBinds owner, nonce and exact calls to a canonical receipt; never resubmits.
/api/bridge/networksRead the verified provider catalogueCatalogue availability is not a guaranteed executable route.
/api/bridge/quotePreview or request a signed deposit quoteSelected routes in either direction between Starknet STRK and listed EVM native USDC.
/api/bridge/statusObserve the saved signed bridge quoteProvider status and independent destination verification stay distinct.

Prepare a direct swap

Terminal swap request shape
{
  "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.

Terminal review lifecycle
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 transaction

A 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

Position action fields
FieldTypeMeaning
kindstringposition
addresspublic addressThe owner of the position and transaction.
protocolstringvesu-v2 or endur.
marketIdstringA market ID returned by the verified market registry.
actionstringVesu: deposit, withdraw or redeem. Endur: deposit, redeem or claim.
amountdecimal stringUnderlying asset units for deposit/withdraw; share units for redeem. Not used for a claim.
requestIdinteger stringRequired for an eligible Endur queued withdrawal claim.
slippageBpsintegerPosition 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

Dry bridge preview shape
{
  "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

Vesu lending endpoints
POST endpointPurposeBoundary
/api/lending/poolsVerify supported Vesu v2 collateral/debt pairsCanonical factory bindings, pinned pool/oracle classes and current pair configuration.
/api/lending/positionsRead current loans for a public accountNative shares, nominal debt, accrued debt and protocol max-LTV health; unknown reads remain explicit.
/api/lending/prepareInspect an unsigned lending draftNot an authenticated signing review; use the terminal action lifecycle to execute.
Lending action request shape
{
  "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

Ekubo endpoints
POST endpointPurposeBoundary
/api/ekubo/poolsDiscover supported pools or a registered pairBounded curated discovery plus same-block contract and token checks; not every extension or token.
/api/ekubo/positionsRead owner-held liquidity rangesRange identity includes NFT, full pool key and bounds. An NFT can contain several positions.
/api/ekubo/prepareInspect an unsigned LP actionUse the authenticated terminal lifecycle for owner-approved execution.
LP range request shape
{
  "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

Inbound bridge quote shape
{
  "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>"
}
EVM bridge funding endpoints
POST endpointInputBehavior
/api/bridge/evm/preparereviewToken + accountVerify 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/prepareaction: ready + preparedToken + accountRecheck 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/receiptpreparedToken + hashObserve 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.

Local portfolio request
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.

/api/portfolio request fields
FieldTypeMeaning
addressstring · requiredPublic Starknet owner address. Hexadecimal; nonzero and within the supported address bound.
networkstring · optionalmainnet. Other networks cannot execute in this release.
Request JSON
{
  "address": "0x0000000000000000000000000000000000000000000000000000000000000123",
  "network": "mainnet"
}
Representative response fields
{
  "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.

/api/plan request fields
FieldTypeMeaning
addressstring · requiredOwner whose wallet balance is the goal.
targetAssetstring · optionalUSDC (native, default), USDC.e, ETH or USDT. Exact STRK goals are disabled because fees consume STRK.
amountdecimal string · requiredGoal wallet balance in human token units. No scientific notation or excess asset precision.
slippageBpsinteger · optional10–100; default 50 basis points (0.50%).
allowSwapboolean · optionalDefaults true. False restricts funding to the target wallet balance and supported target-asset withdrawals.
excludedstring[] · optionalVault IDs or wallet-<asset ID> source IDs to retain; at most 30 entries.
minimumHealthFactornumber · optionalStored preference, clamped to 1.5–5. Borrowed collateral is excluded entirely; no debt-aware exit is enabled.
Request JSON
{
  "address": "0x0000000000000000000000000000000000000000000000000000000000000123",
  "targetAsset": "USDC",
  "amount": "300",
  "slippageBps": 50,
  "allowSwap": true,
  "excluded": [
    "wallet-ETH"
  ]
}
Representative response fields
{
  "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.

/api/preview request fields
FieldTypeMeaning
reviewTokenstring · requiredThe unmodified authenticated token returned by /api/plan. It is not a wallet signature.
Request JSON
{
  "reviewToken": "nelo1.<authenticated-payload>.<signature>"
}
Representative response fields
{
  "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.

/api/ready request fields
FieldTypeMeaning
reviewTokenstring · requiredThe latest ready token from /api/preview. Caller-supplied calls or a ready flag cannot replace the signed plan.
Request JSON
{
  "reviewToken": "nelo1.<authenticated-ready-payload>.<signature>"
}
Representative response fields
{
  "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.

Fee increase requiring renewed consent
{
  "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.

/api/receipt request fields
FieldTypeMeaning
reviewTokenstring · requiredAuthentic ready token, available for observation for 90 days; it cannot renew signing authority.
hashstring · requiredStarknet transaction hash returned by the owner wallet.
Request JSON
{
  "reviewToken": "nelo1.<authenticated-ready-payload>.<signature>",
  "hash": "0x0000000000000000000000000000000000000000000000000000000000000456"
}
Representative response fields
{
  "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

HTTP status and recovery
StatusMeaningRecovery
400Invalid inputCorrect the address, asset, decimal precision, body or bounds.
409State / review changedCodes 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.
429BusyThe Worker concurrency bound was reached. Retry later.
502Provider failureA bounded read, response or required provider is unavailable. No passing preview is inferred.
503Runtime not configuredThe deployment needs a valid server-only PREVIEW_SIGNING_KEY.
Representative error JSON
{
  "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.