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

# User Orders

> Private order created/updated notifications for the authenticated user on the margin exchange.

Requirements:
- authenticated connection
- market specification optional via `market_tickers`
- supports `update_subscription` with `add_markets` and `delete_markets`




## AsyncAPI

````yaml perps_asyncapi.yaml user_orders
id: user_orders
title: User Orders
description: >
  Private order created/updated notifications for the authenticated user on the
  margin exchange.


  Requirements:

  - authenticated connection

  - market specification optional via `market_tickers`

  - supports `update_subscription` with `add_markets` and `delete_markets`
servers:
  - id: production
    protocol: wss
    host: external-api-margin-ws.kalshi.com
    bindings: []
    variables: []
  - id: demo
    protocol: wss
    host: external-api-margin-ws.demo.kalshi.co
    bindings: []
    variables: []
address: user_orders
parameters: []
bindings: []
operations:
  - &ref_1
    id: receiveUserOrder
    title: User Order Update
    type: send
    messages:
      - &ref_2
        id: userOrder
        contentType: application/json
        payload:
          - name: User Order Update
            description: Private margin order create/update notifications
            type: object
            properties:
              - name: type
                type: string
                description: user_order
                required: true
              - name: sid
                type: integer
                description: >-
                  Server-generated subscription identifier (sid) used to
                  identify the channel
                required: true
              - name: msg
                type: object
                required: true
                properties:
                  - name: order_id
                    type: string
                    required: true
                  - name: user_id
                    type: string
                    required: true
                  - name: client_order_id
                    type: string
                    required: true
                  - name: ticker
                    type: string
                    description: Unique market identifier
                    required: true
                  - name: side
                    type: string
                    enumValues:
                      - bid
                      - ask
                    required: true
                  - name: price
                    type: string
                    required: true
                  - name: fill_count
                    type: string
                    required: true
                  - name: remaining_count
                    type: string
                    required: true
                  - name: self_trade_prevention_type
                    type: string
                    description: Self-trade prevention type
                    enumValues:
                      - taker_at_cross
                      - maker
                    required: false
                  - name: order_group_id
                    type: string
                    description: >-
                      Order group identifier, if the order belongs to an order
                      group
                    required: false
                  - name: expiration_ts_ms
                    type: integer
                    description: Unix timestamp in milliseconds.
                    required: false
                  - name: created_ts_ms
                    type: &ref_0
                      - integer
                      - 'null'
                    description: Unix timestamp in milliseconds.
                    required: true
                  - name: last_updated_ts_ms
                    type: integer
                    description: Unix timestamp in milliseconds.
                    required: false
                  - name: last_update_reason
                    type: string
                    description: >-
                      Margin order update reason. The value ReduceOnlyCancel
                      means reduce_only capped the order at placement. The field
                      is omitted when no reason applies.
                    enumValues:
                      - Decrease
                      - Amend
                      - MarginCancel
                      - SelfTradeCancel
                      - ExpiryCancel
                      - CloseCancel
                      - HaltCancel
                      - Trade
                      - PostOnlyCrossCancel
                      - ReduceOnlyCancel
                    required: false
                  - name: subaccount_number
                    type: integer
                    required: false
                  - name: order_source
                    type: string
                    description: |
                      `system` for liquidations and margin exit or trailing-stop
                      triggers. `user` for every other order.
                    enumValues:
                      - user
                      - system
                    required: true
              - name: sending_ts_ms
                type: integer
                description: >-
                  Unix timestamp in milliseconds when Kalshi queued this message
                  at the network layer.
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - sid
            - msg
          properties:
            type:
              type: string
              const: user_order
              x-parser-schema-id: <anonymous-schema-109>
            sid:
              type: integer
              description: >-
                Server-generated subscription identifier (sid) used to identify
                the channel
              minimum: 1
              x-parser-schema-id: subscriptionId
            msg:
              type: object
              required:
                - order_id
                - user_id
                - client_order_id
                - ticker
                - side
                - price
                - fill_count
                - remaining_count
                - created_ts_ms
                - order_source
              properties:
                order_id:
                  type: string
                  format: uuid
                  x-parser-schema-id: <anonymous-schema-111>
                user_id:
                  type: string
                  format: uuid
                  x-parser-schema-id: <anonymous-schema-112>
                client_order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-113>
                ticker:
                  type: string
                  description: Unique market identifier
                  x-parser-schema-id: marketTicker
                side:
                  type: string
                  enum:
                    - bid
                    - ask
                  x-parser-schema-id: bookSide
                price:
                  type: string
                  x-rust-type: common::types::Price
                  x-rust-serialize-with: ws::dto::serde_money::serialize_price_dollars
                  x-parser-schema-id: <anonymous-schema-114>
                fill_count:
                  type: string
                  x-rust-type: common::types::Amount
                  x-rust-serialize-with: ws::dto::serde_money::serialize_amount_fixed_point_count
                  x-parser-schema-id: <anonymous-schema-115>
                remaining_count:
                  type: string
                  x-rust-type: common::types::Amount
                  x-rust-serialize-with: ws::dto::serde_money::serialize_amount_fixed_point_count
                  x-parser-schema-id: <anonymous-schema-116>
                self_trade_prevention_type:
                  type: string
                  enum:
                    - taker_at_cross
                    - maker
                  description: Self-trade prevention type
                  x-parser-schema-id: selfTradePreventionType
                order_group_id:
                  type: string
                  description: >-
                    Order group identifier, if the order belongs to an order
                    group
                  x-parser-schema-id: <anonymous-schema-117>
                expiration_ts_ms:
                  type: integer
                  format: int64
                  description: Unix timestamp in milliseconds.
                  x-parser-schema-id: <anonymous-schema-118>
                created_ts_ms:
                  type: *ref_0
                  format: int64
                  description: Unix timestamp in milliseconds.
                  x-parser-schema-id: <anonymous-schema-119>
                last_updated_ts_ms:
                  type: integer
                  format: int64
                  description: Unix timestamp in milliseconds.
                  x-parser-schema-id: <anonymous-schema-120>
                last_update_reason:
                  type: string
                  enum:
                    - Decrease
                    - Amend
                    - MarginCancel
                    - SelfTradeCancel
                    - ExpiryCancel
                    - CloseCancel
                    - HaltCancel
                    - Trade
                    - PostOnlyCrossCancel
                    - ReduceOnlyCancel
                  description: >-
                    Margin order update reason. The value ReduceOnlyCancel means
                    reduce_only capped the order at placement. The field is
                    omitted when no reason applies.
                  x-parser-schema-id: lastUpdateReason
                subaccount_number:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-121>
                order_source:
                  type: string
                  enum:
                    - user
                    - system
                  description: |
                    `system` for liquidations and margin exit or trailing-stop
                    triggers. `user` for every other order.
                  x-parser-schema-id: <anonymous-schema-122>
              x-parser-schema-id: <anonymous-schema-110>
            sending_ts_ms:
              type: integer
              format: int64
              description: >-
                Unix timestamp in milliseconds when Kalshi queued this message
                at the network layer.
              x-parser-schema-id: sendingTimestampMs
          x-parser-schema-id: marginUserOrderPayload
        title: User Order Update
        description: Private margin order create/update notifications
        example: |-
          {
            "type": "<string>",
            "sid": 123,
            "msg": {
              "order_id": "<string>",
              "user_id": "<string>",
              "client_order_id": "<string>",
              "ticker": "<string>",
              "side": "<string>",
              "price": "<string>",
              "fill_count": "<string>",
              "remaining_count": "<string>",
              "self_trade_prevention_type": "<string>",
              "order_group_id": "<string>",
              "expiration_ts_ms": 123,
              "last_updated_ts_ms": 123,
              "last_update_reason": "<string>",
              "subaccount_number": 123,
              "order_source": "<string>"
            },
            "sending_ts_ms": 123
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: userOrder
    bindings: []
    extensions:
      - id: x-parser-unique-object-id
        value: user_orders
sendOperations: []
receiveOperations:
  - *ref_1
sendMessages: []
receiveMessages:
  - *ref_2
extensions:
  - id: x-parser-unique-object-id
    value: user_orders
securitySchemes:
  - id: apiKey
    name: apiKey
    type: apiKey
    description: API key authentication required for margin WebSocket connections.
    in: user
    extensions: []

````

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