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

# Create Long Position

> Open a long position with specified margin and leverage

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.strike.markets/long" \
    -H "X-API-Key: stk_your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "margin": "100.0",
      "leverage": 10,
      "symbol": "BTC-USD"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "message": "Long position created successfully",
    "txHash": "0x1234567890abcdef1234567890abcdef12345678",
    "gasUsed": 180000,
    "positionId": 12345,
    "symbol": "BTC-USD",
    "szi": "0.002217",
    "margin": "100.0",
    "entryPrice": "45123.50",
    "liquidationPrice": "41234.15",
    "status": "open",
    "createdAt": "2024-01-15T14:30:00Z",
    "spread": "5.25"
  }
  ```
</ResponseExample>

## Overview

Create a long position with specified margin and leverage. Profits when price increases.

**Authentication required**: API key

## Request Body

<ParamField body="margin" type="string" required>
  Margin amount in USD. Must be a positive number as a string.

  **Minimum**: 1 USD equivalent\
  **Example**: "100.0"
</ParamField>

<ParamField body="leverage" type="integer" required>
  Leverage multiplier for the position.

  **Range**: 1 to 1000\
  **Example**: 10
</ParamField>

<ParamField body="symbol" type="string" required>
  Trading pair symbol.

  **Supported values**: "BTC-USD", "ETH-USD", "SOL-USD", "BNB-USD", "XRP-USD", "HYPE-USD"
  **Example**: "BTC-USD"
</ParamField>

## Response Fields

<ResponseField name="success" type="boolean">
  Indicates if the position was created successfully
</ResponseField>

<ResponseField name="message" type="string">
  Success message describing the operation
</ResponseField>

<ResponseField name="txHash" type="string">
  Blockchain transaction hash for the position creation
</ResponseField>

<ResponseField name="gasUsed" type="integer">
  Amount of gas consumed for the transaction
</ResponseField>

<ResponseField name="szi" type="string">
  Position size in base asset units (positive for long, negative for short)
</ResponseField>

<ResponseField name="leverage" type="integer">
  Leverage multiplier applied to the position
</ResponseField>

<ResponseField name="side" type="string">
  Position direction - "LONG" for long positions
</ResponseField>

<ResponseField name="positionId" type="integer">
  Unique identifier for the created position
</ResponseField>

<ResponseField name="liquidation_price" type="string">
  Price at which the position will be liquidated
</ResponseField>

<ResponseField name="position" type="object">
  Complete position object with detailed information:

  * `id`: Position ID
  * `wallet_address`: Owner's wallet address
  * `symbol`: Trading pair symbol
  * `szi`: Position size in base asset units
  * `margin`: Margin amount used
  * `entry_price`: Entry price
  * `liquidation_price`: Liquidation price
  * `status`: Position status ("open")
  * `created_at`: ISO timestamp
  * `leverage`: Calculated leverage
  * `position_value`: Total position value
</ResponseField>

## Error Responses

<ResponseField name="400 Bad Request" type="object">
  Invalid request parameters or insufficient balance

  ```json theme={null}
  {
    "error": 400,
    "message": "Insufficient balance for margin requirement"
  }
  ```
</ResponseField>

<ResponseField name="401 Unauthorized" type="object">
  Missing or invalid authentication token

  ```json theme={null}
  {
    "error": 401,
    "message": "Authorization header missing"
  }
  ```
</ResponseField>

<ResponseField name="429 Too Many Requests" type="object">
  Rate limit exceeded (10 requests per minute for trading endpoints)

  ```json theme={null}
  {
    "error": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded. Please wait 45 seconds.",
    "retry_after": 45
  }
  ```
</ResponseField>

## Next Steps

After creating a long position:

1. **Monitor Position** - Use [Get Positions](/api-reference/positions/get-positions) to track your position
2. **Check Dashboard** - View comprehensive data with [Dashboard](/api-reference/account/dashboard)
3. **Close Position** - Manually close with [Close Position](/api-reference/trading/close)
4. **Emergency Exit** - Use [Emergency Exit](/api-reference/trading/emergency-exit) if needed

<Tip>
  Long positions are suitable when you expect the asset price to increase. Consider market conditions, volatility, and your risk tolerance when choosing leverage levels.
</Tip>


## OpenAPI

````yaml POST /long
openapi: 3.1.0
info:
  title: Strike Protocol API
  description: >-
    Strike Protocol is a perpetual futures trading platform that allows users to
    trade with leverage (1-1000x) on various crypto assets. This API provides
    access to trading operations, account management, market data, analytics,
    and user systems.
  version: 1.0.0
  contact:
    name: Strike Protocol
    url: https://strike.markets
  license:
    name: MIT
servers:
  - url: https://api.strike.markets
    description: Production server
security:
  - apiKeyAuth: []
paths:
  /long:
    post:
      summary: Create Long Position
      description: Open a long position with specified margin and leverage
      operationId: createLongPosition
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LongPositionRequest'
      responses:
        '200':
          description: Position created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradeResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized - Invalid or missing authentication token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    LongPositionRequest:
      type: object
      required:
        - margin
        - leverage
        - symbol
      properties:
        margin:
          type: string
          description: Margin amount in USD
        leverage:
          type: integer
          minimum: 1
          maximum: 1000
          description: Leverage multiplier (1-1000)
        symbol:
          type: string
          description: Market symbol (e.g., BTC-USD)
    TradeResponse:
      type: object
      properties:
        success:
          type: boolean
        positionId:
          type: integer
        txHash:
          type: string
        margin:
          type: string
        leverage:
          type: integer
        size:
          type: string
        entryPrice:
          type: string
        liquidationPrice:
          type: string
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Strike Protocol API key authentication

````