Skip to content

API Reference

This is the complete endpoint map for the zkde.fi backend. Every route listed here is live and exercised by the backend showcase. The API is the programmatic surface of the proof pipeline — it exposes read endpoints, preparation/build routes, proof-generation routes, and a smaller set of execution paths.

One thing to understand upfront: most mutation endpoints don't execute on-chain directly. They prepare — building calldata, generating proofs, composing execution context — and then the frontend (or your integration) takes that prepared data and submits it through a wallet signature. This is by design. The system separates preparation from execution so that the user always has final signing authority.

Base URLs

EnvironmentURL
Apphttps://zkde.fi
Core APIhttps://zkde.fi/api/v1
zkdefi namespacehttps://zkde.fi/api/v1/zkdefi/{resource}

Authentication

flowchart LR
  C["Your request"] --> R{What kind of endpoint?}
  R -->|"Public / read"| P["No header needed"]
  R -->|"User mutation"| W["X-Wallet-Address: 0x..."]
  R -->|"Admin operation"| A["X-Admin-Key: secret"]

Three auth tiers, applied per-endpoint:

  • Public: no header. All GET endpoints and some informational POST routes.
  • Wallet-protected: X-Wallet-Address header must match the target address. The server checks that the caller is operating on their own data.
  • Admin-only: X-Admin-Key header. Used for destructive operations (merkle reset, policy reset, fleet management).

Important: not every POST/PUT endpoint has wallet-header protection wired via dependency injection today. Auth enforcement is endpoint-specific — verify per-route below, and follow release notes for changes.


Health & metadata

The basics. If /health doesn't respond, nothing else will either.

MethodPathPurposeAuth
GET/healthService livenessPublic
GET/api/v1/phase4a/contractsContract address metadataPublic

Identity, reputation & compliance

This is the trust layer — reputation tiers, FICO-pack proofs, risk passports, compliance profiles, and linked-address management. If you're building anything that needs to know "how trusted is this wallet?", these are your endpoints.

For the full explanation of how reputation scoring works, see Reputation & Scoring. For the composed passport object, see Risk Passport.

MethodPathPurposeAuth
GET/api/v1/zkdefi/reputation/tiersTier definitions (thresholds and labels)Public
GET/api/v1/zkdefi/reputation/user/{address}User reputation snapshot — tier, score, historyPublic
GET/api/v1/zkdefi/reputation/proofs/{address}FICO-pack proof status (all 5 proofs)Public
POST/api/v1/zkdefi/reputation/upgrade-tierRequest a tier upgradeApp flow
POST/api/v1/zkdefi/reputation/proof/solvencyGenerate solvency proof ("I can pay what I owe")App flow
POST/api/v1/zkdefi/reputation/proof/risk-passportGenerate risk passport tier proofApp flow
POST/api/v1/zkdefi/reputation/proof/performanceGenerate trader performance proofApp flow
POST/api/v1/zkdefi/reputation/proof/strategy-integrityGenerate strategy integrity proofApp flow
POST/api/v1/zkdefi/reputation/proof/execution-integrityGenerate execution integrity proofApp flow
GET/api/v1/zkdefi/risk_passport/user/{address}User passport — composed trust objectPublic
GET/api/v1/zkdefi/risk_passport/pool/{pool_id}Pool passport — trust context for a target poolPublic
GET/api/v1/zkdefi/risk_profile/{address}Aggregated risk profile (superset of passport)Public
GET/api/v1/zkdefi/compliance/profiles/{user_address}Compliance profilesPublic
GET/api/v1/zkdefi/linked_addresses/{address}Linked-address map (Starknet ↔ Ethereum)Public
PUT/api/v1/zkdefi/linked_addressesUpdate linked addressesApp flow

The five POST .../proof/* endpoints each generate a zero-knowledge proof for one component of the FICO-pack. Each takes a request body with the user's address and returns a proof artifact. These are the endpoints that actually invoke the EZKL → Groth16 → Garaga pipeline.


Onboarding & agent registration

New users go through onboarding to bind their wallet and register with the agent system. This is a two-step flow: generate an authorization payload, then submit it. Once onboarding completes, the user's wallet is known to the system and can interact with protected routes.

MethodPathPurposeAuth
POST/api/v1/zkdefi/onboarding/generate_authorizationGenerate onboarding authorization payloadApp flow
POST/api/v1/zkdefi/onboarding/submit_agentSubmit onboarding/agent registrationApp flow
GET/api/v1/zkdefi/onboarding/status/{user_address}Check onboarding statusPublic

Orchestration (deploy & utilities)

The orchestration endpoints handle multi-step deployment flows — building the calldata, recording a receipt, then confirming the on-chain tx hash. The receipt pattern matters: you get a receipt ID before execution, then attach the tx hash after the wallet signs and submits.

MethodPathPurposeAuth
POST/api/v1/zkdefi/orchestration/deployBuild/record deploy orchestration flowApp flow
GET/api/v1/zkdefi/orchestration/receipt/{receipt_id}Read deploy receiptPublic
POST/api/v1/zkdefi/orchestration/receipt/confirmAttach tx hash to receipt (post-signing)App flow
POST/api/v1/zkdefi/orchestration/swap-strk-to-usdcBuild STRK→USDC swap calldataApp flow
POST/api/v1/zkdefi/orchestration/faucet/ethTestnet ETH faucetApp flow

Session keys & rebalancer

Session keys let you delegate bounded authority to the agent system — "execute within these constraints for the next N hours without asking me to sign each time." The rebalancer uses session keys for autonomous operation.

For the conceptual explanation of session keys, see Session Keys. For the rebalancing pipeline, see Rebalancing.

MethodPathPurposeAuth
POST/api/v1/zkdefi/session_keys/grantBuild session grant requestApp flow
POST/api/v1/zkdefi/session_keys/grant/confirmConfirm granted sessionApp flow
POST/api/v1/zkdefi/session_keys/revokeBuild session revoke requestApp flow
POST/api/v1/zkdefi/session_keys/revoke/confirmConfirm revocationApp flow
GET/api/v1/zkdefi/session_keys/list/{owner_address}List active sessionsPublic
POST/api/v1/zkdefi/rebalancer/proposeCreate rebalance proposalApp flow
POST/api/v1/zkdefi/rebalancer/checkRun risk/anomaly checks (strict — blocks on failure)App flow
POST/api/v1/zkdefi/rebalancer/advisory-checkNon-blocking policy check (advisory only)App flow
POST/api/v1/zkdefi/rebalancer/preparePrepare execution contextApp flow
POST/api/v1/zkdefi/rebalancer/executeExecute prepared rebalanceApp flow
POST/api/v1/zkdefi/rebalancer/autonomous/startStart autonomous modeX-Wallet-Address
POST/api/v1/zkdefi/rebalancer/autonomous/stopStop autonomous modeX-Wallet-Address
POST/api/v1/zkdefi/rebalancer/autonomous/pause/{user_address}Pause autonomous modeX-Wallet-Address
POST/api/v1/zkdefi/rebalancer/autonomous/resume/{user_address}Resume autonomous modeX-Wallet-Address
GET/api/v1/zkdefi/rebalancer/autonomous/allFleet status (all active autonomous agents)X-Admin-Key

The rebalancer pipeline is sequential: propose → check → prepare → execute. Skipping steps will fail. The autonomous endpoints wrap this pipeline in a loop with session-key-scoped authority.


Auth session (dual-wallet bind)

zkde.fi supports linking a Starknet wallet to an Ethereum wallet for cross-chain identity. The auth session endpoints manage this binding.

MethodPathPurposeAuth
POST/api/v1/zkdefi/auth/session/startStart dual-wallet auth sessionApp flow
POST/api/v1/zkdefi/auth/session/completeComplete dual-wallet auth sessionApp flow
GET/api/v1/zkdefi/auth/session/{starknet_address}Read active auth sessionPublic
DELETE/api/v1/zkdefi/auth/session/{starknet_address}Revoke active auth sessionApp flow

Trade, market & Ekubo

The trading surface. Market data is read-only. Ekubo operations (swap, LP, fee collection) produce prepared calldata that the frontend submits through wallet signing.

For the UI-level explanation, see Trade Desk and Deploy to Ekubo.

MethodPathPurposeAuth
GET/api/v1/zkdefi/market/surfaceMarket surface bundle (pools, rates, opportunities)Public
GET/api/v1/zkdefi/ekubo/capabilitiesEkubo capability metadataPublic
GET/api/v1/zkdefi/ekubo/positionsEkubo position viewApp flow
POST/api/v1/zkdefi/ekubo/swap/quoteSwap quoteApp flow
POST/api/v1/zkdefi/ekubo/swap/buildBuild swap calldataApp flow
POST/api/v1/zkdefi/ekubo/lp/add/buildBuild LP add calldataApp flow
POST/api/v1/zkdefi/ekubo/lp/remove/buildBuild LP remove calldataApp flow
POST/api/v1/zkdefi/ekubo/lp/collect-fees/buildBuild fee-collect calldataApp flow
POST/api/v1/zkdefi/ekubo/lp/recommendLP recommendation (suggested ranges, allocations)App flow

Adapter routes return prepared execution data that still depends on valid session state, proof readiness, and market conditions at submission time.


Reputation-based lending

Lending without traditional collateral ratios — instead, your reputation and FICO-pack attestations determine eligibility and terms. This is still evolving; integrators should verify artifact availability before assuming a fully automated borrow lifecycle.

MethodPathPurposeAuth
GET/api/v1/zkdefi/lending/poolLending pool statsPublic
GET/api/v1/zkdefi/lending/positions/{address}User lending positionsPublic
POST/api/v1/zkdefi/lending/supplyBuild supply calldataApp flow
POST/api/v1/zkdefi/lending/borrowBuild borrow calldata (attestation-oriented)App flow
POST/api/v1/zkdefi/lending/repayBuild repay calldataApp flow
POST/api/v1/zkdefi/lending/withdrawBuild withdraw calldataApp flow
GET/api/v1/zkdefi/lending/health/{address}Health factor contextPublic
POST/api/v1/zkdefi/lending/proof/credit-eligibilityCredit eligibility proof generationApp flow

zkML inference & circuit scan

A single endpoint that takes model/circuit inputs and returns zkML risk signals. This is the entry point for the 13-circuit bundle — the backend determines which circuits fire based on the input data.

MethodPathPurposeAuth
POST/api/v1/zkdefi/zkml/scanScan inputs, return zkML risk signalsApp flow

Privacy & state

The privacy endpoints implement the privacy pipeline — commitment generation, registration, withdrawal proof generation, and merkle state management. The unified deposit/withdraw endpoints are the recommended surface; the full_privacy/* routes expose the internal steps.

MethodPathPurposeAuth
POST/api/v1/zkdefi/full_privacy/deposit/generate_commitmentGenerate privacy commitmentApp flow
POST/api/v1/zkdefi/full_privacy/deposit/register_commitmentRegister commitment in merkle treeApp flow
POST/api/v1/zkdefi/full_privacy/withdraw/generate_proofGenerate withdrawal proofApp flow
GET/api/v1/zkdefi/full_privacy/merkle/rootCurrent merkle root statePublic
POST/api/v1/zkdefi/full_privacy/merkle/resetReset merkle tree (destructive)X-Admin-Key
POST/api/v1/zkdefi/privacy/depositUnified privacy depositApp flow
POST/api/v1/zkdefi/privacy/withdrawUnified privacy withdrawApp flow
GET/api/v1/zkdefi/wallet/state/{user_address}Wallet state snapshotPublic
POST/api/v1/zkdefi/execution/preflightPreflight execution checksApp flow
POST/api/v1/zkdefi/state/manual-wallet-eventManual wallet event injectionApp flow

Policy, relayer & ledger

Policy endpoints let you read and update vault constraints — what the agent is allowed to do. The relayer handles transaction submission for gas-abstracted flows. The ledger provides transfer history.

MethodPathPurposeAuth
GET/api/v1/zkdefi/policy/vault/{user_address}Read vault policyPublic
PUT/api/v1/zkdefi/policy/vault/{user_address}Update vault policyX-Wallet-Address
POST/api/v1/zkdefi/policy/compileCompile policy (validate constraints)App flow
POST/api/v1/zkdefi/policy/reset/{user_address}Reset policy stateX-Admin-Key
POST/api/v1/zkdefi/relayer/requestSubmit relay requestApp flow
GET/api/v1/zkdefi/relayer/pending/{address}Pending relay queuePublic
GET/api/v1/zkdefi/ledger/transfersLedger transfer historyPublic
POST/api/v1/zkdefi/ledger/demo-creditDemo credit path (testnet utility)App flow

Integrator APIs (outside /zkdefi)

These endpoints live outside the main zkdefi namespace. They serve cross-cutting concerns — identity proofs, agent management, strategy recommendations, and deployment execution.

MethodPathPurposeAuth
POST/api/v1/identity/credit-proofIdentity credit proof flowApp flow
GET/api/v1/identity/commitment/{commitment}Commitment lookupPublic
GET/api/v1/agents/models/listModel catalog (available zkML models)Public
POST/api/v1/agents/createCreate agent entryApp flow
GET/api/v1/strategies/price/liveLive price feedPublic
POST/api/v1/strategies/recommendStrategy recommendationApp flow
POST/api/v1/deployments/executeDeployment executionApp flow
POST/api/v1/vault/executeVault execution pathApp flow

Experimental scope

These endpoints are changing faster than the rest. They're live and functional, but their paths, request shapes, and response contracts may shift between releases.

GET  /api/v1/phase4a/status
GET  /api/v1/phase4a/orchestrated/dashboard
GET  /api/v1/phase4a/rebalancer/stats
GET  /api/v1/vault-live/positions/{user_address}
POST /api/v1/vault-live/rebalance
POST /api/v1/vault-live/execute
GET  /api/v1/zkdefi/sim/health
GET  /api/v1/zkdefi/sim/state
GET  /api/v1/zkdefi/sim/events
GET  /api/v1/zkdefi/sim/contracts

These docs describe technical capabilities and API behavior. They are not legal advice, investment advice, or a representation that any user automatically meets regulatory requirements.

Next: Developers · Architecture · Troubleshooting

Built by Obsqra Labs