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

# Create strategy

> Creates a new lending strategy, deposits the initial principal amount, and may return multiple transactions when lookup-table setup or external yield account initialization is required.



## OpenAPI

````yaml post /markets/strategy/create
openapi: 3.1.0
info:
  title: Loopscale API
  version: 0.1.0
servers:
  - url: https://tars.loopscale.com/v1
    description: Loopscale Production Server
security: []
paths:
  /markets/strategy/create:
    post:
      tags:
        - strategy
      summary: Create strategy
      description: >-
        Creates a new lending strategy, deposits the initial principal amount,
        and may return multiple transactions when lookup-table setup or external
        yield account initialization is required.
      operationId: query_create_strategy
      parameters:
        - name: Idempotent-Key
          in: header
          description: >-
            Optional idempotency key; a retried write with the same key replays
            the original response
          required: false
          schema:
            type:
              - string
              - 'null'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TxnCreateStrategyParams'
        required: true
      responses:
        '200':
          description: >-
            One or more serialized transactions needed to create and fund the
            strategy.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/VersionedTransactionReturn'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Idempotency-Key reused with a different request body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    TxnCreateStrategyParams:
      type: object
      required:
        - principalMint
        - lender
        - amount
      properties:
        amount:
          type: integer
          format: int64
          minimum: 0
        collateralTerms:
          type: array
          items:
            $ref: '#/components/schemas/MultiCollateralTermsUpdateParamsSchema'
        externalYieldSourceArgs:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TxnExternalYieldSourceArgs'
        interestFee:
          type: integer
          format: int64
          minimum: 0
        lender:
          type: string
        liquidityBuffer:
          type: integer
          format: int64
          minimum: 0
        marketInformation:
          type:
            - string
            - 'null'
        originationCap:
          type: integer
          format: int64
          minimum: 0
        originationFee:
          type: integer
          format: int64
          minimum: 0
        originationsEnabled:
          type: boolean
        principalMint:
          type: string
    VersionedTransactionReturn:
      type: object
      description: versioned txn return
      required:
        - message
        - signatures
      properties:
        message:
          type: string
          description: serialized message
        signatures:
          type: array
          items:
            $ref: '#/components/schemas/VersionedTransactionSignature'
          description: serialized signatures
    ErrorResponse:
      type: object
      description: |-
        Canonical error envelope for every endpoint. The `x-request-id` response
        header carries the correlation id for the failing request.
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetails'
          description: error detail
    MultiCollateralTermsUpdateParamsSchema:
      type: object
      description: |-
        One APY applied across a set of (collateral, duration) slots
        (`update_multi_collateral_terms`).
      required:
        - apy
        - indices
      properties:
        apy:
          type: integer
          format: int64
          description: APY in basis points of a hundredth (cbps).
          minimum: 0
        indices:
          type: array
          items:
            $ref: '#/components/schemas/CollateralTermsIndicesSchema'
          description: (collateral, duration) slots this APY applies to.
    TxnExternalYieldSourceArgs:
      type: object
      required:
        - newExternalYieldSource
        - createExternalYieldAccount
      properties:
        createExternalYieldAccount:
          type: boolean
        newExternalYieldSource:
          type: integer
          format: int32
          minimum: 0
    VersionedTransactionSignature:
      type: object
      description: versioned txn return
      required:
        - publicKey
        - signature
      properties:
        publicKey:
          type: string
          description: serialized message
        signature:
          type: string
          description: serialized signatures
    ErrorDetails:
      type: object
      description: Inner detail of the [`ErrorResponse`] envelope.
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
          description: HTTP status code, mirrored in the response status line
          example: 400
          minimum: 0
        message:
          type: string
          description: human-readable, client-safe message (sensitive data redacted)
          example: Request could not be processed.
    CollateralTermsIndicesSchema:
      type: object
      description: A single (collateral, duration) slot the strategy offers terms for.
      required:
        - collateralIndex
        - durationIndex
      properties:
        collateralIndex:
          type: integer
          format: int32
          description: Index into the market's collateral map.
          minimum: 0
        durationIndex:
          type: integer
          format: int32
          description: Index into the strategy's offered durations.
          minimum: 0

````