> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spiralstake.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Preview opening a leveraged position (deterministic, no wallet)



## OpenAPI

````yaml /api-reference/openapi.json post /v1/partner/leverage/simulate
openapi: 3.1.0
info:
  title: Spiral Stake — Read API (v1)
  version: 0.1.0
  description: >-
    Read-only composition authority for Spiral Stake strategy data. Serves the
    frozen /strategies contract (agents + app) plus the full app read surface.
    All numbers are composed from warm cache; a stale/failed upstream serves
    last-good with a visible stale age.
servers:
  - url: https://api.spiralstake.xyz
    description: Production
  - url: http://localhost:8787
    description: Local
security: []
tags:
  - name: Public
    description: Open read endpoints — no key required.
  - name: Partner
    description: 'Keyed integration API — Authorization: Bearer <key>.'
paths:
  /v1/partner/leverage/simulate:
    post:
      tags:
        - Partner
      summary: Preview opening a leveraged position (deterministic, no wallet)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - strategyId
                - payToken
                - amount
              properties:
                strategyId:
                  type: string
                  description: Morpho market id (from /v1/strategies).
                payToken:
                  type: string
                  description: >-
                    Token to pay in. Collateral (direct) or any token (zapped).
                    ETH = zero address.
                amount:
                  type: string
                  description: Amount of payToken in human units, e.g. '10000'.
                leverage:
                  type: number
                  description: Target leverage (e.g. 3). Provide this OR desiredLtv.
                desiredLtv:
                  type: string
                  description: Target LTV percent (e.g. '66.67'). Provide this OR leverage.
                slippage:
                  type: number
                  description: Ratio, default 0.005, capped at 0.01.
                chainId:
                  type: integer
                  enum:
                    - 1
                    - 4663
      responses:
        '200':
          description: Position preview
          content:
            application/json:
              schema:
                type: object
                properties:
                  path:
                    type: string
                  isDirect:
                    type: boolean
                  isReallocate:
                    type: boolean
                  positionPreview:
                    type: object
                    properties:
                      leverage:
                        type: string
                        example: '3.0'
                      requestedLtv:
                        type: string
                        example: '66.67'
                      effectiveLtv:
                        type: string
                        example: '66.73'
                      amountLeveragedCollateral:
                        type: string
                      expectedLeverageApy:
                        type: string
                        example: '5.64'
                      priceImpactPct:
                        type: string
                        example: '0.07'
                  amountFlashLoan:
                    type: string
                  minTokenOut:
                    type: string
                  reallocationFeeWei:
                    type: string
                    nullable: true
                  slippage:
                    type: number
                  note:
                    type: string
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      correlationId:
                        type: string
                      details: {}
                    required:
                      - code
                      - message
                      - correlationId
        '401':
          description: Missing/invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      correlationId:
                        type: string
                      details: {}
                    required:
                      - code
                      - message
                      - correlationId
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      correlationId:
                        type: string
                      details: {}
                    required:
                      - code
                      - message
                      - correlationId
        '503':
          description: Transient (stale data / no route / RPC) — retry
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      correlationId:
                        type: string
                      details: {}
                    required:
                      - code
                      - message
                      - correlationId
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Partner API key: `Authorization: Bearer <key>`.'

````