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

# Create an order template

> Body limit is 64 KiB.

<Note>Preview contract. Production availability remains subject to activation and release qualification. Examples are synthetic; the documentation cannot submit requests.</Note>

## Authorization

`templates:write`; account template authority.

## Behavior

Body limit is 64 KiB. The full codec requires identity/timestamp fields; creation replaces them with server-owned values and binds ownership to the authenticated account. No trading receipt or order execution occurs. After an ambiguous response, inspect the template list before explicitly retrying.

## JSON body example

The following shows the request shape, not live credentials or executable market defaults. Replace timestamps only when creating a new reviewed intent; never mutate them on a command retry.

```json theme={null}
{
  "id": "44444444-4444-4444-8444-444444444444",
  "user_id": 0,
  "name": "Illustrative derivative limit",
  "instrument_type": 2,
  "position_side": 1,
  "margin_mode": 1,
  "leverage": 2,
  "order_grid_enabled": false,
  "open_price_deltas": [],
  "open_quantity_percent": [
    1000000
  ],
  "sl_enabled": false,
  "sl_price_rearrangement": false,
  "slx_enabled": false,
  "slx_tp_trailing_enabled": false,
  "slx_each_tp_trailing": false,
  "slx_sl_trailing_breakeven_enabled": false,
  "slx_sl_trigger_price_trailing_enabled": false,
  "tp_enabled": false,
  "tp_price_rearrangement": false,
  "tp_grid_enabled": false,
  "tp_pnls": [],
  "tp_quantity_percent": [],
  "open_order_type": 1,
  "sl_order_type": 2,
  "tp_order_type": 1,
  "created_at": 0,
  "updated_at": 0
}
```

## Response and errors

The generated response schema below is the wire contract. Preserve fixed-point strings, nullable fields and endpoint-specific envelopes. Inspect HTTP status and Content-Type before decoding failures; reused trading routes may return JSON or plain text. Authentication, entitlement and exact link/instrument restrictions apply in addition to endpoint validation. See [errors and recovery](/api/errors-and-limits).

Do not automatically repeat a mutation after transport ambiguity. Trading commands reuse the exact immutable identity; credential issuance and template writes require their documented metadata/read reconciliation.

Read the [related guide](/api/templates-and-history) for lifecycle, units and recovery semantics.


## OpenAPI

````yaml api/openapi.json POST /v1/templates/create
openapi: 3.1.0
info:
  title: Liftx integrations
  version: 1.0.0
  description: >-
    Preview contract for the Liftx API, TradingView webhook and session-owned
    integration settings. Production availability is pending activation and
    release qualification. External access requires Pro or trial entitlement and
    is unmetered within bounded resource limits. Receipt acceptance does not
    confirm execution completion. MCP is not active.
servers:
  - url: https://api.liftx.io
security: []
paths:
  /v1/templates/create:
    post:
      summary: Canonical template create
      operationId: post_v1_templates_create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderTemplate'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderTemplate'
              examples:
                synthetic:
                  summary: Synthetic success response
                  description: >-
                    Synthetic documentation data, not an account snapshot,
                    executable market configuration or production-availability
                    assertion. IDs, quantities, prices, times and values are
                    illustrative.
                  value:
                    id: 44444444-4444-4444-8444-444444444444
                    user_id: 1
                    name: Illustrative derivative limit
                    instrument_type: 2
                    position_side: 1
                    margin_mode: 1
                    leverage: 2
                    order_grid_enabled: false
                    open_price_deltas: []
                    open_quantity_percent:
                      - 1000000
                    sl_enabled: false
                    sl_price_rearrangement: false
                    slx_enabled: false
                    slx_tp_trailing_enabled: false
                    slx_each_tp_trailing: false
                    slx_sl_trailing_breakeven_enabled: false
                    slx_sl_trigger_price_trailing_enabled: false
                    tp_enabled: false
                    tp_price_rearrangement: false
                    tp_grid_enabled: false
                    tp_pnls: []
                    tp_quantity_percent: []
                    open_order_type: 1
                    sl_order_type: 2
                    tp_order_type: 1
                    created_at: 1893456000
                    updated_at: 1893456000
        default:
          description: >-
            Integration errors use Error; existing trading handlers retain their
            own JSON or text/plain error codec. Inspect status and content type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            text/plain:
              schema:
                type: string
      security:
        - ApiKey: []
components:
  schemas:
    OrderTemplate:
      type: object
      properties:
        id:
          type: string
          format: uuid
        user_id:
          type: integer
          format: int64
        name:
          type: string
        instrument_type:
          type: integer
          format: int64
        position_side:
          type: integer
          format: int64
        margin_mode:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        leverage:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        order_grid_enabled:
          type: boolean
        num_open_orders:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        open_orders_step:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        open_orders_factor:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        open_price_deltas:
          type: array
          items:
            type: integer
            format: int64
        open_quantity_percent:
          type: array
          items:
            type: integer
            format: int64
        sl_enabled:
          type: boolean
        sl_type:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        sl_step_percent:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        sl_price_rearrangement:
          type: boolean
        slx_enabled:
          type: boolean
        slx_tp_trailing_enabled:
          type: boolean
        slx_tp_breakeven:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        slx_each_tp_trailing:
          type: boolean
        slx_sl_trailing_breakeven_enabled:
          type: boolean
        slx_sl_trailing_breakeven_indent_percent:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        slx_sl_trigger_price_trailing_enabled:
          type: boolean
        slx_sl_trigger_price_trailing_pl_percent_activation:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        slx_sl_trigger_price_trailing_indent_percent:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        slx_sl_trigger_price_trailing_step:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        tp_enabled:
          type: boolean
        tp_price_rearrangement:
          type: boolean
        tp_grid_enabled:
          type: boolean
        num_tp_orders:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        tp_orders_step:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        tp_orders_factor:
          anyOf:
            - type: integer
              format: int64
            - type: 'null'
        tp_pnls:
          type: array
          items:
            type: integer
            format: int64
        tp_quantity_percent:
          type: array
          items:
            type: integer
            format: int64
        open_order_type:
          type: integer
          format: int64
        sl_order_type:
          type: integer
          format: int64
        tp_order_type:
          type: integer
          format: int64
        created_at:
          type: integer
          format: int64
        updated_at:
          type: integer
          format: int64
      required:
        - id
        - user_id
        - name
        - instrument_type
        - position_side
        - order_grid_enabled
        - open_price_deltas
        - open_quantity_percent
        - sl_enabled
        - sl_price_rearrangement
        - slx_enabled
        - slx_tp_trailing_enabled
        - slx_each_tp_trailing
        - slx_sl_trailing_breakeven_enabled
        - slx_sl_trigger_price_trailing_enabled
        - tp_enabled
        - tp_price_rearrangement
        - tp_grid_enabled
        - tp_pnls
        - tp_quantity_percent
        - open_order_type
        - sl_order_type
        - tp_order_type
        - created_at
        - updated_at
      additionalProperties: false
    Error:
      type: object
      properties:
        success:
          const: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
          additionalProperties: false
      required:
        - success
        - error
      additionalProperties: false
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: lx_api_<credential UUID>.<256-bit secret>

````

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