Open a leveraged position in ONE atomic transaction.
Supply collateral, borrow against it, swap the borrowed token back to
collateral, repeat — until total collateral reaches multiplier x
initial_collateral_amount. If any step fails the whole transaction reverts,
so a position is never left half-built.
See the Leveraged Looping guide
for chain coverage, market discovery, vault-share collateral, HyperEVM
specifics and the full error list.
POST
/
v2
/
credit
/
loop
Python (SDK)
from compass_api_sdk import CompassAPI, modelswith CompassAPI( api_key_auth="<YOUR_API_KEY_HERE>",) as compass_api: res = compass_api.credit.credit_loop(owner="0x5e5b00ed886A6879C2B934612D2312975427fcAf", chain=models.CreditLoopRequestChain.ETHEREUM, collateral_token="WETH", borrow_token="USDC", initial_collateral_amount=1.0, multiplier=2.0, loan_to_value=70.0, protocol=models.CreditProtocol.AAVE, sub_account_id=0, max_slippage_percent=0.5, gas_sponsorship=False, preview=False, pricing=models.CreditLoopRequestPricing.AUTO) # Handle response print(res)
Open a leveraged loop: repeatedly supply collateral, borrow, and swap the
borrow back to collateral — all in ONE atomic transaction from the Credit
Account.
Blockchain network. Not every protocol is deployed on every chain — see the protocol field — and a chain with no credit venue at all returns a 422 naming the chains that do.
Available options:
arbitrum,
base,
bsc,
ethereum,
hyperevm,
tempo
Example:
"ethereum"
collateral_token
string
default:WETH
required
Token supplied as collateral each iteration. Must already be in the Credit Account for the initial amount. For MORPHO it must be the market's collateral token.
Examples:
"wstETH"
"WETH"
borrow_token
string
default:USDC
required
Token borrowed each iteration and swapped back to the collateral token. For MORPHO it must be the market's loan token.
Examples:
"WETH"
"USDC"
initial_collateral_amount
numberstring
default:1
required
Collateral (in token units) that the Credit Account must ALREADY hold when this is called — the loop never pulls from the owner's wallet mid-transaction. Fund the account first via /v2/credit/transfer (action=DEPOSIT).
Required range: x > 0
Example:
1.5
multiplier
numberstring
default:2
required
Target leverage: total collateral exposure = multiplier × initial_collateral_amount. Must be achievable at the requested loan_to_value (max ≈ 0.9 / (1 − LTV)).
Required range: x > 1
Example:
2
loan_to_value
numberstring
default:70
required
Per-iteration borrow LTV in percent. Must not exceed the protocol's maximum for the market (Aave reserve/e-mode LTV; Morpho LLTV with a safety margin; Euler's borrow LTV for the collateral vault); borrows are sized slightly inside the requested value so no leg sits on the protocol's revert boundary.
Required range: 0 < x <= 100
Example:
70
protocol
enum<string>
default:AAVE
Lending protocol to loop into: AAVE, MORPHO, or EULER. On chain=hyperevm, AAVE is Hyperlend and MORPHO is Felix; EULER is not deployed there.
Available options:
AAVE,
EULER,
MORPHO
Example:
"AAVE"
market_id
string | null
Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO.
collateral_vault
string | null
Euler only: the EVK vault address collateral is supplied to (from /v2/credit/euler_markets). Required when protocol=EULER.
borrow_vault
string | null
Euler only: the EVK vault address borrowed from (the sub-account's controller). Required when protocol=EULER.
sub_account_id
integer
default:0
Euler only: the EVC sub-account (0-255) holding this isolated looped position. 0 is the Credit Account itself.
Required range: 0 <= x <= 255
max_slippage_percent
numberstring
default:0.5
Per-swap slippage tolerance in percent. Loop dust is bounded by this per iteration, so tighter slippage means less dust.
Required range: 0 < x <= 10
Example:
0.3
emode_category
integer | null
Aave only: e-mode category to enable before looping (higher LTV for correlated pairs, e.g. ETH-correlated). Both tokens must belong to the category or the build returns a 422. On Hyperlend (chain=hyperevm) category 1 is the HYPE-correlated set covering wstHYPE and WHYPE.
Required range: x >= 0
gas_sponsorship
boolean
default:false
If true, returns EIP-712 typed data for gas-sponsored execution instead of an unsigned transaction.
Example:
false
preview
boolean
default:false
If true, build a display ESTIMATE: no firm RFQ quote is ever requested (quote_expires_at stays null). NOTE that this guarantees only that no firm quote was spent — it does not guarantee an absent transaction: on a pair no firm provider covers, and under pricing=market, the call still falls through to the aggregator and returns a signable transaction. How the estimate is priced follows pricing: on a firm-covered pair under 'auto' or 'firm' it is computed from the firm provider's live price levels (indicative); otherwise swap legs are priced by the default aggregator. Set it on every call made while a user is exploring parameters, and leave it false only for the build they actually intend to sign — firm quotes are single-use maker commitments, and requesting them for displays that are never executed degrades the pricing this API is offered.
pricing
enum<string>
default:auto
Swap-leg routing policy. 'auto': firm quotes where a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route — previews whose target the firm venue cannot serve return the coverage advisory alone (preview=null, zero aggregator calls), and executions fail with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; every leg is priced by the aggregator and bounded by max_slippage_percent (which firm legs ignore). 'firm' is incompatible with gas_sponsorship (sponsored loops force market routing).
Available options:
auto,
firm,
market
Response
Successful Response
The atomic loop transaction plus its guaranteed-floor preview.
preview
CreditLoopPreview · object | null
required
Projected end state, computed on guaranteed swap floors. Null only on pricing='firm' preview responses whose target the firm venue cannot serve: no leg was priced on any venue, and the response carries the coverage advisory (max_firm_multiplier) alone.
Show child attributes
transaction
UnsignedTransaction · object | null
Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false — except firm-priced previews (preview=true on a firm-priced build), which carry numbers only: the firm quotes are fetched at execution time, so there is no payload to sign yet.
Maturity of the Pendle principal token supplied as collateral, ISO-8601 UTC. Present only for principal-token collateral, whose yield is fixed until this date; after it the position can be unwound (by redemption at par) but not increased.
swap_provider
enum<string>
default:market
Identifies which route priced the swap leg(s): 'market' — a DEX aggregator (iterative loop across pool liquidity, slippage-bounded floors) — or 'firm' — zero-slippage quotes, one per swap leg, each partially filled at the leg's size (exact fills, zero dust). On preview=true responses 'firm' means the numbers are INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quotes at signing time. Always present, including on fallbacks. This is the authoritative firm-vs-market signal and clients do need to read it: pricing is only what was REQUESTED (under 'auto' a firm build can fall back to market transparently), and quote_expires_at is absent on every preview — so neither substitutes for this field.
Available options:
market,
firm
quote_expires_at
string<date-time> | null
Deadline of the firm swap quotes (the earliest across the loop's swap legs) — sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Present only on executable firm-priced builds; null on previews (no quote is spent for a preview).
max_firm_multiplier
string | null
Multiplier bound firm zero-slippage quotes can fill for the requested position size, LTV and target (estimated without spending any quote). The requested multiplier is firm-servable iff it is <= this value; above it the loop executes at market rate with slippage-bounded floors instead. Present only on preview=true responses when a firm-quote venue covers the pair; null otherwise. Recompute per parameter change - minimum-size floors make reachability target-dependent.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Compass API Docs","colors":{"primary":"#0284c7","light":"#0e9fe9","dark":"#0284c7"},"logo":{"light":"https://mintcdn.com/compasslabs-f07467e0/x2NrFgZ7soJbH6sc/logo/light.svg?fit=max\u0026auto=format\u0026n=x2NrFgZ7soJbH6sc\u0026q=85\u0026s=80a04b06674000990914306c6a833cb9","dark":"https://mintcdn.com/compasslabs-f07467e0/x2NrFgZ7soJbH6sc/logo/dark.svg?fit=max\u0026auto=format\u0026n=x2NrFgZ7soJbH6sc\u0026q=85\u0026s=77e910ba12605c7f004ad72498f8076f"},"favicon":"https://mintcdn.com/compasslabs-f07467e0/x2NrFgZ7soJbH6sc/favicon.svg?fit=max\u0026auto=format\u0026n=x2NrFgZ7soJbH6sc\u0026q=85\u0026s=2025e9c84a2b6b167d319b28e1ecb8a0","appearance":{"default":"light","strict":true},"navbar":{"links":[{"href":"https://calendly.com/elisabeth-compasslabs/30min","label":"Book a demo"},{"href":"https://compasslabs.ai/login","label":"Login"}]},"footer":{"socials":{"x":"https://x.com/labs_compass","github":"https://github.com/CompassLabs","linkedin":"https://www.linkedin.com/company/compass-labs-ai","medium":"https://medium.com/@compasslabs","telegram":"https://discord.com/invite/ujetyJJPYr","discord":"https://discord.com/invite/ujetyJJPYr"},"links":[{"header":"Resources","items":[{"label":"Blog","href":"https://medium.com/@compasslabs"}]},{"header":"Legal","items":[{"label":"Terms \u0026 Conditions","href":"https://docs.compasslabs.ai/v1/support/terms-and-conditions"},{"label":"Privacy Policy","href":"https://docs.compasslabs.ai/v1/support/privacy-policy"}]}]},"styling":{"eyebrows":"section","codeblocks":"system","latex":false},"integrations":{"ga4":{"measurementId":"G-EQSZ3TK15C"},"gtm":{"tagId":"GTM-5NXMZG6D"}},"contextual":{"options":["chatgpt","claude"],"display":"header"},"navigation":{"global":{"tabs":[],"anchors":[]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"compasslabs-f07467e0","hasAudioNarration":false,"actualSubdomain":"compasslabs-f07467e0","customDomains":["docs.compasslabs.ai"],"gitSource":{"type":"github","owner":"compasslabs","repo":"mono","deployBranch":"production","contentDirectory":"api_docs","isPrivate":true,"mountPath":"","label":""},"feedback":{"issues":true,"edits":true,"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af5b5300b3858d5ef253beb","clientVersion":"0.0.4160","searchFilterCounts":[{"language":"default","tag":"API Reference","count":300},{"language":"default","tag":"Documentation","count":30},{"language":"default","tag":"Aave V3","count":15},{"language":"default","tag":"Credit","count":15},{"language":"default","tag":"Perpetual Trading","count":15},{"language":"default","tag":"Tokenized Assets","count":15},{"language":"default","tag":"Earn","count":13},{"language":"default","tag":"Morpho","count":12},{"language":"default","tag":"Uniswap V3","count":10},{"language":"default","tag":"Transaction Bundler","count":9}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[],"googleFontsInlined":false},"customCss":[{"filePath":"button.css","content":"@keyframes jump{0%,100%{transform:translateY(0)}50%{transform:translateY(-20px)}}.jump-loop{animation:jump 0.5s ease infinite}#code-group{background-color:#EFEFEF33;box-shadow:0 4px 12px rgba(0, 0, 0, 0.08)}#code-group:hover{box-shadow:0 6px 18px rgba(0, 0, 0, 0.1)}#content-area>div.flex.flex-col.gap-8>div.mt-6.flex.w-full.flex-col.space-y-4>div{background-color:#EFEFEF33}#content-area>div.flex.flex-col.gap-8>div.mt-6.flex.w-full.flex-col.space-y-4>div{box-shadow:0 4px 12px rgba(0, 0, 0, 0.08)}#content-area>div.flex.flex-col.gap-8>div.mt-6.flex.w-full.flex-col.space-y-4>div:hover{box-shadow:0 6px 18px rgba(0, 0, 0, 0.1)}"}],"page":{"pagePath":"v2/api-reference/credit/open-a-leveraged-loop","slug":"/v2/api-reference/credit/open-a-leveraged-loop","pageMetadata":{"title":"Open a leveraged loop","description":"Open a leveraged position in ONE atomic transaction.\n\nSupply collateral, borrow against it, swap the borrowed token back to\ncollateral, repeat — until total collateral reaches multiplier x\ninitial_collateral_amount. If any step fails the whole transaction reverts,\nso a position is never left half-built.\n\nSee the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)\nfor chain coverage, market discovery, vault-share collateral, HyperEVM\nspecifics and the full error list.","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/credit/loop","href":"/v2/api-reference/credit/open-a-leveraged-loop","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n a: \"a\",\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_Fragment, {\n children: [_jsx(_components.p, {\n children: \"Open a leveraged position in ONE atomic transaction.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Supply collateral, borrow against it, swap the borrowed token back to\\ncollateral, repeat — until total collateral reaches multiplier x\\ninitial_collateral_amount. If any step fails the whole transaction reverts,\\nso a position is never left half-built.\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"See the \", _jsx(_components.a, {\n href: \"https://docs.compasslabs.ai/v2/Products/Looping\",\n children: \"Leveraged Looping guide\"\n }), \"\\nfor chain coverage, market discovery, vault-share collateral, HyperEVM\\nspecifics and the full error list.\"]\n })]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"codeStyling":"system","config":{},"pageMetadata":{"title":"Open a leveraged loop","description":"Open a leveraged position in ONE atomic transaction.\n\nSupply collateral, borrow against it, swap the borrowed token back to\ncollateral, repeat — until total collateral reaches multiplier x\ninitial_collateral_amount. If any step fails the whole transaction reverts,\nso a position is never left half-built.\n\nSee the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)\nfor chain coverage, market discovery, vault-share collateral, HyperEVM\nspecifics and the full error list.","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/credit/loop","href":"/v2/api-reference/credit/open-a-leveraged-loop","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":["/_mintlify/custom/compasslabs-f07467e0/27fd886bf35b6ed0/redeploy-trigger.js","/_mintlify/custom/compasslabs-f07467e0/5b350f94165e79a1/scripts/auth-btns.js","/_mintlify/custom/compasslabs-f07467e0/0c2ee6a003a69104/scripts/home-btn-link.js","/_mintlify/custom/compasslabs-f07467e0/17a3e2d25ff9b880/scripts/magic.js","/_mintlify/custom/compasslabs-f07467e0/2592024b81e4044f/scripts/modal.js","/_mintlify/custom/compasslabs-f07467e0/60b3db97b96f7d26/scripts/language-icon-fixer.js","/_mintlify/custom/compasslabs-f07467e0/60408501351ea2bb/scripts/disable-bundler-playground.js"],"openApiReferenceData":{"operation":{"tags":["Credit"],"summary":"Open a leveraged loop","description":"Open a leveraged position in ONE atomic transaction.\n\nSupply collateral, borrow against it, swap the borrowed token back to\ncollateral, repeat — until total collateral reaches multiplier x\ninitial_collateral_amount. If any step fails the whole transaction reverts,\nso a position is never left half-built.\n\nSee the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)\nfor chain coverage, market discovery, vault-share collateral, HyperEVM\nspecifics and the full error list.","operationId":"v2_credit_loop","requestBody":"1076413b-ecc2-4c14-8147-359f688f0fb9","responses":{"200":"8611f065-64cc-4032-874a-9c610da1a053","422":"b96da7b4-1774-4afb-9818-6055e9a2957f"},"x-speakeasy-name-override":"credit_loop","x-codeSamples":[{"lang":"python","label":"Python (SDK)","source":"from compass_api_sdk import CompassAPI, models\n\n\nwith CompassAPI(\n api_key_auth=\"\u003cYOUR_API_KEY_HERE>\",\n) as compass_api:\n\n res = compass_api.credit.credit_loop(owner=\"0x5e5b00ed886A6879C2B934612D2312975427fcAf\", chain=models.CreditLoopRequestChain.ETHEREUM, collateral_token=\"WETH\", borrow_token=\"USDC\", initial_collateral_amount=1.0, multiplier=2.0, loan_to_value=70.0, protocol=models.CreditProtocol.AAVE, sub_account_id=0, max_slippage_percent=0.5, gas_sponsorship=False, preview=False, pricing=models.CreditLoopRequestPricing.AUTO)\n\n # Handle response\n print(res)"},{"lang":"typescript","label":"Typescript (SDK)","source":"import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"\u003cYOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.credit.creditLoop({\n owner: \"0x5e5b00ed886A6879C2B934612D2312975427fcAf\",\n chain: \"ethereum\",\n protocol: \"AAVE\",\n collateralToken: \"WETH\",\n borrowToken: \"USDC\",\n initialCollateralAmount: 1,\n multiplier: 2,\n loanToValue: 70,\n maxSlippagePercent: 0.5,\n gasSponsorship: false,\n });\n\n console.log(result);\n}\n\nrun();"}],"method":"post","type":"path","servers":["5cc70962-0013-441d-bd6f-5cb484ceb892"],"security":["e89f6d8c-9ae7-44f6-91ab-c06b98b98bae"],"path":"/v2/credit/loop","baseUrlOptions":["https://api.compasslabs.ai"],"title":"Open a leveraged loop","codeSamples":[{"label":"Python (SDK)","lang":"python","source":"from compass_api_sdk import CompassAPI, models\n\n\nwith CompassAPI(\n api_key_auth=\"\u003cYOUR_API_KEY_HERE>\",\n) as compass_api:\n\n res = compass_api.credit.credit_loop(owner=\"0x5e5b00ed886A6879C2B934612D2312975427fcAf\", chain=models.CreditLoopRequestChain.ETHEREUM, collateral_token=\"WETH\", borrow_token=\"USDC\", initial_collateral_amount=1.0, multiplier=2.0, loan_to_value=70.0, protocol=models.CreditProtocol.AAVE, sub_account_id=0, max_slippage_percent=0.5, gas_sponsorship=False, preview=False, pricing=models.CreditLoopRequestPricing.AUTO)\n\n # Handle response\n print(res)"},{"label":"Typescript (SDK)","lang":"typescript","source":"import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"\u003cYOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.credit.creditLoop({\n owner: \"0x5e5b00ed886A6879C2B934612D2312975427fcAf\",\n chain: \"ethereum\",\n protocol: \"AAVE\",\n collateralToken: \"WETH\",\n borrowToken: \"USDC\",\n initialCollateralAmount: 1,\n multiplier: 2,\n loanToValue: 70,\n maxSlippagePercent: 0.5,\n gasSponsorship: false,\n });\n\n console.log(result);\n}\n\nrun();"}],"requiredOnlyExamples":false,"requestExampleType":"codeSamples","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"content":{"application/json":{"schema":{"properties":{"owner":{"type":"string","title":"Owner","description":"The address that owns the Credit Account.","default":"0x5e5b00ed886A6879C2B934612D2312975427fcAf","examples":["0x5e5b00ed886A6879C2B934612D2312975427fcAf"],"isRequired":true,"uniqueKey":"owner","typeLabel":"string"},"chain":{"type":"string","enum":["arbitrum","base","bsc","ethereum","hyperevm","tempo"],"title":"Chain","description":"Blockchain network. Not every protocol is deployed on every chain — see the protocol field — and a chain with no credit venue at all returns a 422 naming the chains that do.","default":"ethereum","examples":["ethereum"],"isRequired":true,"uniqueKey":"chain","typeLabel":"enum\u003cstring>"},"collateral_token":{"type":"string","title":"Token","description":"Token supplied as collateral each iteration. Must already be in the Credit Account for the initial amount. For MORPHO it must be the market's collateral token.","examples":["wstETH","WETH"],"default":"WETH","isRequired":true,"uniqueKey":"collateral_token","typeLabel":"string"},"borrow_token":{"type":"string","title":"Token","description":"Token borrowed each iteration and swapped back to the collateral token. For MORPHO it must be the market's loan token.","examples":["WETH","USDC"],"default":"USDC","isRequired":true,"uniqueKey":"borrow_token","typeLabel":"string"},"initial_collateral_amount":{"oneOf":[{"type":"number","title":"Initial Collateral Amount","description":"Collateral (in token units) that the Credit Account must ALREADY hold when this is called — the loop never pulls from the owner's wallet mid-transaction. Fund the account first via /v2/credit/transfer (action=DEPOSIT).","default":1,"minimum":0,"example":1.5,"exclusiveMinimum":true,"isRequired":true,"uniqueKey":"initial_collateral_amount.oneOf.0","typeLabel":"number"},{"type":"string","title":"Initial Collateral Amount","description":"Collateral (in token units) that the Credit Account must ALREADY hold when this is called — the loop never pulls from the owner's wallet mid-transaction. Fund the account first via /v2/credit/transfer (action=DEPOSIT).","default":1,"pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","example":1.5,"isRequired":true,"uniqueKey":"initial_collateral_amount.oneOf.1","typeLabel":"string"}],"isRequired":true,"uniqueKey":"initial_collateral_amount","typeLabel":"number | string"},"multiplier":{"oneOf":[{"type":"number","title":"Multiplier","description":"Target leverage: total collateral exposure = multiplier × initial_collateral_amount. Must be achievable at the requested loan_to_value (max ≈ 0.9 / (1 − LTV)).","default":2,"minimum":1,"example":2,"exclusiveMinimum":true,"isRequired":true,"uniqueKey":"multiplier.oneOf.0","typeLabel":"number"},{"type":"string","title":"Multiplier","description":"Target leverage: total collateral exposure = multiplier × initial_collateral_amount. Must be achievable at the requested loan_to_value (max ≈ 0.9 / (1 − LTV)).","default":2,"pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","example":2,"isRequired":true,"uniqueKey":"multiplier.oneOf.1","typeLabel":"string"}],"isRequired":true,"uniqueKey":"multiplier","typeLabel":"number | string"},"loan_to_value":{"oneOf":[{"type":"number","title":"Loan To Value","description":"Per-iteration borrow LTV in percent. Must not exceed the protocol's maximum for the market (Aave reserve/e-mode LTV; Morpho LLTV with a safety margin; Euler's borrow LTV for the collateral vault); borrows are sized slightly inside the requested value so no leg sits on the protocol's revert boundary.","default":70,"maximum":100,"minimum":0,"example":70,"exclusiveMinimum":true,"isRequired":true,"uniqueKey":"loan_to_value.oneOf.0","typeLabel":"number"},{"type":"string","title":"Loan To Value","description":"Per-iteration borrow LTV in percent. Must not exceed the protocol's maximum for the market (Aave reserve/e-mode LTV; Morpho LLTV with a safety margin; Euler's borrow LTV for the collateral vault); borrows are sized slightly inside the requested value so no leg sits on the protocol's revert boundary.","default":70,"pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","example":70,"isRequired":true,"uniqueKey":"loan_to_value.oneOf.1","typeLabel":"string"}],"isRequired":true,"uniqueKey":"loan_to_value","typeLabel":"number | string"},"protocol":{"type":"string","enum":["AAVE","EULER","MORPHO"],"title":"CreditProtocol","description":"Lending protocol to loop into: AAVE, MORPHO, or EULER. On chain=hyperevm, AAVE is Hyperlend and MORPHO is Felix; EULER is not deployed there.","default":"AAVE","examples":["AAVE"],"uniqueKey":"protocol","typeLabel":"enum\u003cstring>"},"market_id":{"oneOf":[{"type":"string","title":"Market Id","description":"Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO.","uniqueKey":"market_id.oneOf.0","typeLabel":"string"},{"type":"null","title":"Market Id","description":"Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO.","uniqueKey":"market_id.oneOf.1","typeLabel":"null"}],"uniqueKey":"market_id","typeLabel":"string | null"},"collateral_vault":{"oneOf":[{"type":"string","title":"Collateral Vault","description":"Euler only: the EVK vault address collateral is supplied to (from /v2/credit/euler_markets). Required when protocol=EULER.","uniqueKey":"collateral_vault.oneOf.0","typeLabel":"string"},{"type":"null","title":"Collateral Vault","description":"Euler only: the EVK vault address collateral is supplied to (from /v2/credit/euler_markets). Required when protocol=EULER.","uniqueKey":"collateral_vault.oneOf.1","typeLabel":"null"}],"uniqueKey":"collateral_vault","typeLabel":"string | null"},"borrow_vault":{"oneOf":[{"type":"string","title":"Borrow Vault","description":"Euler only: the EVK vault address borrowed from (the sub-account's controller). Required when protocol=EULER.","uniqueKey":"borrow_vault.oneOf.0","typeLabel":"string"},{"type":"null","title":"Borrow Vault","description":"Euler only: the EVK vault address borrowed from (the sub-account's controller). Required when protocol=EULER.","uniqueKey":"borrow_vault.oneOf.1","typeLabel":"null"}],"uniqueKey":"borrow_vault","typeLabel":"string | null"},"sub_account_id":{"type":"integer","maximum":255,"minimum":0,"title":"Sub Account Id","description":"Euler only: the EVC sub-account (0-255) holding this isolated looped position. 0 is the Credit Account itself.","default":0,"uniqueKey":"sub_account_id","typeLabel":"integer"},"max_slippage_percent":{"oneOf":[{"type":"number","title":"Max Slippage Percent","description":"Per-swap slippage tolerance in percent. Loop dust is bounded by this per iteration, so tighter slippage means less dust.","default":"0.5","maximum":10,"minimum":0,"example":0.3,"exclusiveMinimum":true,"uniqueKey":"max_slippage_percent.oneOf.0","typeLabel":"number"},{"type":"string","title":"Max Slippage Percent","description":"Per-swap slippage tolerance in percent. Loop dust is bounded by this per iteration, so tighter slippage means less dust.","default":"0.5","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","example":0.3,"uniqueKey":"max_slippage_percent.oneOf.1","typeLabel":"string"}],"uniqueKey":"max_slippage_percent","typeLabel":"number | string"},"emode_category":{"oneOf":[{"type":"integer","title":"Emode Category","description":"Aave only: e-mode category to enable before looping (higher LTV for correlated pairs, e.g. ETH-correlated). Both tokens must belong to the category or the build returns a 422. On Hyperlend (chain=hyperevm) category 1 is the HYPE-correlated set covering wstHYPE and WHYPE.","minimum":0,"uniqueKey":"emode_category.oneOf.0","typeLabel":"integer"},{"type":"null","title":"Emode Category","description":"Aave only: e-mode category to enable before looping (higher LTV for correlated pairs, e.g. ETH-correlated). Both tokens must belong to the category or the build returns a 422. On Hyperlend (chain=hyperevm) category 1 is the HYPE-correlated set covering wstHYPE and WHYPE.","uniqueKey":"emode_category.oneOf.1","typeLabel":"null"}],"uniqueKey":"emode_category","typeLabel":"integer | null"},"gas_sponsorship":{"type":"boolean","title":"Gas Sponsorship","description":"If true, returns EIP-712 typed data for gas-sponsored execution instead of an unsigned transaction.","default":false,"examples":[false],"uniqueKey":"gas_sponsorship","typeLabel":"boolean"},"preview":{"type":"boolean","title":"Preview","description":"If true, build a display ESTIMATE: no firm RFQ quote is ever requested (quote_expires_at stays null). NOTE that this guarantees only that no firm quote was spent — it does not guarantee an absent transaction: on a pair no firm provider covers, and under pricing=market, the call still falls through to the aggregator and returns a signable transaction. How the estimate is priced follows `pricing`: on a firm-covered pair under 'auto' or 'firm' it is computed from the firm provider's live price levels (indicative); otherwise swap legs are priced by the default aggregator. Set it on every call made while a user is exploring parameters, and leave it false only for the build they actually intend to sign — firm quotes are single-use maker commitments, and requesting them for displays that are never executed degrades the pricing this API is offered.","default":false,"uniqueKey":"preview","typeLabel":"boolean"},"pricing":{"type":"string","enum":["auto","firm","market"],"title":"Pricing","description":"Swap-leg routing policy. 'auto': firm quotes where a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route — previews whose target the firm venue cannot serve return the coverage advisory alone (preview=null, zero aggregator calls), and executions fail with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; every leg is priced by the aggregator and bounded by max_slippage_percent (which firm legs ignore). 'firm' is incompatible with gas_sponsorship (sponsored loops force market routing).","default":"auto","uniqueKey":"pricing","typeLabel":"enum\u003cstring>"}},"type":"object","required":["owner","chain","collateral_token","borrow_token","initial_collateral_amount","multiplier","loan_to_value"],"title":"CreditLoopRequest","description":"Open a leveraged loop: repeatedly supply collateral, borrow, and swap the\nborrow back to collateral — all in ONE atomic transaction from the Credit\nAccount.","default":{"owner":"0x5e5b00ed886A6879C2B934612D2312975427fcAf","chain":"ethereum","protocol":"AAVE","collateral_token":"WETH","borrow_token":"USDC","initial_collateral_amount":1,"multiplier":2,"loan_to_value":70,"max_slippage_percent":0.5,"gas_sponsorship":false},"uniqueKey":"","typeLabel":"CreditLoopRequest · object"},"examples":{"Example":{"title":"Example","value":{"owner":"0x5e5b00ed886A6879C2B934612D2312975427fcAf","chain":"ethereum","protocol":"AAVE","collateral_token":"WETH","borrow_token":"USDC","initial_collateral_amount":1,"multiplier":2,"loan_to_value":70,"max_slippage_percent":0.5,"gas_sponsorship":false}}},"exampleType":"generated"}},"required":true,"exampleType":"generated"},"responses":{"8611f065-64cc-4032-874a-9c610da1a053":{"description":"Successful Response","content":{"application/json":{"schema":{"properties":{"preview":{"oneOf":[{"type":"object","title":"CreditLoopPreview","description":"Projected end state, computed on guaranteed swap floors. Null only on pricing='firm' preview responses whose target the firm venue cannot serve: no leg was priced on any venue, and the response carries the coverage advisory (max_firm_multiplier) alone.","required":["iterations","total_collateral_supplied","total_borrowed","achieved_multiplier","projected_ltv","projected_health_factor","estimated_max_dust","estimated_swap_cost"],"properties":{"iterations":{"type":"integer","title":"Iterations","description":"Number of loop iterations bundled.","isRequired":true,"uniqueKey":"preview.oneOf.0.iterations","typeLabel":"integer"},"total_collateral_supplied":{"type":"string","title":"Total Collateral Supplied","description":"Guaranteed minimum total collateral supplied (token units); actual can only be higher (swap fills above the floor become dust).","isRequired":true,"uniqueKey":"preview.oneOf.0.total_collateral_supplied","typeLabel":"string"},"total_borrowed":{"type":"string","title":"Total Borrowed","description":"Total loan tokens borrowed across iterations.","isRequired":true,"uniqueKey":"preview.oneOf.0.total_borrowed","typeLabel":"string"},"achieved_multiplier":{"type":"string","title":"Achieved Multiplier","description":"Guaranteed leverage floor: total_collateral_supplied / initial_collateral_amount.","isRequired":true,"uniqueKey":"preview.oneOf.0.achieved_multiplier","typeLabel":"string"},"projected_ltv":{"type":"string","title":"Projected Ltv","description":"Projected end loan-to-value in percent, at the sizing oracle prices.","isRequired":true,"uniqueKey":"preview.oneOf.0.projected_ltv","typeLabel":"string"},"projected_health_factor":{"type":"string","title":"Projected Health Factor","description":"Projected health factor (liquidation threshold / projected LTV). Below 1 would be liquidatable — the request is rejected long before that.","isRequired":true,"uniqueKey":"preview.oneOf.0.projected_health_factor","typeLabel":"string"},"estimated_max_dust":{"type":"string","title":"Estimated Max Dust","description":"Upper bound of collateral-token surplus the swaps can leave in the Credit Account (sum of quote − guaranteed floor per swap). It is bounded by max_slippage_percent per iteration, stays in the account, and is never lost.","isRequired":true,"uniqueKey":"preview.oneOf.0.estimated_max_dust","typeLabel":"string"},"estimated_swap_cost":{"type":"string","title":"Estimated Swap Cost","description":"Expected one-off cost of entering this loop, in COLLATERAL token units: the sum over swap legs of the market oracle's fair output minus the router's quote. This is the DEX fee plus price impact — the amount the position must earn back before it is ahead. Multiply by the collateral price for a USD figure. Distinct from estimated_max_dust, which is surplus retained in the account, not a cost. Excludes gas. Measured against the protocol's own oracle, so it also carries any oracle-to-market basis; clamped at zero.","isRequired":true,"uniqueKey":"preview.oneOf.0.estimated_swap_cost","typeLabel":"string"},"legs":{"items":{"properties":{"supply_amount":{"oneOf":[{"type":"string","title":"Supply Amount","description":"Collateral supplied this iteration (token units).","isRequired":true,"uniqueKey":"preview.oneOf.0.legs.items.[INDEX].supply_amount.oneOf.0","typeLabel":"string"},{"type":"null","title":"Supply Amount","description":"Collateral supplied this iteration (token units).","isRequired":true,"uniqueKey":"preview.oneOf.0.legs.items.[INDEX].supply_amount.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"preview.oneOf.0.legs.items.[INDEX].supply_amount","typeLabel":"string | null"},"borrow_amount":{"oneOf":[{"type":"string","title":"Borrow Amount","description":"Loan borrowed this iteration; null on the final supply-only iteration.","uniqueKey":"preview.oneOf.0.legs.items.[INDEX].borrow_amount.oneOf.0","typeLabel":"string"},{"type":"null","title":"Borrow Amount","description":"Loan borrowed this iteration; null on the final supply-only iteration.","uniqueKey":"preview.oneOf.0.legs.items.[INDEX].borrow_amount.oneOf.1","typeLabel":"null"}],"uniqueKey":"preview.oneOf.0.legs.items.[INDEX].borrow_amount","typeLabel":"string | null"},"min_swap_out":{"oneOf":[{"type":"string","title":"Min Swap Out","description":"Guaranteed swap output (collateral units) — the next iteration's supply. Enforced on-chain by the swap's minimum-return.","uniqueKey":"preview.oneOf.0.legs.items.[INDEX].min_swap_out.oneOf.0","typeLabel":"string"},{"type":"null","title":"Min Swap Out","description":"Guaranteed swap output (collateral units) — the next iteration's supply. Enforced on-chain by the swap's minimum-return.","uniqueKey":"preview.oneOf.0.legs.items.[INDEX].min_swap_out.oneOf.1","typeLabel":"null"}],"uniqueKey":"preview.oneOf.0.legs.items.[INDEX].min_swap_out","typeLabel":"string | null"},"expected_swap_out":{"oneOf":[{"type":"string","title":"Expected Swap Out","description":"Quoted swap output (collateral units) before the slippage floor is applied. Only min_swap_out is guaranteed on-chain; the gap between the two is the adverse-slippage tolerance, bounded by max_slippage_percent, not a surplus that is certain to arrive. Whatever the fill actually delivers above min_swap_out stays in the account, and estimated_max_dust is the upper bound on that.","uniqueKey":"preview.oneOf.0.legs.items.[INDEX].expected_swap_out.oneOf.0","typeLabel":"string"},{"type":"null","title":"Expected Swap Out","description":"Quoted swap output (collateral units) before the slippage floor is applied. Only min_swap_out is guaranteed on-chain; the gap between the two is the adverse-slippage tolerance, bounded by max_slippage_percent, not a surplus that is certain to arrive. Whatever the fill actually delivers above min_swap_out stays in the account, and estimated_max_dust is the upper bound on that.","uniqueKey":"preview.oneOf.0.legs.items.[INDEX].expected_swap_out.oneOf.1","typeLabel":"null"}],"uniqueKey":"preview.oneOf.0.legs.items.[INDEX].expected_swap_out","typeLabel":"string | null"}},"additionalProperties":false,"type":"object","required":["supply_amount"],"title":"LoopLegPreview","description":"One planned loop iteration.","uniqueKey":"preview.oneOf.0.legs.items.[INDEX]","typeLabel":"LoopLegPreview · object"},"type":"array","title":"Legs","description":"Per-iteration breakdown.","default":[],"uniqueKey":"preview.oneOf.0.legs","typeLabel":"LoopLegPreview · object[]"}},"additionalProperties":false,"isRequired":true,"uniqueKey":"preview.oneOf.0","typeLabel":"CreditLoopPreview · object"},{"type":"null","description":"Projected end state, computed on guaranteed swap floors. Null only on pricing='firm' preview responses whose target the firm venue cannot serve: no leg was priced on any venue, and the response carries the coverage advisory (max_firm_multiplier) alone.","isRequired":true,"uniqueKey":"preview.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"preview","typeLabel":"CreditLoopPreview · object | null"},"transaction":{"oneOf":[{"type":"object","title":"UnsignedTransaction","description":"Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false — except firm-priced previews (preview=true on a firm-priced build), which carry numbers only: the firm quotes are fetched at execution time, so there is no payload to sign yet.","required":["chainId","data","from","gas","to","value","nonce","maxFeePerGas","maxPriorityFeePerGas"],"example":{"chainId":"0x2105","data":"0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000675f4a3d","from":"0x4A83b4413CF41C3244027e1590E35a0F48403F0c","gas":"0x7a120","maxFeePerGas":"0x59682f00","maxPriorityFeePerGas":"0x3b9aca00","nonce":"0x5","to":"0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67","value":"0x0"},"properties":{"chainId":{"type":"string","title":"Chainid","description":"The chain id of the transaction","isRequired":true,"uniqueKey":"transaction.oneOf.0.chainId","typeLabel":"string"},"data":{"type":"string","title":"Data","description":"The data of the transaction","isRequired":true,"uniqueKey":"transaction.oneOf.0.data","typeLabel":"string"},"from":{"type":"string","title":"From","description":"The sender of the transaction","isRequired":true,"uniqueKey":"transaction.oneOf.0.from","typeLabel":"string"},"gas":{"oneOf":[{"type":"string","title":"Gas","description":"The gas of the transaction","isRequired":true,"uniqueKey":"transaction.oneOf.0.gas.oneOf.0","typeLabel":"string"},{"type":"null","title":"Gas","description":"The gas of the transaction","isRequired":true,"uniqueKey":"transaction.oneOf.0.gas.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"transaction.oneOf.0.gas","typeLabel":"string | null"},"to":{"type":"string","title":"To","description":"The recipient of the transaction","isRequired":true,"uniqueKey":"transaction.oneOf.0.to","typeLabel":"string"},"value":{"type":"string","title":"Value","description":"The value of the transaction","isRequired":true,"uniqueKey":"transaction.oneOf.0.value","typeLabel":"string"},"nonce":{"type":"string","title":"Nonce","description":"The nonce of the address","isRequired":true,"uniqueKey":"transaction.oneOf.0.nonce","typeLabel":"string"},"maxFeePerGas":{"type":"string","title":"Maxfeepergas","description":"The max fee per gas of the transaction","isRequired":true,"uniqueKey":"transaction.oneOf.0.maxFeePerGas","typeLabel":"string"},"maxPriorityFeePerGas":{"type":"string","title":"Maxpriorityfeepergas","description":"The max priority fee per gas of the transaction","isRequired":true,"uniqueKey":"transaction.oneOf.0.maxPriorityFeePerGas","typeLabel":"string"}},"uniqueKey":"transaction.oneOf.0","typeLabel":"UnsignedTransaction · object"},{"type":"null","description":"Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false — except firm-priced previews (preview=true on a firm-priced build), which carry numbers only: the firm quotes are fetched at execution time, so there is no payload to sign yet.","uniqueKey":"transaction.oneOf.1","typeLabel":"null"}],"uniqueKey":"transaction","typeLabel":"UnsignedTransaction · object | null"},"eip_712":{"oneOf":[{"type":"object","title":"BatchedSafeOperationsResponse","description":"EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.","required":["domain","types","primaryType","message"],"example":{"domain":{"chainId":8453,"verifyingContract":"0x6B90E8B4E3E971E74C1A47a3a20976377E2dB4b1"},"message":{"baseGas":"0","data":"0x8d80ff0a0000000000000000000000000000000000000000000000000000000000000020","gasPrice":"0","gasToken":"0x0000000000000000000000000000000000000000","nonce":"7","operation":1,"refundReceiver":"0x0000000000000000000000000000000000000000","safeTxGas":"0","to":"0x93C23AAE4793C14D6DF35D2A2A2234204e1559dA","value":"0"},"primaryType":"SafeTx","types":{"EIP712Domain":[{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"address"}],"SafeTx":[{"name":"to","type":"address"},{"name":"value","type":"uint256"},{"name":"data","type":"bytes"},{"name":"operation","type":"uint8"},{"name":"safeTxGas","type":"uint256"},{"name":"baseGas","type":"uint256"},{"name":"gasPrice","type":"uint256"},{"name":"gasToken","type":"address"},{"name":"refundReceiver","type":"address"},{"name":"nonce","type":"uint256"}]}},"properties":{"domain":{"properties":{"chainId":{"type":"integer","title":"Chainid","description":"Chain ID","isRequired":true,"uniqueKey":"eip_712.oneOf.0.domain.chainId","typeLabel":"integer"},"verifyingContract":{"type":"string","title":"Verifyingcontract","description":"Address of the Product Account","isRequired":true,"uniqueKey":"eip_712.oneOf.0.domain.verifyingContract","typeLabel":"string"}},"type":"object","required":["chainId","verifyingContract"],"title":"EIP712Domain","description":"EIP-712 domain separator","isRequired":true,"uniqueKey":"eip_712.oneOf.0.domain","typeLabel":"EIP712Domain · object"},"types":{"properties":{"EIP712Domain":{"items":{"properties":{"name":{"type":"string","title":"Name","isRequired":true,"uniqueKey":"eip_712.oneOf.0.types.EIP712Domain.items.[INDEX].name","typeLabel":"string"},"type":{"type":"string","title":"Type","isRequired":true,"uniqueKey":"eip_712.oneOf.0.types.EIP712Domain.items.[INDEX].type","typeLabel":"string"}},"type":"object","required":["name","type"],"title":"EIP712DomainField","description":"A field in the EIP712Domain type definition.","uniqueKey":"eip_712.oneOf.0.types.EIP712Domain.items.[INDEX]","typeLabel":"EIP712DomainField · object"},"type":"array","title":"Eip712Domain","description":"EIP712Domain type definition","isRequired":true,"uniqueKey":"eip_712.oneOf.0.types.EIP712Domain","typeLabel":"EIP712DomainField · object[]"},"SafeTx":{"items":{"properties":{"name":{"type":"string","title":"Name","isRequired":true,"uniqueKey":"eip_712.oneOf.0.types.SafeTx.items.[INDEX].name","typeLabel":"string"},"type":{"type":"string","title":"Type","isRequired":true,"uniqueKey":"eip_712.oneOf.0.types.SafeTx.items.[INDEX].type","typeLabel":"string"}},"type":"object","required":["name","type"],"title":"SafeTxField","description":"A field in the SafeTx type definition.","uniqueKey":"eip_712.oneOf.0.types.SafeTx.items.[INDEX]","typeLabel":"SafeTxField · object"},"type":"array","title":"Safetx","description":"SafeTx type definition","isRequired":true,"uniqueKey":"eip_712.oneOf.0.types.SafeTx","typeLabel":"SafeTxField · object[]"}},"type":"object","required":["EIP712Domain","SafeTx"],"title":"EIP712Types","description":"EIP-712 type definitions","isRequired":true,"uniqueKey":"eip_712.oneOf.0.types","typeLabel":"EIP712Types · object"},"primaryType":{"type":"string","const":"SafeTx","title":"Primarytype","description":"Primary type for the structured data","isRequired":true,"uniqueKey":"eip_712.oneOf.0.primaryType","typeLabel":"string"},"message":{"properties":{"to":{"type":"string","title":"To","description":"Destination address","isRequired":true,"uniqueKey":"eip_712.oneOf.0.message.to","typeLabel":"string"},"value":{"type":"string","title":"Value","description":"Value in wei as a string","isRequired":true,"uniqueKey":"eip_712.oneOf.0.message.value","typeLabel":"string"},"data":{"type":"string","title":"Data","description":"Transaction data as hex string","isRequired":true,"uniqueKey":"eip_712.oneOf.0.message.data","typeLabel":"string"},"operation":{"type":"integer","enum":[0,1],"title":"OperationType","description":"Operation type (0=Call, 1=DelegateCall)","isRequired":true,"uniqueKey":"eip_712.oneOf.0.message.operation","typeLabel":"enum\u003cinteger>"},"safeTxGas":{"type":"string","title":"Safetxgas","description":"Gas for the transaction","isRequired":true,"uniqueKey":"eip_712.oneOf.0.message.safeTxGas","typeLabel":"string"},"baseGas":{"type":"string","title":"Basegas","description":"Base gas costs","isRequired":true,"uniqueKey":"eip_712.oneOf.0.message.baseGas","typeLabel":"string"},"gasPrice":{"type":"string","title":"Gasprice","description":"Gas price","isRequired":true,"uniqueKey":"eip_712.oneOf.0.message.gasPrice","typeLabel":"string"},"gasToken":{"type":"string","title":"Gastoken","description":"Token address for gas payment","isRequired":true,"uniqueKey":"eip_712.oneOf.0.message.gasToken","typeLabel":"string"},"refundReceiver":{"type":"string","title":"Refundreceiver","description":"Address to receive gas refund","isRequired":true,"uniqueKey":"eip_712.oneOf.0.message.refundReceiver","typeLabel":"string"},"nonce":{"type":"string","title":"Nonce","description":"Transaction nonce","isRequired":true,"uniqueKey":"eip_712.oneOf.0.message.nonce","typeLabel":"string"}},"type":"object","required":["to","value","data","operation","safeTxGas","baseGas","gasPrice","gasToken","refundReceiver","nonce"],"title":"SafeTxMessage","description":"Safe transaction message data","isRequired":true,"uniqueKey":"eip_712.oneOf.0.message","typeLabel":"SafeTxMessage · object"}},"uniqueKey":"eip_712.oneOf.0","typeLabel":"BatchedSafeOperationsResponse · object"},{"type":"null","description":"EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.","uniqueKey":"eip_712.oneOf.1","typeLabel":"null"}],"uniqueKey":"eip_712","typeLabel":"BatchedSafeOperationsResponse · object | null"},"pt_maturity":{"oneOf":[{"type":"string","title":"Pt Maturity","description":"Maturity of the Pendle principal token supplied as collateral, ISO-8601 UTC. Present only for principal-token collateral, whose yield is fixed until this date; after it the position can be unwound (by redemption at par) but not increased.","uniqueKey":"pt_maturity.oneOf.0","typeLabel":"string"},{"type":"null","title":"Pt Maturity","description":"Maturity of the Pendle principal token supplied as collateral, ISO-8601 UTC. Present only for principal-token collateral, whose yield is fixed until this date; after it the position can be unwound (by redemption at par) but not increased.","uniqueKey":"pt_maturity.oneOf.1","typeLabel":"null"}],"uniqueKey":"pt_maturity","typeLabel":"string | null"},"swap_provider":{"type":"string","enum":["market","firm"],"title":"Swap Provider","description":"Identifies which route priced the swap leg(s): 'market' — a DEX aggregator (iterative loop across pool liquidity, slippage-bounded floors) — or 'firm' — zero-slippage quotes, one per swap leg, each partially filled at the leg's size (exact fills, zero dust). On preview=true responses 'firm' means the numbers are INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quotes at signing time. Always present, including on fallbacks. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED (under 'auto' a firm build can fall back to market transparently), and `quote_expires_at` is absent on every preview — so neither substitutes for this field.","default":"market","uniqueKey":"swap_provider","typeLabel":"enum\u003cstring>"},"quote_expires_at":{"oneOf":[{"type":"string","title":"Quote Expires At","description":"Deadline of the firm swap quotes (the earliest across the loop's swap legs) — sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Present only on executable firm-priced builds; null on previews (no quote is spent for a preview).","format":"date-time","uniqueKey":"quote_expires_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","title":"Quote Expires At","description":"Deadline of the firm swap quotes (the earliest across the loop's swap legs) — sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Present only on executable firm-priced builds; null on previews (no quote is spent for a preview).","uniqueKey":"quote_expires_at.oneOf.1","typeLabel":"null"}],"uniqueKey":"quote_expires_at","typeLabel":"string\u003cdate-time> | null"},"max_firm_multiplier":{"oneOf":[{"type":"string","title":"Max Firm Multiplier","description":"Multiplier bound firm zero-slippage quotes can fill for the requested position size, LTV and target (estimated without spending any quote). The requested multiplier is firm-servable iff it is \u003c= this value; above it the loop executes at market rate with slippage-bounded floors instead. Present only on preview=true responses when a firm-quote venue covers the pair; null otherwise. Recompute per parameter change - minimum-size floors make reachability target-dependent.","uniqueKey":"max_firm_multiplier.oneOf.0","typeLabel":"string"},{"type":"null","title":"Max Firm Multiplier","description":"Multiplier bound firm zero-slippage quotes can fill for the requested position size, LTV and target (estimated without spending any quote). The requested multiplier is firm-servable iff it is \u003c= this value; above it the loop executes at market rate with slippage-bounded floors instead. Present only on preview=true responses when a firm-quote venue covers the pair; null otherwise. Recompute per parameter change - minimum-size floors make reachability target-dependent.","uniqueKey":"max_firm_multiplier.oneOf.1","typeLabel":"null"}],"uniqueKey":"max_firm_multiplier","typeLabel":"string | null"}},"type":"object","required":["preview"],"title":"CreditLoopResponse","description":"The atomic loop transaction plus its guaranteed-floor preview.","uniqueKey":"","typeLabel":"CreditLoopResponse · object"},"examples":{"Example":{"title":"Example","value":{"preview":{"iterations":123,"total_collateral_supplied":"\u003cstring>","total_borrowed":"\u003cstring>","achieved_multiplier":"\u003cstring>","projected_ltv":"\u003cstring>","projected_health_factor":"\u003cstring>","estimated_max_dust":"\u003cstring>","estimated_swap_cost":"\u003cstring>","legs":[]},"transaction":{"chainId":"0x2105","data":"0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000675f4a3d","from":"0x4A83b4413CF41C3244027e1590E35a0F48403F0c","gas":"0x7a120","maxFeePerGas":"0x59682f00","maxPriorityFeePerGas":"0x3b9aca00","nonce":"0x5","to":"0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67","value":"0x0"},"eip_712":{"domain":{"chainId":8453,"verifyingContract":"0x6B90E8B4E3E971E74C1A47a3a20976377E2dB4b1"},"message":{"baseGas":"0","data":"0x8d80ff0a0000000000000000000000000000000000000000000000000000000000000020","gasPrice":"0","gasToken":"0x0000000000000000000000000000000000000000","nonce":"7","operation":1,"refundReceiver":"0x0000000000000000000000000000000000000000","safeTxGas":"0","to":"0x93C23AAE4793C14D6DF35D2A2A2234204e1559dA","value":"0"},"primaryType":"SafeTx","types":{"EIP712Domain":[{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"address"}],"SafeTx":[{"name":"to","type":"address"},{"name":"value","type":"uint256"},{"name":"data","type":"bytes"},{"name":"operation","type":"uint8"},{"name":"safeTxGas","type":"uint256"},{"name":"baseGas","type":"uint256"},{"name":"gasPrice","type":"uint256"},{"name":"gasToken","type":"address"},{"name":"refundReceiver","type":"address"},{"name":"nonce","type":"uint256"}]}},"pt_maturity":"\u003cstring>","swap_provider":"market","quote_expires_at":"2023-11-07T05:31:56Z","max_firm_multiplier":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"b96da7b4-1774-4afb-9818-6055e9a2957f":{"description":"Validation Error","content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"loc":{"items":{"oneOf":[{"type":"string","uniqueKey":"detail.items.[INDEX].loc.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"integer","uniqueKey":"detail.items.[INDEX].loc.items.[INDEX].oneOf.1","typeLabel":"integer"}],"uniqueKey":"detail.items.[INDEX].loc.items.[INDEX]","typeLabel":"string | integer"},"type":"array","title":"Location","isRequired":true,"uniqueKey":"detail.items.[INDEX].loc","typeLabel":"(string | integer)[]"},"msg":{"type":"string","title":"Message","isRequired":true,"uniqueKey":"detail.items.[INDEX].msg","typeLabel":"string"},"type":{"type":"string","title":"Error Type","isRequired":true,"uniqueKey":"detail.items.[INDEX].type","typeLabel":"string"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError","uniqueKey":"detail.items.[INDEX]","typeLabel":"ValidationError · object"},"type":"array","title":"Detail","uniqueKey":"detail","typeLabel":"ValidationError · object[]"}},"type":"object","title":"HTTPValidationError","uniqueKey":"","typeLabel":"HTTPValidationError · object"},"examples":{"Example":{"title":"Example","value":{"detail":[{"loc":["\u003cstring>"],"msg":"\u003cstring>","type":"\u003cstring>"}]}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"e89f6d8c-9ae7-44f6-91ab-c06b98b98bae":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your Compass API Key. Get your key [here](https://www.compasslabs.ai/dashboard).","scopes":[],"schemeName":"ApiKeyAuth"}}},"servers":{"5cc70962-0013-441d-bd6f-5cb484ceb892":{"url":"https://api.compasslabs.ai","description":"Production server"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your Compass API Key. Get your key [here](https://www.compasslabs.ai/dashboard).","scopes":[],"schemeName":"ApiKeyAuth"},"schema":{"title":"x-api-key","type":"string","description":"Your Compass API Key. Get your key [here](https://www.compasslabs.ai/dashboard).","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"ApiKeyAuth","name":"x-api-key"}],"title":"ApiKeyAuth"}]},"originalFileLocation":"v2/combined_spec.json"},"subdomain":"compasslabs-f07467e0","siteName":"Compass API Docs","title":"Open a leveraged loop - Compass API Docs","navMaps":{"firstHrefInVersion":{"V2":{"href":"/v2/api-reference/credit/open-a-leveraged-loop","matchLevel":0},"V1":{"href":"/v1/api-reference/aave-v3/aave-supported-tokens","matchLevel":2}},"firstHrefInLanguage":{}},"lastModified":"2026-11-05T13:11:30.472Z","originalFileLocation":"v2/api-reference/credit/open-a-leveraged-loop.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"light\";if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Open a leveraged position in ONE atomic transaction. Supply collateral, borrow against it, swap the borrowed token back to collateral, repeat — until total collateral reaches multiplier x initial_collateral_amount. If any step fails the whole transaction reverts, so a position is never left half-built. See the Leveraged Looping guide for chain coverage, market discovery, vault-share collateral, HyperEVM specifics and the full error list.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Compass API Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/compasslabs-f07467e0/CejAEahS9T_GZmf_/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/compasslabs-f07467e0/CejAEahS9T_GZmf_/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/compasslabs-f07467e0/CejAEahS9T_GZmf_/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/compasslabs-f07467e0/CejAEahS9T_GZmf_/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/compasslabs-f07467e0/CejAEahS9T_GZmf_/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/compasslabs-f07467e0/CejAEahS9T_GZmf_/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/compasslabs-f07467e0/CejAEahS9T_GZmf_/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/compasslabs-f07467e0/CejAEahS9T_GZmf_/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/compasslabs-f07467e0/CejAEahS9T_GZmf_/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Open a leveraged loop - Compass API Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Open a leveraged position in ONE atomic transaction. Supply collateral, borrow against it, swap the borrowed token back to collateral, repeat — until total collateral reaches multiplier x initial_collateral_amount. If any step fails the whole transaction reverts, so a position is never left half-built. See the Leveraged Looping guide for chain coverage, market discovery, vault-share collateral, HyperEVM specifics and the full error list.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Compass API Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.compasslabs.ai/v2/api-reference/credit/open-a-leveraged-loop\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://compasslabs-f07467e0.mintlify.site/_mintlify/api/og/v2?division=Credit\u0026amp;title=Open+a+leveraged+loop\u0026amp;description=Open+a+leveraged+position+in+ONE+atomic+transaction.%0A%0ASupply+collateral%2C+borrow+against+it%2C+swap+the+borrowed+token+back+to%0Acollateral%2C+repeat+%E2%80%94+until+total+col\u0026amp;theme=3dbf73b4b3dd364abd493b9c\u0026amp;signature=db2b3638bf4eb2d56761ee5dbb1d5d0f4f2ac92a99bb165b9d90edfcc1dac2a2\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Open a leveraged loop - Compass API Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Open a leveraged position in ONE atomic transaction. Supply collateral, borrow against it, swap the borrowed token back to collateral, repeat — until total collateral reaches multiplier x initial_collateral_amount. If any step fails the whole transaction reverts, so a position is never left half-built. See the Leveraged Looping guide for chain coverage, market discovery, vault-share collateral, HyperEVM specifics and the full error list.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://compasslabs-f07467e0.mintlify.site/_mintlify/api/og/v2?division=Credit\u0026amp;title=Open+a+leveraged+loop\u0026amp;description=Open+a+leveraged+position+in+ONE+atomic+transaction.%0A%0ASupply+collateral%2C+borrow+against+it%2C+swap+the+borrowed+token+back+to%0Acollateral%2C+repeat+%E2%80%94+until+total+col\u0026amp;theme=3dbf73b4b3dd364abd493b9c\u0026amp;signature=db2b3638bf4eb2d56761ee5dbb1d5d0f4f2ac92a99bb165b9d90edfcc1dac2a2\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/compasslabs-f07467e0/CejAEahS9T_GZmf_/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Compass API Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0284c7\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.compasslabs.ai/v2/api-reference/credit/open-a-leveraged-loop\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/v2/api-reference/credit/open-a-leveraged-loop.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.compasslabs.ai/#organization\",\"name\":\"Compass API Docs\",\"url\":\"https://docs.compasslabs.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/compasslabs-f07467e0/x2NrFgZ7soJbH6sc/logo/light.svg?fit=max\u0026auto=format\u0026n=x2NrFgZ7soJbH6sc\u0026q=85\u0026s=80a04b06674000990914306c6a833cb9\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.compasslabs.ai#website\",\"name\":\"Compass API Docs\",\"url\":\"https://docs.compasslabs.ai\",\"publisher\":{\"@id\":\"https://docs.compasslabs.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.compasslabs.ai/v2/api-reference/credit/open-a-leveraged-loop#webpage\",\"url\":\"https://docs.compasslabs.ai/v2/api-reference/credit/open-a-leveraged-loop\",\"name\":\"Open a leveraged loop\",\"description\":\"Open a leveraged position in ONE atomic transaction. Supply collateral, borrow against it, swap the borrowed token back to collateral, repeat — until total collateral reaches multiplier x initial_collateral_amount. If any step fails the whole transaction reverts, so a position is never left half-built. See the Leveraged Looping guide for chain coverage, market discovery, vault-share collateral, HyperEVM specifics and the full error list.\",\"dateModified\":\"2026-11-05T13:11:30.472Z\",\"isPartOf\":{\"@id\":\"https://docs.compasslabs.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.compasslabs.ai/v2/api-reference/credit/open-a-leveraged-loop#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.compasslabs.ai/v2/api-reference/credit/open-a-leveraged-loop#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API Reference\",\"item\":\"https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Credit\",\"item\":\"https://docs.compasslabs.ai/v2/api-reference/credit/list-credit-positions\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Open a leveraged loop\",\"item\":\"https://docs.compasslabs.ai/v2/api-reference/credit/open-a-leveraged-loop\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.compasslabs.ai/v2/api-reference/credit/open-a-leveraged-loop#apireference\",\"headline\":\"Open a leveraged loop\",\"name\":\"Open a leveraged loop\",\"description\":\"Open a leveraged position in ONE atomic transaction. Supply collateral, borrow against it, swap the borrowed token back to collateral, repeat — until total collateral reaches multiplier x initial_collateral_amount. If any step fails the whole transaction reverts, so a position is never left half-built. See the Leveraged Looping guide for chain coverage, market discovery, vault-share collateral, HyperEVM specifics and the full error list.\",\"url\":\"https://docs.compasslabs.ai/v2/api-reference/credit/open-a-leveraged-loop\",\"mainEntityOfPage\":{\"@id\":\"https://docs.compasslabs.ai/v2/api-reference/credit/open-a-leveraged-loop#webpage\"},\"dateModified\":\"2026-11-05T13:11:30.472Z\",\"publisher\":{\"@id\":\"https://docs.compasslabs.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.compasslabs.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Compass API Docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Compass API Docs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/v2/api-reference/credit/open-a-leveraged-loop.md","siteName":"Compass API Docs","nav":{"global":{"tabs":[],"anchors":[]},"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/v2/get_started/overview"}]},{"tab":"API Reference","versions":[{"version":"V2","groups":[{"group":"API Reference","pages":[{"group":"Gas Sponsorship","pages":[{"title":"Prepare gas-sponsored transaction","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/gas_sponsorship/prepare","href":"/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction"},{"title":"Approve token transfer","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/gas_sponsorship/approve_transfer","href":"/v2/api-reference/gas-sponsorship/approve-token-transfer"}]},{"group":"Earn","pages":[{"title":"List earn positions","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/earn/positions","href":"/v2/api-reference/earn/list-earn-positions"},{"title":"List earn positions across all chains","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/earn/positions_all","href":"/v2/api-reference/earn/list-earn-positions-across-all-chains"},{"title":"List vaults","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/earn/vaults","href":"/v2/api-reference/earn/list-vaults"},{"title":"List aave markets","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/earn/aave_markets","href":"/v2/api-reference/earn/list-aave-markets"},{"title":"List pendle markets","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/earn/pendle_markets","href":"/v2/api-reference/earn/list-pendle-markets"},{"title":"List maple pools","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/earn/maple_pools","href":"/v2/api-reference/earn/list-maple-pools"},{"title":"Quote a swap","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/earn/swap_quote","href":"/v2/api-reference/earn/quote-a-swap"},{"title":"Get token balances","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/earn/balances","href":"/v2/api-reference/earn/get-token-balances"},{"title":"Create earn account","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/earn/create_account","href":"/v2/api-reference/earn/create-earn-account"},{"title":"Transfer tokens to/from account","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/earn/transfer","href":"/v2/api-reference/earn/transfer-tokens-tofrom-account"},{"title":"Manage earn position","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/earn/manage","href":"/v2/api-reference/earn/manage-earn-position"},{"title":"Swap tokens","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/earn/swap","href":"/v2/api-reference/earn/swap-tokens"},{"title":"Execute multiple earn actions","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/earn/bundle","href":"/v2/api-reference/earn/execute-multiple-earn-actions"}]},{"group":"Bridge","pages":[{"title":"Initiate USDC bridging","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/cctp/burn","href":"/v2/api-reference/bridge/initiate-usdc-bridging"},{"title":"Complete USDC bridging","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/cctp/mint","href":"/v2/api-reference/bridge/complete-usdc-bridging"}]},{"group":"Credit","pages":[{"title":"List credit positions","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/credit/positions","href":"/v2/api-reference/credit/list-credit-positions"},{"title":"Get credit account token balances","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/credit/balances","href":"/v2/api-reference/credit/get-credit-account-token-balances"},{"title":"List looped (leveraged) credit positions","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/credit/looped_positions","href":"/v2/api-reference/credit/list-looped-leveraged-credit-positions"},{"title":"List Euler markets","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/credit/euler_markets","href":"/v2/api-reference/credit/list-euler-markets"},{"title":"List Morpho markets","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/credit/morpho_markets","href":"/v2/api-reference/credit/list-morpho-markets"},{"title":"List Aave markets","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/credit/aave_markets","href":"/v2/api-reference/credit/list-aave-markets"},{"title":"Create credit account","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/credit/create_account","href":"/v2/api-reference/credit/create-credit-account"},{"title":"Borrow against collateral","description":"Borrow an asset from Aave using a Credit Account.\n\nBundles an optional swap, collateral supply, and borrow into a single atomic Safe transaction.\n\n- If `token_in` equals `collateral_token`, the tokens are supplied directly as collateral.\n- If `token_in` differs from `collateral_token`, a market swap is performed first.\n\nThe Credit Account must already be created via `/v2/credit/create_account` and funded with `token_in`.","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/credit/borrow","href":"/v2/api-reference/credit/borrow-against-collateral"},{"title":"Open a leveraged loop","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/credit/loop","href":"/v2/api-reference/credit/open-a-leveraged-loop"},{"title":"Unwind a leveraged loop","description":"Unwind a leveraged position in ONE atomic transaction.\n\nWithdraw collateral, swap it back to the borrow token, repay, repeat — until\nthe position reaches target_multiplier, or until the debt is cleared exactly\nif you omit it. If any step fails the whole transaction reverts.\n\nSee the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)\nfor chain coverage, vault-share collateral, shared Aave reserves and the full\nerror list.","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/credit/unloop","href":"/v2/api-reference/credit/unwind-a-leveraged-loop"},{"title":"Rebalance the leveraged credit book","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/credit/rebalance","href":"/v2/api-reference/credit/rebalance-the-leveraged-credit-book"},{"title":"Transfer tokens to/from Credit Account","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/credit/transfer","href":"/v2/api-reference/credit/transfer-tokens-tofrom-credit-account"},{"title":"Swap tokens","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/credit/swap","href":"/v2/api-reference/credit/swap-tokens"},{"title":"Repay debt and withdraw collateral","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/credit/repay","href":"/v2/api-reference/credit/repay-debt-and-withdraw-collateral"},{"title":"Execute multiple credit actions","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/credit/bundle","href":"/v2/api-reference/credit/execute-multiple-credit-actions"}]},{"group":"Perpetual Trading","pages":[{"title":"List perpetual trading markets","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/perpetual_trading/opportunities","href":"/v2/api-reference/perpetual-trading/list-perpetual-trading-markets"},{"title":"List perpetual trading positions","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/perpetual_trading/positions","href":"/v2/api-reference/perpetual-trading/list-perpetual-trading-positions"},{"title":"Get OHLCV candles","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/perpetual_trading/candles","href":"/v2/api-reference/perpetual-trading/get-ohlcv-candles"},{"title":"Aggregated Hyperliquid activity for a user","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/perpetual_trading/activity","href":"/v2/api-reference/perpetual-trading/aggregated-hyperliquid-activity-for-a-user"},{"title":"Deposit USDC to perpetual trading account","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/perpetual_trading/deposit","href":"/v2/api-reference/perpetual-trading/deposit-usdc-to-perpetual-trading-account"},{"title":"Build the Bridge2 deposit tx from a signed permit","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/perpetual_trading/deposit/sponsor_prepare","href":"/v2/api-reference/perpetual-trading/build-the-bridge2-deposit-tx-from-a-signed-permit"},{"title":"Withdraw USDC from perpetual trading account","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/perpetual_trading/withdraw","href":"/v2/api-reference/perpetual-trading/withdraw-usdc-from-perpetual-trading-account"},{"title":"Place market order","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/perpetual_trading/market_order","href":"/v2/api-reference/perpetual-trading/place-market-order"},{"title":"Place limit order","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/perpetual_trading/limit_order","href":"/v2/api-reference/perpetual-trading/place-limit-order"},{"title":"Cancel order","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/perpetual_trading/cancel_order","href":"/v2/api-reference/perpetual-trading/cancel-order"},{"title":"Execute signed action","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/perpetual_trading/execute","href":"/v2/api-reference/perpetual-trading/execute-signed-action"},{"title":"Approve builder fee","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/perpetual_trading/approve_builder_fee","href":"/v2/api-reference/perpetual-trading/approve-builder-fee"},{"title":"Enable unified account mode","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/perpetual_trading/enable_unified_account","href":"/v2/api-reference/perpetual-trading/enable-unified-account-mode"},{"title":"Ensure 1x cross leverage","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/perpetual_trading/ensure_leverage","href":"/v2/api-reference/perpetual-trading/ensure-1x-cross-leverage"},{"title":"Set leverage (defaults to market maximum)","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/perpetual_trading/set_leverage","href":"/v2/api-reference/perpetual-trading/set-leverage-defaults-to-market-maximum"}]},{"group":"Tokenized Assets","pages":[{"title":"List markets","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/tokenized_assets/markets","href":"/v2/api-reference/tokenized-assets/list-markets"},{"title":"Get a market","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/tokenized_assets/markets/{symbol}","href":"/v2/api-reference/tokenized-assets/get-a-market"},{"title":"List positions","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/tokenized_assets/positions","href":"/v2/api-reference/tokenized-assets/list-positions"},{"title":"Get token balances","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/tokenized_assets/balances","href":"/v2/api-reference/tokenized-assets/get-token-balances"},{"title":"Get order status","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/tokenized_assets/order/{order_hash}","href":"/v2/api-reference/tokenized-assets/get-order-status"},{"title":"List redemption requests","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json get /v2/tokenized_assets/redemptions","href":"/v2/api-reference/tokenized-assets/list-redemption-requests"},{"title":"Create account","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/tokenized_assets/create_account","href":"/v2/api-reference/tokenized-assets/create-account"},{"title":"Transfer tokens to/from account","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/tokenized_assets/transfer","href":"/v2/api-reference/tokenized-assets/transfer-tokens-tofrom-account"},{"title":"Quote an order","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/tokenized_assets/quote","href":"/v2/api-reference/tokenized-assets/quote-an-order"},{"title":"Build an order","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/tokenized_assets/order","href":"/v2/api-reference/tokenized-assets/build-an-order"},{"title":"Submit a signed order","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/tokenized_assets/order/submit","href":"/v2/api-reference/tokenized-assets/submit-a-signed-order"},{"title":"Cancel an order","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/tokenized_assets/order/{order_hash}/cancel","href":"/v2/api-reference/tokenized-assets/cancel-an-order"},{"title":"Charge a partner fee","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/tokenized_assets/order/{order_hash}/charge_fee","href":"/v2/api-reference/tokenized-assets/charge-a-partner-fee"},{"title":"Buy an RWA yield token","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/tokenized_assets/transact/buy","href":"/v2/api-reference/tokenized-assets/buy-an-rwa-yield-token"},{"title":"Sell an RWA yield token","deprecated":null,"version":null,"openapi":"/v2/combined_spec.json post /v2/tokenized_assets/transact/sell","href":"/v2/api-reference/tokenized-assets/sell-an-rwa-yield-token"}]}]}]},{"version":"V1","pages":[{"title":"V1","href":"/v1/api-reference/aave-v3/aave-supported-tokens"}]}]}]},"basePath":"","title":"Open a leveraged loop - Compass API Docs","buildId":"dpl_GRSyrvXT6FFTpZZTGz5iZPp3D2zE","deploymentId":"dpl_GRSyrvXT6FFTpZZTGz5iZPp3D2zE","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-BFmjTMeT.js","utils-BWr-sjpP.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-LafIDf0N.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-MJNzuxek.js","snippetPresets-DPZEtUvW.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-DQ2UhGIs.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-DUUJTUkE.js","shallow-BTf5bw35.js","getApiPlaygroundDisplay-h2POYYOO.js","CodeSnippet-C4qEftRe.js","CodeSnippets-CsSrOqMC.js","Page-CWFqNdGh.js","getPastedJson-DU6W6y78.js","icon-2ZYNQ78y.js","MethodPill-BMXJzYMm.js","DuplicateIcon-DNjdEpYZ.js","createIcon-WdPVhKxl.js","DynamicMarkdown-Z_y464fM.js","SectionHeading-Bcrd8azU.js","axios-vUo_bRtp.js","Markdown-BnvucbFu.js","dist-D7YyC486.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","katex-YMM-FMeD.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js","AssistantPageLink-D1I8TPjt.js"]}