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

# Execute an action

> Build the unsigned transactions for a Borrow action such as supply or borrow, and return them for the wallet to sign.

Returns `201` with an action whose `transactions[]` you sign and submit in the order returned, using [Submit a transaction](/api-reference/borrow/transactions/submit-transaction), then poll [Get an action](/api-reference/borrow/actions/get-action). Nothing executes until a signed transaction is submitted. `metadata` previews the health factor and LTV after the action.

`args` is one flat object shared by every action. Required arguments per action and integration, the `amount` and `amountRaw` rules, `repayAll`, and the validation errors are in [Action arguments](/api-reference/borrow/objects#action-arguments). Which integration supports which action is in [Availability by integration](/api-reference/borrow/objects#availability-by-integration). The Borrow API applies no geolocation block on this route.

Only `borrow` and `repay` accept a collateral amount, which adds a collateral leg to the same action; see [Collateral bundling](/api-reference/borrow/objects#collateral-bundling). On pool markets it also needs `collateralTokenAddress`:

```json Borrow with collateral on a pool market theme={null}
{
  "integrationId": "aave-borrow",
  "action": "borrow",
  "address": "0xYOUR_WALLET_ADDRESS",
  "args": {
    "marketId": "YOUR_MARKET_ID",
    "amount": "500",
    "collateralTokenAddress": "0xYOUR_COLLATERAL_TOKEN_ADDRESS",
    "collateralAmount": "0.5"
  }
}
```

```json Close a debt theme={null}
{
  "integrationId": "aave-borrow",
  "action": "repay",
  "address": "0xYOUR_WALLET_ADDRESS",
  "args": { "marketId": "YOUR_MARKET_ID", "repayAll": true }
}
```

Errors return `statusCode`, `timestamp`, `path` and `message`. Common causes of `400`: an unknown or unsupported `integrationId`, an action the integration does not support, an argument that fails the rules above, and Lista `minLoan` violations. An unknown `marketId` returns `404`. See [Errors and retries](/api-reference/errors-retries).


## OpenAPI

````yaml openapi-borrow.json POST /v1/actions
openapi: 3.0.0
info:
  title: 'Yield API: Borrow'
  description: API Documentation
  version: '1.0'
  contact: {}
servers:
  - url: https://borrow.yield.xyz
    description: Production
security: []
tags:
  - name: Discovery
    description: Browse and discover lending markets, integrations, and supported networks
  - name: Positions
    description: User-specific supply and borrow positions
  - name: Actions
    description: >-
      Execute actions (supply, borrow, repay, withdraw) and manage multi-step
      flows
  - name: Transactions
    description: Submit signed transactions and track status
externalDocs:
  description: For more information
  url: https://docs.yield.xyz
paths:
  /v1/actions:
    post:
      tags:
        - Actions
        - Actions
      summary: Execute a borrow action
      description: >-
        Generate unsigned transactions for a lending/borrowing action. Returns
        transaction(s) to sign. Submit each signed transaction via POST
        /transactions/:id/submit. For async multi-step flows (e.g., cross-chain
        bridges), hasNextStep will be true — call POST /actions/:id/step after
        confirmation to get the next transaction(s).
      operationId: ActionsController_executeAction_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActionRequestDto'
      responses:
        '201':
          description: Action created with unsigned transactions ready for signing
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionDto'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Invalid API key
                  error:
                    type: string
                    example: Unauthorized
                  statusCode:
                    type: number
                    example: 401
        '429':
          description: Rate limit exceeded
          headers:
            x-ratelimit-limit:
              description: Request limit per window
              schema:
                type: string
            x-ratelimit-remaining:
              description: Remaining requests (will be 0)
              schema:
                type: string
            x-ratelimit-reset:
              description: Unix timestamp when window resets
              schema:
                type: string
            retry-after:
              description: Seconds to wait before retrying
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Rate limit exceeded
                  error:
                    type: string
                    example: Too Many Requests
                  statusCode:
                    type: number
                    example: 429
                  retryAfter:
                    type: number
                    example: 30
      security:
        - ApiKey: []
components:
  schemas:
    ActionRequestDto:
      type: object
      properties:
        integrationId:
          type: string
          description: Integration identifier
          example: aave-borrow
        action:
          type: string
          description: Action to execute
          enum:
            - supply
            - borrow
            - repay
            - withdraw
            - enableCollateral
            - disableCollateral
            - supplyAndBorrow
          example: supply
        address:
          type: string
          description: User wallet address
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f8fB28'
        args:
          description: Action arguments
          allOf:
            - $ref: '#/components/schemas/ArgumentsDto'
      required:
        - integrationId
        - action
        - address
        - args
    ActionDto:
      type: object
      properties:
        id:
          type: string
          description: Unique action identifier (UUID)
          example: 550e8400-e29b-41d4-a716-446655440000
        integrationId:
          type: string
          description: Integration identifier
          example: aave-borrow
        action:
          type: string
          description: Action type executed
          enum:
            - supply
            - borrow
            - repay
            - withdraw
            - enableCollateral
            - disableCollateral
            - supplyAndBorrow
          example: supply
        address:
          type: string
          description: User wallet address
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f8fB28'
        status:
          type: string
          description: Current action status
          enum:
            - CANCELED
            - CREATED
            - WAITING_FOR_NEXT
            - PROCESSING
            - FAILED
            - SUCCESS
            - STALE
          example: CREATED
        transactions:
          description: Transactions to sign (current step only)
          type: array
          items:
            $ref: '#/components/schemas/TransactionDto'
        hasNextStep:
          type: boolean
          description: >-
            Whether there are more transactions to sign after the current step
            completes. When true, call POST /actions/:id/step after confirming
            to get the next transaction(s). Used for async multi-step flows such
            as cross-chain bridges or delayed withdrawals.
          example: false
        currentStep:
          type: number
          description: Current step number (1-indexed)
          example: 1
        totalSteps:
          type: number
          description: >-
            Total number of steps in this action. Most actions are single-step.
            Multi-step actions occur when an async operation (e.g., bridge
            confirmation) must complete before the next transaction can be
            constructed.
          example: 1
        rawArguments:
          description: Raw arguments as submitted
          allOf:
            - $ref: '#/components/schemas/ArgumentsDto'
        metadata:
          description: >-
            Action metadata with predicted position impact (health factor, LTV,
            USD totals)
          allOf:
            - $ref: '#/components/schemas/ActionMetadataDto'
        createdAt:
          format: date-time
          type: string
          description: When the action was created
      required:
        - id
        - integrationId
        - action
        - address
        - status
        - transactions
        - hasNextStep
        - currentStep
        - totalSteps
        - createdAt
    ArgumentsDto:
      type: object
      properties:
        amount:
          type: string
          description: >-
            Amount in human-readable units (e.g. "1.5" for 1.5 USDC). Provide
            either amount or amountRaw.
          example: '1.5'
        amountRaw:
          type: string
          description: >-
            Amount in raw token units (e.g. "1500000" for 1.5 USDC with 6
            decimals). Provide either amount or amountRaw.
          example: '1500000'
        repayAll:
          type: boolean
          description: >-
            Repay the full outstanding debt using protocol-specific full-repay
            semantics. Only valid for repay actions. When true, omit amount and
            amountRaw.
          example: true
        tokenAddress:
          type: string
          description: Token address to supply/borrow/repay/withdraw
          example: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
        collateralTokenAddress:
          type: string
          description: >-
            Collateral token address. Required when providing collateralAmount
            for pool-based protocols (Aave). Inferred from marketId for
            isolated-market protocols (Morpho Blue).
          example: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
        collateralAmount:
          type: string
          description: >-
            Optional collateral amount in human-readable units (e.g. "0.5" for
            0.5 ETH). For borrow: collateral to deposit before borrowing. For
            repay: collateral to withdraw after repaying. Provide either
            collateralAmount or collateralAmountRaw.
          example: '0.5'
        collateralAmountRaw:
          type: string
          description: >-
            Optional collateral amount in raw token units (e.g. "50000000" for
            0.5 ETH with 8 decimals). Provide either collateralAmount or
            collateralAmountRaw.
          example: '50000000'
        borrowAmount:
          type: string
          description: >-
            Supply action only. Desired borrow amount in human-readable units of
            the market loan token. Provide together with targetLtv to have the
            API derive the required collateral (post-fee). Mutually exclusive
            with amount/amountRaw.
          example: '100'
        targetLtv:
          type: string
          description: >-
            Supply action only. Target loan-to-value as a decimal (e.g. "0.1" =
            10%). Provide together with borrowAmount. Must not exceed the market
            max LTV.
          example: '0.1'
        marketId:
          type: string
          description: >-
            Market ID as returned by GET /v1/markets. Identifies the specific
            lending market for the action.
          example: morpho-blue-borrow-base-cbbtc-usdc-86
      required:
        - marketId
    TransactionDto:
      type: object
      properties:
        id:
          type: string
          description: Transaction ID (UUID)
          example: 550e8400-e29b-41d4-a716-446655440000
        network:
          type: string
          description: Network identifier
          enum:
            - ethereum
            - ethereum-goerli
            - ethereum-holesky
            - ethereum-sepolia
            - ethereum-hoodi
            - arbitrum
            - base
            - base-sepolia
            - gnosis
            - optimism
            - polygon
            - polygon-amoy
            - starknet
            - zksync
            - linea
            - unichain
            - plume
            - monad-testnet
            - monad
            - robinhood
            - robinhood-testnet
            - arc-testnet
            - arc
            - avalanche-c
            - avalanche-c-atomic
            - avalanche-p
            - binance
            - celo
            - fantom
            - harmony
            - moonriver
            - okc
            - viction
            - core
            - sonic
            - plasma
            - katana
            - hyperevm
            - tempo
            - pharos
            - agoric
            - akash
            - axelar
            - band-protocol
            - bitsong
            - canto
            - chihuahua
            - comdex
            - coreum
            - cosmos
            - crescent
            - cronos
            - cudos
            - desmos
            - dydx
            - evmos
            - fetch-ai
            - gravity-bridge
            - injective
            - irisnet
            - juno
            - kava
            - ki-network
            - mars-protocol
            - nym
            - okex-chain
            - onomy
            - osmosis
            - persistence
            - quicksilver
            - regen
            - secret
            - sentinel
            - sommelier
            - stafi
            - stargaze
            - stride
            - teritori
            - tgrade
            - umee
            - sei
            - mantra
            - celestia
            - saga
            - zetachain
            - dymension
            - humansai
            - neutron
            - polkadot
            - kusama
            - westend
            - bittensor
            - aptos
            - binancebeacon
            - cardano
            - near
            - solana
            - solana-devnet
            - stellar
            - stellar-testnet
            - sui
            - tezos
            - tron
            - ton
            - ton-testnet
            - hyperliquid
          example: ethereum
        chainId:
          type: string
          description: Chain ID
          example: '1'
        type:
          type: string
          description: Transaction type
          enum:
            - APPROVAL
            - AUTHORIZE
            - DEAUTHORIZE
            - SUPPLY
            - BORROW
            - REPAY
            - WITHDRAW
            - ENABLE_COLLATERAL
            - DISABLE_COLLATERAL
            - BUNDLE
            - WRAP
          example: SUPPLY
        status:
          type: string
          description: Current transaction status
          enum:
            - NOT_FOUND
            - CREATED
            - BLOCKED
            - WAITING_FOR_SIGNATURE
            - SIGNED
            - BROADCASTED
            - PENDING
            - CONFIRMED
            - FAILED
            - SKIPPED
          example: CREATED
        address:
          type: string
          description: User address
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f8fB28'
        signingFormat:
          type: string
          description: Signing format required
          enum:
            - EVM_TRANSACTION
            - EIP712_TYPED_DATA
            - SOLANA_TRANSACTION
            - COSMOS_TRANSACTION
          example: EVM_TRANSACTION
        signablePayload:
          description: >-
            Unsigned transaction payload to sign. For EVM transactions, this is
            a JSON string containing from, to, data, gasLimit, and value fields.
          oneOf:
            - type: string
            - type: object
          example: >-
            {"from":"0x6877BB79...","gasLimit":"350000","to":"0xA238Dd80...","data":"0x617ba037..."}
      required:
        - id
        - network
        - chainId
        - type
        - status
        - address
    ActionMetadataDto:
      type: object
      properties:
        currentHealthFactor:
          type: string
          description: Current health factor. Null when there is no debt.
          example: '1.85'
          nullable: true
        predictedHealthFactor:
          type: string
          description: >-
            Predicted health factor after the action. Null when predicted debt
            is zero.
          example: '1.42'
          nullable: true
        currentLtv:
          type: string
          description: Current loan-to-value ratio as decimal
          example: '0.55'
        predictedLtv:
          type: string
          description: Predicted loan-to-value ratio after the action
          example: '0.72'
        liquidationThreshold:
          type: string
          description: Liquidation threshold as decimal
          example: '0.85'
        predictedTotalSupplyUsd:
          type: string
          description: Predicted total supply in USD after the action
          example: '10000.00'
        predictedTotalDebtUsd:
          type: string
          description: Predicted total debt in USD after the action
          example: '7200.00'
        originationFeeBps:
          type: number
          description: Origination fee in basis points when a borrow wrapper is applied
          example: 100
        originationFeeAmount:
          type: string
          description: >-
            Origination fee amount in borrowed-token units when a borrow wrapper
            is applied
          example: '1.00'
        effectivePrincipalAmount:
          type: string
          description: >-
            Actual principal recorded onchain in borrowed-token units when a
            borrow wrapper is applied
          example: '101.00'
        feeAmount:
          type: string
          description: >-
            Fee charged on supplied collateral, in human-readable units of the
            supplied token. Present on supply actions; may also be present on
            borrow actions that bundle a collateral leg, depending on the
            integration. "0" when no supply fee wrapper is configured or its
            rate is 0.
          example: '0.0005'
        feeBps:
          type: number
          description: >-
            Fee rate in basis points on supplied collateral. Present on supply
            actions; may also be present on borrow actions that bundle a
            collateral leg, depending on the integration. 0 when no supply fee
            wrapper is configured or its rate is 0.
          example: 50
        effectiveCollateralAmount:
          type: string
          description: >-
            Collateral derived from borrowAmount + targetLtv, in human-readable
            units of the collateral token (post-fee). Present only when a supply
            action is called in borrow-derived mode.
          example: '0.0125'
      required:
        - currentHealthFactor
        - predictedHealthFactor
        - currentLtv
        - predictedLtv
        - liquidationThreshold
        - predictedTotalSupplyUsd
        - predictedTotalDebtUsd
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.