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

# Execute a borrow action

> 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).

This is a proxy to the Yield.xyz Borrow `POST /v1/actions` endpoint. Portal validates the upstream response against the schema documented here before returning it under `data`, and translates `network` values to CAIP-2. If Yield.xyz changes the response shape, Portal returns a 500 with `id: INTEGRATION_RESPONSE_SCHEMA_DRIFT` instead of a partial response. Upstream reference: [docs.yield.xyz](https://docs.yield.xyz/reference/actionscontroller_executeaction_v1).



## OpenAPI

````yaml /openapi/client-api.yaml post /clients/me/integrations/yield-xyz-borrow/actions
openapi: 3.1.0
info:
  title: Portal Client API
  version: '3.0'
  description: >
    The Portal Client API provides endpoints for managing wallets, building
    transactions,

    and interacting with blockchain networks. All endpoints require
    authentication via a

    Client API Key or Client Session Token (CST) passed as a Bearer token.


    ## Base URL

    `https://api.portalhq.io/api/v3`


    ## Authentication

    Include your Client API Key or Client Session Token as a Bearer token in the

    `Authorization` header of every request.


    ## Chain ID Format

    Chain parameters use either friendly names (e.g. `ethereum`, `solana`) or
    CAIP-2 format

    (e.g. `eip155:1`, `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`). When using
    CAIP-2 format

    in URLs, ensure the colon is URI-encoded (`%3A`).
servers:
  - url: https://api.portalhq.io/api/v3
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Clients
    description: Core client management endpoints
  - name: Wallet
    description: >-
      Read wallet state — balances, NFTs, transaction history, capabilities, and
      transaction details
  - name: Transactions
    description: Build, broadcast, and evaluate blockchain transactions
  - name: Funding
    description: Fund wallets with testnet tokens
  - name: Wallet Shares
    description: Manage signing and backup share pairs
  - name: Delegations
    description: Manage token approvals, revocations, and delegated transfers
  - name: Session Keys
    description: Manage EIP-7702 session keys for smart accounts
  - name: 0x
    description: Token swap endpoints powered by the 0x protocol
  - name: Yield.xyz
    description: Yield opportunities and staking actions powered by Yield.xyz
  - name: Yield.xyz Borrow
    description: >-
      Supply collateral, borrow, repay and withdraw from lending markets (Aave
      V3, Morpho Blue, SparkLend, Lista) powered by Yield.xyz Borrow
  - name: Li.Fi
    description: Cross-chain swaps and bridging powered by Li.Fi
  - name: Blockaid
    description: Transaction and address security scanning powered by Blockaid
  - name: Hypernative
    description: >-
      Transaction, address, token, and NFT security scanning powered by
      Hypernative
  - name: Noah
    description: KYC onboarding, payins, and payouts powered by Noah
  - name: Meld
    description: Buy and sell crypto with fiat through aggregated providers powered by Meld
  - name: Due
    description: Payins, payouts, virtual accounts, and FX powered by Due
  - name: EIP-7702
    description: EIP-7702 account type detection and authorization management
  - name: Deprecated
    description: >-
      Legacy endpoints scheduled for removal. Use the newer equivalents listed
      in each endpoint's description.
paths:
  /clients/me/integrations/yield-xyz-borrow/actions:
    post:
      tags:
        - Yield.xyz Borrow
      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).


        This is a proxy to the Yield.xyz Borrow `POST /v1/actions` endpoint.
        Portal validates the upstream response against the schema documented
        here before returning it under `data`, and translates `network` values
        to CAIP-2. If Yield.xyz changes the response shape, Portal returns a 500
        with `id: INTEGRATION_RESPONSE_SCHEMA_DRIFT` instead of a partial
        response. Upstream reference:
        [docs.yield.xyz](https://docs.yield.xyz/reference/actionscontroller_executeaction_v1).
      operationId: executeYieldXyzBorrowAction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/YieldXyzBorrowActionRequest'
      responses:
        '200':
          description: Action created with unsigned transactions ready for signing
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YieldXyzBorrowActionResponse'
        '400':
          description: >-
            Invalid request (a field failed validation, or `network` is not a
            chain Portal supports). Also returned when Yield.xyz Borrow rejects
            the request or the configured API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Yield.xyz Borrow rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Yield.xyz Borrow returned a response that does not match the schema
            Portal expects (`id: INTEGRATION_RESPONSE_SCHEMA_DRIFT`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntegrationSchemaDriftErrorResponse'
        '503':
          description: Yield.xyz Borrow is unreachable or returned an upstream error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    YieldXyzBorrowActionRequest:
      type: object
      required:
        - integrationId
        - action
        - address
        - args
      properties:
        integrationId:
          type: string
          description: Integration identifier
          example: aave-borrow
        action:
          type: string
          description: Action to execute
          example: supply
          enum:
            - supply
            - borrow
            - repay
            - withdraw
            - enableCollateral
            - disableCollateral
            - supplyAndBorrow
        address:
          type: string
          description: User wallet address
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f8fB28'
        args:
          $ref: '#/components/schemas/YieldXyzBorrowArguments'
    YieldXyzBorrowActionResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/YieldXyzBorrowAction'
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
    IntegrationSchemaDriftErrorResponse:
      type: object
      description: >-
        Returned (HTTP 500) when a third-party response no longer matches the
        schema Portal proxies for it. The `id` is stable: SDKs should key off it
        and fail gracefully. Portal is alerted automatically and fixes the
        mapping server-side.
      required:
        - error
        - id
        - details
      properties:
        error:
          type: string
          example: >-
            yield-xyz-borrow returned a response for GET /v1/positions that does
            not match the expected schema
        id:
          type: string
          enum:
            - INTEGRATION_RESPONSE_SCHEMA_DRIFT
        details:
          type: object
          required:
            - integration
            - endpoint
            - issues
          properties:
            integration:
              type: string
              example: yield-xyz-borrow
            endpoint:
              type: string
              description: The upstream vendor endpoint whose response drifted.
              example: GET /v1/positions
            issues:
              type: array
              items:
                type: object
                required:
                  - path
                  - message
                  - code
                properties:
                  path:
                    type: string
                    description: Dotted path of the offending field in the vendor response.
                    example: supplyBalances.0.balanceUsd
                  message:
                    type: string
                    example: Expected string, received number
                  code:
                    type: string
                    example: invalid_type
    YieldXyzBorrowArguments:
      type: object
      required:
        - marketId
      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. Required for `supply`
            and `withdraw` on pool-based protocols (Aave): the market's
            `loanToken.address`, or one of `collateralTokens[].token.address`.
            Isolated-market protocols (Morpho Blue) infer it from `marketId`.
          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
      description: >-
        Action arguments. `marketId` is always required; the other fields depend
        on the action (see the integration's `actions[].schema`).
    YieldXyzBorrowAction:
      type: object
      required:
        - id
        - integrationId
        - action
        - address
        - status
        - transactions
        - hasNextStep
        - currentStep
        - totalSteps
        - createdAt
      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 Known values: `supply`, `borrow`, `repay`,
            `withdraw`, `enableCollateral`, `disableCollateral`,
            `supplyAndBorrow`. Treat unknown values as opaque.
          example: supply
        address:
          type: string
          description: User wallet address
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f8fB28'
        status:
          type: string
          description: >-
            Current action status Known values: `CANCELED`, `CREATED`,
            `WAITING_FOR_NEXT`, `PROCESSING`, `FAILED`, `SUCCESS`, `STALE`.
            Treat unknown values as opaque.
          example: CREATED
        transactions:
          description: >-
            Transactions of the current step. On the `POST /actions` response
            the array order is the signing order (e.g. `APPROVAL` before
            `SUPPLY`); sign and submit them one at a time, waiting for each to
            confirm. Later `GET /actions/{id}` responses may list them in a
            different order.
          type: array
          items:
            $ref: '#/components/schemas/YieldXyzBorrowTransaction'
        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/YieldXyzBorrowArguments'
          nullable: true
        metadata:
          description: >-
            Action metadata with predicted position impact (health factor, LTV,
            USD totals)
          allOf:
            - $ref: '#/components/schemas/YieldXyzBorrowActionMetadata'
          nullable: true
        createdAt:
          format: date-time
          type: string
          description: When the action was created
    YieldXyzBorrowTransaction:
      type: object
      required:
        - id
        - network
        - type
        - status
        - address
      properties:
        id:
          type: string
          description: Transaction ID (UUID)
          example: 550e8400-e29b-41d4-a716-446655440000
        network:
          type: string
          description: >-
            Network identifier in CAIP-2 format (e.g. `eip155:1`). Chains Portal
            does not support are returned with the Yield.xyz network name
            unchanged.
          example: eip155:1
        type:
          type: string
          description: >-
            Transaction type Known values: `APPROVAL`, `AUTHORIZE`,
            `DEAUTHORIZE`, `SUPPLY`, `BORROW`, `REPAY`, `WITHDRAW`,
            `ENABLE_COLLATERAL`, `DISABLE_COLLATERAL`, `BUNDLE`. Treat unknown
            values as opaque.
          example: SUPPLY
        status:
          type: string
          description: >-
            Current transaction status Known values: `NOT_FOUND`, `CREATED`,
            `BLOCKED`, `WAITING_FOR_SIGNATURE`, `SIGNED`, `BROADCASTED`,
            `PENDING`, `CONFIRMED`, `FAILED`, `SKIPPED`. Treat unknown values as
            opaque.
          example: CREATED
        address:
          type: string
          description: User address
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f8fB28'
        signingFormat:
          type: string
          description: >-
            Signing format required Known values: `EVM_TRANSACTION`,
            `EIP712_TYPED_DATA`, `SOLANA_TRANSACTION`, `COSMOS_TRANSACTION`.
            Treat unknown values as opaque.
          example: EVM_TRANSACTION
          nullable: true
        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..."}
          nullable: true
    YieldXyzBorrowActionMetadata:
      type: object
      required:
        - currentHealthFactor
        - predictedHealthFactor
        - currentLtv
        - predictedLtv
        - liquidationThreshold
        - predictedTotalSupplyUsd
        - predictedTotalDebtUsd
      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
          nullable: true
        originationFeeAmount:
          type: string
          description: >-
            Origination fee amount in borrowed-token units when a borrow wrapper
            is applied
          example: '1.00'
          nullable: true
        effectivePrincipalAmount:
          type: string
          description: >-
            Actual principal recorded onchain in borrowed-token units when a
            borrow wrapper is applied
          example: '101.00'
          nullable: true
        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'
          nullable: true
        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
          nullable: true
        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'
          nullable: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Client API Key or Client Session Token (CST). Pass as a Bearer token in
        the

        Authorization header.

````