{
  "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"
    }
  ],
  "paths": {
    "/v1/discovery": {
      "get": {
        "operationId": "get_v1_discovery",
        "summary": "Discover API actions, scopes and bounds",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "const": "v1"
                    },
                    "command_actions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "request_bytes": {
                          "type": "integer",
                          "format": "int64"
                        },
                        "pending_per_user": {
                          "type": "integer",
                          "format": "int64"
                        },
                        "command_lifetime_seconds": {
                          "type": "integer",
                          "format": "int64"
                        },
                        "receipt_retention_days": {
                          "type": "integer",
                          "format": "int64"
                        },
                        "group_targets": {
                          "type": "integer",
                          "const": 64
                        }
                      },
                      "required": [
                        "group_targets"
                      ],
                      "additionalProperties": true
                    },
                    "mcp_available": {
                      "const": false
                    }
                  },
                  "required": [
                    "version",
                    "command_actions",
                    "scopes",
                    "limits",
                    "mcp_available"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "synthetic": {
                    "summary": "Actual published contract values; not activation evidence",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "version": "v1",
                      "command_actions": [
                        "open",
                        "modify",
                        "terminate"
                      ],
                      "scopes": [
                        "read",
                        "positions:open",
                        "positions:modify",
                        "positions:terminate",
                        "templates:write"
                      ],
                      "limits": {
                        "request_bytes": 262144,
                        "pending_per_user": 64,
                        "group_targets": 64,
                        "command_lifetime_seconds": 300,
                        "receipt_retention_days": 30
                      },
                      "mcp_available": false
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": ""
      }
    },
    "/v1/exchange-links": {
      "get": {
        "operationId": "get_v1_exchange_links",
        "summary": "List exact authorized linked accounts",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "exchange_links": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "exchange_id": {
                            "type": "integer",
                            "format": "int64"
                          },
                          "environment": {
                            "type": "string",
                            "enum": [
                              "live",
                              "demo"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "exchange_id",
                          "environment"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "exchange_links"
                  ],
                  "additionalProperties": false
                },
                "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": {
                      "exchange_links": [
                        {
                          "id": 17,
                          "exchange_id": 1,
                          "environment": "demo"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read"
      }
    },
    "/v1/commands": {
      "post": {
        "operationId": "post_v1_commands",
        "summary": "Durably admit a trading command",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                },
                "examples": {
                  "open": {
                    "summary": "Synthetic OPEN receipt; new acceptance",
                    "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": "22222222-2222-4222-8222-222222222222",
                      "client_command_id": "demo-controller:cycle-001:open",
                      "action": "open",
                      "state": "accepted",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456000
                    }
                  },
                  "modify": {
                    "summary": "Synthetic MODIFY receipt; not execution completion",
                    "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": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
                      "client_command_id": "demo-controller:cycle-001:modify",
                      "action": "modify",
                      "state": "accepted",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456000
                    }
                  },
                  "terminate": {
                    "summary": "Synthetic TERMINATE receipt; not flatness confirmation",
                    "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": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
                      "client_command_id": "demo-controller:cycle-001:terminate",
                      "action": "terminate",
                      "state": "accepted",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "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"
                }
              }
            }
          },
          "200": {
            "description": "Identical existing command",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                },
                "examples": {
                  "open": {
                    "summary": "Synthetic OPEN receipt; identical retry",
                    "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": "22222222-2222-4222-8222-222222222222",
                      "client_command_id": "demo-controller:cycle-001:open",
                      "action": "open",
                      "state": "accepted",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456000
                    }
                  },
                  "modify": {
                    "summary": "Synthetic MODIFY receipt; not execution completion",
                    "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": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
                      "client_command_id": "demo-controller:cycle-001:modify",
                      "action": "modify",
                      "state": "accepted",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456000
                    }
                  },
                  "terminate": {
                    "summary": "Synthetic TERMINATE receipt; not flatness confirmation",
                    "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": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
                      "client_command_id": "demo-controller:cycle-001:terminate",
                      "action": "terminate",
                      "state": "accepted",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456000
                    }
                  }
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "action-specific positions permission",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Command"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_v1_commands",
        "summary": "List namespace command receipts",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptPage"
                },
                "examples": {
                  "page": {
                    "summary": "Synthetic top-level receipt page",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "commands": [
                        {
                          "id": "99999999-9999-4999-8999-999999999999",
                          "client_command_id": "signal-a:exit-001",
                          "action": "terminate",
                          "state": "partial",
                          "position_id": null,
                          "error_code": null,
                          "created_at": 1893456000,
                          "updated_at": 1893456060,
                          "group": {
                            "target": "strategy",
                            "target_count": 2,
                            "counts": {
                              "accepted": 0,
                              "dispatching": 0,
                              "execution_observed": 0,
                              "handed_off": 1,
                              "rejected": 0,
                              "expired": 1,
                              "operator_required": 0
                            }
                          }
                        },
                        {
                          "id": "22222222-2222-4222-8222-222222222222",
                          "client_command_id": "demo-controller:cycle-001:open",
                          "action": "open",
                          "state": "handed_off",
                          "position_id": "11111111-1111-4111-8111-111111111111",
                          "error_code": null,
                          "created_at": 1893456000,
                          "updated_at": 1893456001
                        }
                      ],
                      "next_cursor": null
                    }
                  },
                  "empty": {
                    "summary": "Synthetic empty receipt history",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "commands": [],
                      "next_cursor": null
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/v1/commands/get": {
      "get": {
        "operationId": "get_v1_commands_get",
        "summary": "Read an owned or same-account scoped receipt and bounded group detail",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                },
                "examples": {
                  "open_handed_off": {
                    "summary": "Synthetic OPEN owner evidence; not fill completion",
                    "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": "22222222-2222-4222-8222-222222222222",
                      "client_command_id": "demo-controller:cycle-001:open",
                      "action": "open",
                      "state": "handed_off",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456001
                    }
                  },
                  "modify_observed": {
                    "summary": "Synthetic MODIFY return; inspect current state",
                    "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": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
                      "client_command_id": "demo-controller:cycle-001:modify",
                      "action": "modify",
                      "state": "execution_observed",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456002
                    }
                  },
                  "termination_handed_off": {
                    "summary": "Synthetic durable close request; not proof of flatness",
                    "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": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
                      "client_command_id": "demo-controller:cycle-001:terminate",
                      "action": "terminate",
                      "state": "handed_off",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456003,
                      "terminal_request_kind": 1,
                      "terminal_request_seq": 1
                    }
                  },
                  "uncertain_modification": {
                    "summary": "Synthetic unresolved modification; operator reconciliation required",
                    "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": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
                      "client_command_id": "demo-controller:cycle-001:modify",
                      "action": "modify",
                      "state": "operator_required",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": "EXECUTION_UNCERTAIN",
                      "created_at": 1893456000,
                      "updated_at": 1893456002
                    }
                  },
                  "partial_group": {
                    "summary": "Synthetic two-target group with different resolved outcomes",
                    "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": "99999999-9999-4999-8999-999999999999",
                      "client_command_id": "signal-a:exit-001",
                      "action": "terminate",
                      "state": "partial",
                      "position_id": null,
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456060,
                      "group": {
                        "target": "strategy",
                        "target_count": 2,
                        "counts": {
                          "accepted": 0,
                          "dispatching": 0,
                          "execution_observed": 0,
                          "handed_off": 1,
                          "rejected": 0,
                          "expired": 1,
                          "operator_required": 0
                        }
                      },
                      "targets": [
                        {
                          "id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
                          "client_command_id": "liftx-group:99999999-9999-4999-8999-999999999999:11111111-1111-4111-8111-111111111111",
                          "action": "terminate",
                          "state": "handed_off",
                          "position_id": "11111111-1111-4111-8111-111111111111",
                          "error_code": null,
                          "created_at": 1893456000,
                          "updated_at": 1893456003,
                          "terminal_request_kind": 1,
                          "terminal_request_seq": 1,
                          "group_id": "99999999-9999-4999-8999-999999999999"
                        },
                        {
                          "id": "dddddddd-dddd-4ddd-8ddd-dddddddddddd",
                          "client_command_id": "liftx-group:99999999-9999-4999-8999-999999999999:cccccccc-cccc-4ccc-8ccc-cccccccccccc",
                          "action": "terminate",
                          "state": "expired",
                          "position_id": "cccccccc-cccc-4ccc-8ccc-cccccccccccc",
                          "error_code": "COMMAND_EXPIRED",
                          "created_at": 1893456000,
                          "updated_at": 1893456060,
                          "group_id": "99999999-9999-4999-8999-999999999999"
                        }
                      ]
                    }
                  },
                  "empty_group": {
                    "summary": "Synthetic zero-target capture; does not prove flatness",
                    "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": "99999999-9999-4999-8999-999999999999",
                      "client_command_id": "signal-a:exit-001",
                      "action": "terminate",
                      "state": "execution_observed",
                      "position_id": null,
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456060,
                      "group": {
                        "target": "strategy",
                        "target_count": 0,
                        "counts": {
                          "accepted": 0,
                          "dispatching": 0,
                          "execution_observed": 0,
                          "handed_off": 0,
                          "rejected": 0,
                          "expired": 0,
                          "operator_required": 0
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "Own namespace: none. Another namespace: read and exact authorized link/instrument on the same account.",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/v1/positions/list": {
      "get": {
        "operationId": "get_v1_positions_list",
        "summary": "Read exact-link canonical positions page",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PositionsPage"
                },
                "examples": {
                  "page": {
                    "summary": "Synthetic complete active page",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "status": "active",
                      "exchange_link_id": 17,
                      "offset": 0,
                      "limit": 50,
                      "has_more": false,
                      "positions": [
                        {
                          "id": "11111111-1111-4111-8111-111111111111",
                          "user_id": 1,
                          "status": 1,
                          "revision": 7,
                          "instrument_id": "COPY_EXACT_CATALOG_ID",
                          "instrument_type": 2,
                          "instrument_topology": 2,
                          "position_side": 1,
                          "base": "BTC",
                          "quote": "USDT",
                          "exchange_link_id": 17,
                          "margin_mode": 1,
                          "leverage": 2,
                          "order_grid_enabled": false,
                          "open_orders": [
                            {
                              "row_id": 1,
                              "created_at_ms": 1893456000000,
                              "price_atomic": "70000",
                              "price_scale": 0,
                              "quantity_atomic": "1",
                              "quantity_scale": 4,
                              "executed": [],
                              "projected_order_status": 1,
                              "order_fsm_state": 2,
                              "exchange_submitted": true,
                              "slot_id": "SYNTHETIC_CURRENT_OPEN_SLOT",
                              "order_id": "33333333-3333-4333-8333-333333333333"
                            }
                          ],
                          "open_order_type": 1,
                          "sl_enabled": false,
                          "slx_enabled": false,
                          "tp_enabled": false,
                          "position_fsm_state": 2,
                          "created_at": 1893456000,
                          "updated_at": 1893456000,
                          "tick_step_atomic": "1",
                          "tick_step_scale": 1,
                          "lot_step_base_atomic": "1",
                          "lot_step_base_scale": 4,
                          "min_size_base_atomic": "1",
                          "min_size_base_scale": 4,
                          "contract_value_atomic": "1",
                          "contract_value_scale": 2,
                          "funding_fee_quote_atomic": "0",
                          "funding_fee_quote_scale": 0,
                          "alloc_open_executed_atomic": "0",
                          "alloc_open_executed_scale": 0,
                          "alloc_close_executed_atomic": "0",
                          "alloc_close_executed_scale": 0,
                          "alloc_net_exposure_atomic": "0",
                          "alloc_net_exposure_scale": 0,
                          "executed_cost_quote_atomic": "0",
                          "executed_cost_quote_scale": 0,
                          "next_funding_fee_quote_atomic": "0",
                          "next_funding_fee_quote_scale": 0,
                          "next_funding_time": 0
                        }
                      ]
                    }
                  },
                  "empty": {
                    "summary": "Synthetic complete empty active page",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "status": "active",
                      "exchange_link_id": 17,
                      "offset": 0,
                      "limit": 50,
                      "has_more": false,
                      "positions": []
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "exchange_link_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "inactive"
              ],
              "default": "active"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ]
      }
    },
    "/v1/balances": {
      "get": {
        "operationId": "get_v1_balances",
        "summary": "Read exact-link available balances",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balances"
                },
                "examples": {
                  "complete": {
                    "summary": "Synthetic complete balance snapshot",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "exchange_link_id": 17,
                      "updates": [
                        {
                          "asset": "USDT",
                          "free_atomic": "100000",
                          "free_scale": 2
                        },
                        {
                          "asset": "BTC",
                          "free_atomic": "1",
                          "free_scale": 3
                        }
                      ],
                      "snapshot_complete": true
                    }
                  },
                  "incomplete": {
                    "summary": "Synthetic incomplete snapshot; not evidence of zero balances",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "exchange_link_id": 17,
                      "updates": [],
                      "snapshot_complete": false
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "exchange_link_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        ]
      }
    },
    "/v1/positions/get": {
      "get": {
        "operationId": "get_v1_positions_get",
        "summary": "Read canonical position get",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Position"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ],
                  "additionalProperties": true
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic pending unprotected position; independent illustration",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "11111111-1111-4111-8111-111111111111",
                        "user_id": 1,
                        "status": 1,
                        "revision": 7,
                        "instrument_id": "COPY_EXACT_CATALOG_ID",
                        "instrument_type": 2,
                        "instrument_topology": 2,
                        "position_side": 1,
                        "base": "BTC",
                        "quote": "USDT",
                        "exchange_link_id": 17,
                        "margin_mode": 1,
                        "leverage": 2,
                        "order_grid_enabled": false,
                        "open_orders": [
                          {
                            "row_id": 1,
                            "created_at_ms": 1893456000000,
                            "price_atomic": "70000",
                            "price_scale": 0,
                            "quantity_atomic": "1",
                            "quantity_scale": 4,
                            "executed": [],
                            "projected_order_status": 1,
                            "order_fsm_state": 2,
                            "exchange_submitted": true,
                            "slot_id": "SYNTHETIC_CURRENT_OPEN_SLOT",
                            "order_id": "33333333-3333-4333-8333-333333333333"
                          }
                        ],
                        "open_order_type": 1,
                        "sl_enabled": false,
                        "slx_enabled": false,
                        "tp_enabled": false,
                        "position_fsm_state": 2,
                        "created_at": 1893456000,
                        "updated_at": 1893456000,
                        "tick_step_atomic": "1",
                        "tick_step_scale": 1,
                        "lot_step_base_atomic": "1",
                        "lot_step_base_scale": 4,
                        "min_size_base_atomic": "1",
                        "min_size_base_scale": 4,
                        "contract_value_atomic": "1",
                        "contract_value_scale": 2,
                        "funding_fee_quote_atomic": "0",
                        "funding_fee_quote_scale": 0,
                        "alloc_open_executed_atomic": "0",
                        "alloc_open_executed_scale": 0,
                        "alloc_close_executed_atomic": "0",
                        "alloc_close_executed_scale": 0,
                        "alloc_net_exposure_atomic": "0",
                        "alloc_net_exposure_scale": 0,
                        "executed_cost_quote_atomic": "0",
                        "executed_cost_quote_scale": 0,
                        "next_funding_fee_quote_atomic": "0",
                        "next_funding_fee_quote_scale": 0,
                        "next_funding_time": 0
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "exchange_link_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "instrument_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/positions/get-for-modification": {
      "get": {
        "operationId": "get_v1_positions_get_for_modification",
        "summary": "Read canonical position get-for-modification",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Position"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ],
                  "additionalProperties": true
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic pending unprotected position; independent illustration",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "11111111-1111-4111-8111-111111111111",
                        "user_id": 1,
                        "status": 1,
                        "revision": 7,
                        "instrument_id": "COPY_EXACT_CATALOG_ID",
                        "instrument_type": 2,
                        "instrument_topology": 2,
                        "position_side": 1,
                        "base": "BTC",
                        "quote": "USDT",
                        "exchange_link_id": 17,
                        "margin_mode": 1,
                        "leverage": 2,
                        "order_grid_enabled": false,
                        "open_orders": [
                          {
                            "row_id": 1,
                            "created_at_ms": 1893456000000,
                            "price_atomic": "70000",
                            "price_scale": 0,
                            "quantity_atomic": "1",
                            "quantity_scale": 4,
                            "executed": [],
                            "projected_order_status": 1,
                            "order_fsm_state": 2,
                            "exchange_submitted": true,
                            "slot_id": "SYNTHETIC_CURRENT_OPEN_SLOT",
                            "order_id": "33333333-3333-4333-8333-333333333333"
                          }
                        ],
                        "open_order_type": 1,
                        "sl_enabled": false,
                        "slx_enabled": false,
                        "tp_enabled": false,
                        "position_fsm_state": 2,
                        "created_at": 1893456000,
                        "updated_at": 1893456000,
                        "tick_step_atomic": "1",
                        "tick_step_scale": 1,
                        "lot_step_base_atomic": "1",
                        "lot_step_base_scale": 4,
                        "min_size_base_atomic": "1",
                        "min_size_base_scale": 4,
                        "contract_value_atomic": "1",
                        "contract_value_scale": 2,
                        "funding_fee_quote_atomic": "0",
                        "funding_fee_quote_scale": 0,
                        "alloc_open_executed_atomic": "0",
                        "alloc_open_executed_scale": 0,
                        "alloc_close_executed_atomic": "0",
                        "alloc_close_executed_scale": 0,
                        "alloc_net_exposure_atomic": "0",
                        "alloc_net_exposure_scale": 0,
                        "executed_cost_quote_atomic": "0",
                        "executed_cost_quote_scale": 0,
                        "next_funding_fee_quote_atomic": "0",
                        "next_funding_fee_quote_scale": 0,
                        "next_funding_time": 0
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "exchange_link_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "instrument_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/positions/lookup": {
      "get": {
        "operationId": "get_v1_positions_lookup",
        "summary": "Look up an authorized exact position",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Position"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ],
                  "additionalProperties": true
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic pending unprotected position; independent illustration",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "11111111-1111-4111-8111-111111111111",
                        "user_id": 1,
                        "status": 1,
                        "revision": 7,
                        "instrument_id": "COPY_EXACT_CATALOG_ID",
                        "instrument_type": 2,
                        "instrument_topology": 2,
                        "position_side": 1,
                        "base": "BTC",
                        "quote": "USDT",
                        "exchange_link_id": 17,
                        "margin_mode": 1,
                        "leverage": 2,
                        "order_grid_enabled": false,
                        "open_orders": [
                          {
                            "row_id": 1,
                            "created_at_ms": 1893456000000,
                            "price_atomic": "70000",
                            "price_scale": 0,
                            "quantity_atomic": "1",
                            "quantity_scale": 4,
                            "executed": [],
                            "projected_order_status": 1,
                            "order_fsm_state": 2,
                            "exchange_submitted": true,
                            "slot_id": "SYNTHETIC_CURRENT_OPEN_SLOT",
                            "order_id": "33333333-3333-4333-8333-333333333333"
                          }
                        ],
                        "open_order_type": 1,
                        "sl_enabled": false,
                        "slx_enabled": false,
                        "tp_enabled": false,
                        "position_fsm_state": 2,
                        "created_at": 1893456000,
                        "updated_at": 1893456000,
                        "tick_step_atomic": "1",
                        "tick_step_scale": 1,
                        "lot_step_base_atomic": "1",
                        "lot_step_base_scale": 4,
                        "min_size_base_atomic": "1",
                        "min_size_base_scale": 4,
                        "contract_value_atomic": "1",
                        "contract_value_scale": 2,
                        "funding_fee_quote_atomic": "0",
                        "funding_fee_quote_scale": 0,
                        "alloc_open_executed_atomic": "0",
                        "alloc_open_executed_scale": 0,
                        "alloc_close_executed_atomic": "0",
                        "alloc_close_executed_scale": 0,
                        "alloc_net_exposure_atomic": "0",
                        "alloc_net_exposure_scale": 0,
                        "executed_cost_quote_atomic": "0",
                        "executed_cost_quote_scale": 0,
                        "next_funding_fee_quote_atomic": "0",
                        "next_funding_fee_quote_scale": 0,
                        "next_funding_time": 0
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "description": "Returns the canonical Liftx response documented below. Preserve fixed-point decimals and inspect HTTP status and Content-Type before decoding errors."
      }
    },
    "/v1/positions/pnl-history": {
      "get": {
        "operationId": "get_v1_positions_pnl_history",
        "summary": "Read canonical position P&L history",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PositionHistory"
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic position history; not current execution confirmation",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "quote": "USDT",
                      "from": 1893456000,
                      "to": 1893456000,
                      "as_of": 1893456000,
                      "history_from": 1893456000,
                      "history_at": 1893456000,
                      "after": 0,
                      "complete": true,
                      "terminal": false,
                      "reset_required": false,
                      "points": [
                        {
                          "rate_at": 0,
                          "time": 1893456000,
                          "value": {
                            "atomic": "0",
                            "scale": 0
                          },
                          "complete": true,
                          "resolution": 1,
                          "gap_before": false
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "description": "Returns the canonical Liftx response documented below. Preserve fixed-point decimals and inspect HTTP status and Content-Type before decoding errors."
      }
    },
    "/v1/dashboard/history": {
      "get": {
        "operationId": "get_v1_dashboard_history",
        "summary": "Read canonical exact-link dashboard history",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/History"
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic complete zero-P&L sample",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "revision": "1893456000000000000",
                      "scope": {
                        "exchange_link_id": 17,
                        "environment": "demo",
                        "currency": "USDT"
                      },
                      "as_of": 1893456000,
                      "points": [
                        {
                          "rate_at": 1893456000,
                          "time": 1893456000,
                          "value": {
                            "atomic": "0",
                            "scale": 0
                          },
                          "complete": true,
                          "resolution": 1
                        }
                      ],
                      "before": 0,
                      "after": 0,
                      "selection": {
                        "market": "all",
                        "pair_id": ""
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "exchange_link_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "market",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "pair_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Returns the canonical Liftx response documented below. Preserve fixed-point decimals and inspect HTTP status and Content-Type before decoding errors."
      }
    },
    "/v1/dashboard/pairs": {
      "get": {
        "operationId": "get_v1_dashboard_pairs",
        "summary": "Read canonical exact-link dashboard pairs",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PairOptions"
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic reporting pair; pair ID is not an execution instrument",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "scope": {
                        "exchange_link_id": 17,
                        "environment": "demo",
                        "currency": "USDT"
                      },
                      "market": "all",
                      "search": "",
                      "cursor": "",
                      "options": [
                        {
                          "pair_id": "7499fad9dce3c16628c505192539ea7900157cf5b576a33cc085193acc7fa8e0",
                          "base": "BTC",
                          "quote": "USDT"
                        }
                      ],
                      "next_cursor": ""
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "exchange_link_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "market",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Returns the canonical Liftx response documented below. Preserve fixed-point decimals and inspect HTTP status and Content-Type before decoding errors."
      }
    },
    "/v1/symbols/list": {
      "get": {
        "operationId": "get_v1_symbols_list",
        "summary": "Read canonical symbols/list",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "all": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Symbol"
                          }
                        },
                        "selected": {
                          "$ref": "#/components/schemas/Symbol"
                        },
                        "hash": {
                          "type": "string"
                        },
                        "expiration": {
                          "type": "integer",
                          "format": "int64"
                        }
                      },
                      "required": [
                        "all",
                        "hash",
                        "expiration"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ],
                  "additionalProperties": true
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic catalog; illustrated limits are not venue defaults",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "success": true,
                      "data": {
                        "all": [
                          {
                            "instrument_id": "COPY_EXACT_CATALOG_ID",
                            "fee_schedule_id": "SYNTHETIC_FEE_SCHEDULE",
                            "base": "BTC",
                            "quote": "USDT",
                            "lot_size_atomic": "1",
                            "lot_size_scale": 4,
                            "tick_size_atomic": "1",
                            "tick_size_scale": 1,
                            "instrument_type": 2,
                            "instrument_topology": 2,
                            "leverage": 2,
                            "min_size_atomic": "1",
                            "min_size_scale": 4,
                            "contract_value_atomic": "1",
                            "contract_value_scale": 2,
                            "state": "live"
                          }
                        ],
                        "selected": {
                          "instrument_id": "COPY_EXACT_CATALOG_ID",
                          "fee_schedule_id": "SYNTHETIC_FEE_SCHEDULE",
                          "base": "BTC",
                          "quote": "USDT",
                          "lot_size_atomic": "1",
                          "lot_size_scale": 4,
                          "tick_size_atomic": "1",
                          "tick_size_scale": 1,
                          "instrument_type": 2,
                          "instrument_topology": 2,
                          "leverage": 2,
                          "min_size_atomic": "1",
                          "min_size_scale": 4,
                          "contract_value_atomic": "1",
                          "contract_value_scale": 2,
                          "state": "live"
                        },
                        "hash": "0000000000000000000000000000000000000000000000000000000000000000",
                        "expiration": 1893456300
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "304": {
            "description": "Supplied catalog hash is current"
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "exchange_link_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "instrument_type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "instrument_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hash",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          }
        ],
        "description": "Returns the canonical Liftx response documented below. Preserve fixed-point decimals and inspect HTTP status and Content-Type before decoding errors."
      }
    },
    "/v1/symbols/trading-currencies": {
      "get": {
        "operationId": "get_v1_symbols_trading_currencies",
        "summary": "Read canonical symbols/trading-currencies",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/TradingCurrencies"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ],
                  "additionalProperties": true
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic eligible settlement currency",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "success": true,
                      "data": {
                        "currencies": [
                          "USDT"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "exchange_link_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "instrument_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Returns the canonical Liftx response documented below. Preserve fixed-point decimals and inspect HTTP status and Content-Type before decoding errors."
      }
    },
    "/v1/fee-rates/list": {
      "get": {
        "operationId": "get_v1_fee_rates_list",
        "summary": "Read canonical fee-rates/list",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "fee_rates": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/FeeRate"
                          }
                        },
                        "expiration": {
                          "type": "integer",
                          "format": "int64"
                        }
                      },
                      "required": [
                        "fee_rates",
                        "expiration"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ],
                  "additionalProperties": true
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic fee rates; not an actual account fee tier",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "success": true,
                      "data": {
                        "fee_rates": [
                          {
                            "instrument_type": 2,
                            "fee_schedule_id": "SYNTHETIC_FEE_SCHEDULE",
                            "maker": "0.0002",
                            "taker": "0.0005"
                          }
                        ],
                        "expiration": 1893456300
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "exchange_link_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        ],
        "description": "Returns the canonical Liftx response documented below. Preserve fixed-point decimals and inspect HTTP status and Content-Type before decoding errors."
      }
    },
    "/v1/liquidation/context": {
      "get": {
        "operationId": "get_v1_liquidation_context",
        "summary": "Read canonical liquidation/context",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/LiquidationContext"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ],
                  "additionalProperties": true
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic isolated-margin tier; not risk or liquidation advice",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "success": true,
                      "data": {
                        "tiers": [
                          {
                            "min_size": "0",
                            "max_size": "1",
                            "maintenance_rate": "0.005"
                          }
                        ],
                        "expiration": 1893456300
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "exchange_link_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "instrument_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "margin_mode",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "const": 2
            }
          }
        ],
        "description": "Returns the canonical Liftx response documented below. Preserve fixed-point decimals and inspect HTTP status and Content-Type before decoding errors."
      }
    },
    "/v1/templates/list": {
      "get": {
        "operationId": "get_v1_templates_list",
        "summary": "Canonical template list",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read"
      }
    },
    "/v1/templates/get": {
      "get": {
        "operationId": "get_v1_templates_get",
        "summary": "Canonical template get",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/v1/templates/create": {
      "post": {
        "operationId": "post_v1_templates_create",
        "summary": "Canonical template create",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "templates:write",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderTemplate"
              }
            }
          }
        }
      }
    },
    "/v1/templates/update": {
      "put": {
        "operationId": "put_v1_templates_update",
        "summary": "Canonical template update",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "templates:write",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderTemplate"
              }
            }
          }
        }
      }
    },
    "/v1/templates/delete": {
      "delete": {
        "operationId": "delete_v1_templates_delete",
        "summary": "Canonical template delete",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "templates:write",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/v1/stream": {
      "get": {
        "operationId": "get_v1_stream",
        "summary": "Upgrade scoped canonical unified WebSocket",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "101": {
            "description": "Success"
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "read",
        "description": "Authorization bearer header and read scope are required. This is a WebSocket upgrade using scoped JSON control messages and a seven-byte binary data envelope. Trading mutations use HTTP commands. Credential and entitlement expiry close the authorized stream; revocation is enforced during stream lifetime."
      }
    },
    "/v1/tradingview/events": {
      "post": {
        "operationId": "post_v1_tradingview_events",
        "summary": "Receive a restricted-capability TradingView webhook",
        "security": [],
        "responses": {
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                },
                "examples": {
                  "open": {
                    "summary": "Synthetic guided alert receipt; new acceptance",
                    "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": "22222222-2222-4222-8222-222222222222",
                      "client_command_id": "alert:55555555-5555-4555-8555-555555555555:1893456000:open",
                      "action": "open",
                      "state": "accepted",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456000
                    }
                  },
                  "empty_exit": {
                    "summary": "Synthetic strategy EXIT captures no target; not flatness proof",
                    "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": "99999999-9999-4999-8999-999999999999",
                      "client_command_id": "signal-a:exit-001",
                      "action": "terminate",
                      "state": "execution_observed",
                      "position_id": null,
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456060,
                      "group": {
                        "target": "strategy",
                        "target_count": 0,
                        "counts": {
                          "accepted": 0,
                          "dispatching": 0,
                          "execution_observed": 0,
                          "handed_off": 0,
                          "rejected": 0,
                          "expired": 0,
                          "operator_required": 0
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "200": {
            "description": "Identical accepted event",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                },
                "examples": {
                  "open": {
                    "summary": "Synthetic guided alert receipt; identical retry",
                    "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": "22222222-2222-4222-8222-222222222222",
                      "client_command_id": "alert:55555555-5555-4555-8555-555555555555:1893456000:open",
                      "action": "open",
                      "state": "accepted",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456000
                    }
                  },
                  "empty_exit": {
                    "summary": "Synthetic strategy EXIT captures no target; not flatness proof",
                    "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": "99999999-9999-4999-8999-999999999999",
                      "client_command_id": "signal-a:exit-001",
                      "action": "terminate",
                      "state": "execution_observed",
                      "position_id": null,
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456060,
                      "group": {
                        "target": "strategy",
                        "target_count": 0,
                        "counts": {
                          "accepted": 0,
                          "dispatching": 0,
                          "execution_observed": 0,
                          "handed_off": 0,
                          "rejected": 0,
                          "expired": 0,
                          "operator_required": 0
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "restricted trading capability",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TradingViewEvent"
              }
            }
          }
        },
        "servers": [
          {
            "url": "https://hooks.liftx.io"
          }
        ],
        "description": "Restricted TradingView body capability required. Use HTTPS on the hooks host with valid JSON; no client certificate configuration is required. The service remains unavailable until activation and delivery qualification. Durable admission has a two-second application deadline; temporary unavailability returns 503.",
        "x-liftx-authentication": {
          "type": "body-capability",
          "property": "token",
          "kind": "tradingview",
          "transport": "server-authenticated HTTPS through the canonical allowlisted ingress"
        }
      }
    },
    "/integrations/credentials": {
      "get": {
        "operationId": "get_integrations_credentials",
        "summary": "List credential metadata and TradingView availability",
        "security": [
          {
            "SessionBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "credentials": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Credential"
                      }
                    },
                    "tradingview_available": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "credentials",
                    "tradingview_available"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic credential metadata; webhook remains inactive",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "credentials": [
                        {
                          "id": "77777777-7777-4777-8777-777777777777",
                          "integration_id": "88888888-8888-4888-8888-888888888888",
                          "name": "Demo controller",
                          "kind": "api",
                          "prefix": "lx_api_77777777",
                          "scopes": [
                            "read",
                            "positions:open",
                            "positions:modify",
                            "positions:terminate"
                          ],
                          "exchange_link_ids": [
                            17
                          ],
                          "instrument_ids": [
                            "COPY_EXACT_CATALOG_ID"
                          ],
                          "created_at": 1893456000,
                          "expires_at": 1893542400,
                          "revoked_at": null
                        }
                      ],
                      "tradingview_available": false
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "",
        "description": "Session-owned Settings contract. Ordinary API keys and TradingView capabilities cannot authenticate this route. Use the Liftx Settings application; this is not a third-party bot endpoint. Returns at most 100 credential metadata rows, active first then recent history. Inactive credentials become eligible for bounded cleanup 30 days after their own expiry/revocation once no retained command references them. Parent revocation disables authorization immediately; key metadata ages by its own expiry/revocation. Nonrevoked keyless TradingView setups and all lifecycle references are preserved."
      },
      "post": {
        "operationId": "post_integrations_credentials",
        "summary": "Issue credentials after exact fresh approval",
        "security": [
          {
            "SessionBearer": []
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssuedCredential"
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic first issuance; placeholder is not a valid key",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "credential": {
                        "id": "77777777-7777-4777-8777-777777777777",
                        "integration_id": "88888888-8888-4888-8888-888888888888",
                        "name": "Demo controller",
                        "kind": "api",
                        "prefix": "lx_api_77777777",
                        "scopes": [
                          "read",
                          "positions:open",
                          "positions:modify",
                          "positions:terminate"
                        ],
                        "exchange_link_ids": [
                          17
                        ],
                        "instrument_ids": [
                          "COPY_EXACT_CATALOG_ID"
                        ],
                        "created_at": 1893456000,
                        "expires_at": 1893542400,
                        "revoked_at": null
                      },
                      "secret": "ONE_TIME_API_SECRET_FROM_AUTHENTICATED_SETTINGS"
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "200": {
            "description": "Committed duplicate; no secret recovery",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssuedCredential"
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic committed duplicate; secret is not recoverable",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "credential": {
                        "id": "77777777-7777-4777-8777-777777777777",
                        "integration_id": "88888888-8888-4888-8888-888888888888",
                        "name": "Demo controller",
                        "kind": "api",
                        "prefix": "lx_api_77777777",
                        "scopes": [
                          "read",
                          "positions:open",
                          "positions:modify",
                          "positions:terminate"
                        ],
                        "exchange_link_ids": [
                          17
                        ],
                        "instrument_ids": [
                          "COPY_EXACT_CATALOG_ID"
                        ],
                        "created_at": 1893456000,
                        "expires_at": 1893542400,
                        "revoked_at": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Credential security admission limit reached; existing security middleware response. Wait before an explicit retry, and never automatically replay secret issuance."
          }
        },
        "x-liftx-required-scope": "",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "operation_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "request": {
                    "$ref": "#/components/schemas/CredentialRequest"
                  }
                },
                "required": [
                  "operation_id",
                  "request"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "description": "Session-owned Settings contract. Ordinary API keys and TradingView capabilities cannot authenticate this route. Use the Liftx Settings application; this is not a third-party bot endpoint. Shares credential-security admission of 12 requests per minute per source IP across these issuance/reauthentication POST operations; separate from the five-attempt approval budget. Metadata and revocation are exempt. No trading usage quota.",
        "x-liftx-security-rate-limit": {
          "requests": 12,
          "window_seconds": 60,
          "key": "source_ip",
          "scope": "integration_security"
        }
      }
    },
    "/integrations/bindings": {
      "get": {
        "operationId": "get_integrations_bindings",
        "summary": "List binding metadata",
        "security": [
          {
            "SessionBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "bindings": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Binding"
                      }
                    }
                  },
                  "required": [
                    "bindings"
                  ],
                  "additionalProperties": false
                },
                "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": {
                      "bindings": [
                        {
                          "integration_id": "88888888-8888-4888-8888-888888888888",
                          "mode": "guided",
                          "exchange_link_id": 17,
                          "instrument_id": "COPY_EXACT_CATALOG_ID",
                          "position_request": {
                            "action": 1,
                            "exchange_link_id": 17,
                            "instrument_id": "COPY_EXACT_CATALOG_ID",
                            "quantity_asset": "BTC",
                            "position_side": 1,
                            "open_order_type": 1,
                            "open_prices_atomic": [
                              "70000"
                            ],
                            "open_prices_scale": [
                              0
                            ],
                            "open_quantities_atomic": [
                              "1"
                            ],
                            "open_quantities_scale": [
                              4
                            ],
                            "order_grid_enabled": false,
                            "margin_mode": 1,
                            "leverage": 2,
                            "sl_enabled": true,
                            "sl_type": 1,
                            "sl_step_percent": 2000000,
                            "sl_price_atomic": "68600",
                            "sl_price_scale": 0,
                            "sl_price_rearrangement": true,
                            "sl_order_type": 2,
                            "slx_enabled": true,
                            "slx_tp_trailing_enabled": false,
                            "slx_each_tp_trailing": false,
                            "slx_sl_trigger_price_trailing_enabled": true,
                            "slx_sl_trigger_price_trailing_pl_percent_activation": 1000000,
                            "slx_sl_trigger_price_trailing_indent_percent": 500000,
                            "slx_sl_trigger_price_trailing_step": 250000,
                            "slx_sl_trailing_breakeven_enabled": false,
                            "tp_enabled": true,
                            "tp_price_rearrangement": true,
                            "tp_grid_enabled": false,
                            "tp_order_type": 1,
                            "tp_prices_atomic": [
                              "72100"
                            ],
                            "tp_prices_scale": [
                              0
                            ],
                            "tp_quantities_atomic": [
                              "0"
                            ],
                            "tp_quantities_scale": [
                              0
                            ],
                            "tp_quantity_percents": [
                              1000000
                            ],
                            "tp_pnls": [
                              3000000
                            ]
                          },
                          "max_quantity": "0.001",
                          "source_instance_id": "55555555-5555-4555-8555-555555555555",
                          "revision": 1,
                          "position_mode": "single",
                          "allow_market_terminate": false
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "",
        "description": "Session-owned Settings contract. Ordinary API keys and TradingView capabilities cannot authenticate this route. Use the Liftx Settings application; this is not a third-party bot endpoint. Unrevoked bindings; namespace cap 64 applies independently of credential expiry."
      },
      "post": {
        "operationId": "post_integrations_bindings",
        "summary": "Issue bindings after exact fresh approval",
        "security": [
          {
            "SessionBearer": []
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssuedCredential"
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic setup issuance; does not activate webhook execution",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "credential": {
                        "id": "77777777-7777-4777-8777-777777777777",
                        "integration_id": "88888888-8888-4888-8888-888888888888",
                        "name": "Demo signal",
                        "kind": "tradingview",
                        "prefix": "lx_tradingview_77777777",
                        "scopes": [
                          "positions:open",
                          "positions:terminate"
                        ],
                        "exchange_link_ids": [
                          17
                        ],
                        "instrument_ids": [
                          "COPY_EXACT_CATALOG_ID"
                        ],
                        "created_at": 1893456000,
                        "expires_at": 1893542400,
                        "revoked_at": null
                      },
                      "binding": {
                        "integration_id": "88888888-8888-4888-8888-888888888888",
                        "mode": "guided",
                        "exchange_link_id": 17,
                        "instrument_id": "COPY_EXACT_CATALOG_ID",
                        "position_request": {
                          "action": 1,
                          "exchange_link_id": 17,
                          "instrument_id": "COPY_EXACT_CATALOG_ID",
                          "quantity_asset": "BTC",
                          "position_side": 1,
                          "open_order_type": 1,
                          "open_prices_atomic": [
                            "70000"
                          ],
                          "open_prices_scale": [
                            0
                          ],
                          "open_quantities_atomic": [
                            "1"
                          ],
                          "open_quantities_scale": [
                            4
                          ],
                          "order_grid_enabled": false,
                          "margin_mode": 1,
                          "leverage": 2,
                          "sl_enabled": true,
                          "sl_type": 1,
                          "sl_step_percent": 2000000,
                          "sl_price_atomic": "68600",
                          "sl_price_scale": 0,
                          "sl_price_rearrangement": true,
                          "sl_order_type": 2,
                          "slx_enabled": true,
                          "slx_tp_trailing_enabled": false,
                          "slx_each_tp_trailing": false,
                          "slx_sl_trigger_price_trailing_enabled": true,
                          "slx_sl_trigger_price_trailing_pl_percent_activation": 1000000,
                          "slx_sl_trigger_price_trailing_indent_percent": 500000,
                          "slx_sl_trigger_price_trailing_step": 250000,
                          "slx_sl_trailing_breakeven_enabled": false,
                          "tp_enabled": true,
                          "tp_price_rearrangement": true,
                          "tp_grid_enabled": false,
                          "tp_order_type": 1,
                          "tp_prices_atomic": [
                            "72100"
                          ],
                          "tp_prices_scale": [
                            0
                          ],
                          "tp_quantities_atomic": [
                            "0"
                          ],
                          "tp_quantities_scale": [
                            0
                          ],
                          "tp_quantity_percents": [
                            1000000
                          ],
                          "tp_pnls": [
                            3000000
                          ]
                        },
                        "max_quantity": "0.001",
                        "source_instance_id": "55555555-5555-4555-8555-555555555555",
                        "revision": 1,
                        "position_mode": "single",
                        "allow_market_terminate": false
                      },
                      "secret": "ONE_TIME_RESTRICTED_TRADINGVIEW_SECRET",
                      "webhook_url": "https://hooks.liftx.io/v1/tradingview/events"
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "200": {
            "description": "Committed duplicate; no secret recovery",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssuedCredential"
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic committed duplicate; secret omitted",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "credential": {
                        "id": "77777777-7777-4777-8777-777777777777",
                        "integration_id": "88888888-8888-4888-8888-888888888888",
                        "name": "Demo signal",
                        "kind": "tradingview",
                        "prefix": "lx_tradingview_77777777",
                        "scopes": [
                          "positions:open",
                          "positions:terminate"
                        ],
                        "exchange_link_ids": [
                          17
                        ],
                        "instrument_ids": [
                          "COPY_EXACT_CATALOG_ID"
                        ],
                        "created_at": 1893456000,
                        "expires_at": 1893542400,
                        "revoked_at": null
                      },
                      "binding": {
                        "integration_id": "88888888-8888-4888-8888-888888888888",
                        "mode": "guided",
                        "exchange_link_id": 17,
                        "instrument_id": "COPY_EXACT_CATALOG_ID",
                        "position_request": {
                          "action": 1,
                          "exchange_link_id": 17,
                          "instrument_id": "COPY_EXACT_CATALOG_ID",
                          "quantity_asset": "BTC",
                          "position_side": 1,
                          "open_order_type": 1,
                          "open_prices_atomic": [
                            "70000"
                          ],
                          "open_prices_scale": [
                            0
                          ],
                          "open_quantities_atomic": [
                            "1"
                          ],
                          "open_quantities_scale": [
                            4
                          ],
                          "order_grid_enabled": false,
                          "margin_mode": 1,
                          "leverage": 2,
                          "sl_enabled": true,
                          "sl_type": 1,
                          "sl_step_percent": 2000000,
                          "sl_price_atomic": "68600",
                          "sl_price_scale": 0,
                          "sl_price_rearrangement": true,
                          "sl_order_type": 2,
                          "slx_enabled": true,
                          "slx_tp_trailing_enabled": false,
                          "slx_each_tp_trailing": false,
                          "slx_sl_trigger_price_trailing_enabled": true,
                          "slx_sl_trigger_price_trailing_pl_percent_activation": 1000000,
                          "slx_sl_trigger_price_trailing_indent_percent": 500000,
                          "slx_sl_trigger_price_trailing_step": 250000,
                          "slx_sl_trailing_breakeven_enabled": false,
                          "tp_enabled": true,
                          "tp_price_rearrangement": true,
                          "tp_grid_enabled": false,
                          "tp_order_type": 1,
                          "tp_prices_atomic": [
                            "72100"
                          ],
                          "tp_prices_scale": [
                            0
                          ],
                          "tp_quantities_atomic": [
                            "0"
                          ],
                          "tp_quantities_scale": [
                            0
                          ],
                          "tp_quantity_percents": [
                            1000000
                          ],
                          "tp_pnls": [
                            3000000
                          ]
                        },
                        "max_quantity": "0.001",
                        "source_instance_id": "55555555-5555-4555-8555-555555555555",
                        "revision": 1,
                        "position_mode": "single",
                        "allow_market_terminate": false
                      },
                      "webhook_url": "https://hooks.liftx.io/v1/tradingview/events"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Credential security admission limit reached; existing security middleware response. Wait before an explicit retry, and never automatically replay secret issuance."
          }
        },
        "x-liftx-required-scope": "",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "operation_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "request": {
                    "$ref": "#/components/schemas/BindingRequest"
                  }
                },
                "required": [
                  "operation_id",
                  "request"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "description": "Session-owned Settings contract. Ordinary API keys and TradingView capabilities cannot authenticate this route. Use the Liftx Settings application; this is not a third-party bot endpoint. Shares credential-security admission of 12 requests per minute per source IP across these issuance/reauthentication POST operations; separate from the five-attempt approval budget. Metadata and revocation are exempt. No trading usage quota.",
        "x-liftx-security-rate-limit": {
          "requests": 12,
          "window_seconds": 60,
          "key": "source_ip",
          "scope": "integration_security"
        }
      }
    },
    "/integrations/credentials/revoke": {
      "post": {
        "operationId": "post_integrations_credentials_revoke",
        "summary": "Revoke credentials",
        "description": "Session-owned Settings contract. Ordinary API keys and TradingView capabilities cannot authenticate this route. Use the Liftx Settings application; this is not a third-party bot endpoint. A confirmed result is 200 with revoked:true. A database update with an unreadable outcome returns 503 REVOCATION_UNCERTAIN: inspect credential metadata before an explicit retry. The requesting user's matching streams are closed and authority reconciliation is signaled even for this uncertain outcome. No automatic mutation retry.",
        "security": [
          {
            "SessionBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "revoked": {
                      "const": true
                    }
                  },
                  "required": [
                    "revoked"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "synthetic": {
                    "summary": "Confirmed revocation response shape",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "revoked": true
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/integrations/bindings/revoke": {
      "post": {
        "operationId": "post_integrations_bindings_revoke",
        "summary": "Revoke bindings",
        "description": "Session-owned Settings contract. Ordinary API keys and TradingView capabilities cannot authenticate this route. Use the Liftx Settings application; this is not a third-party bot endpoint. A confirmed result is 200 with revoked:true. A database update with an unreadable outcome returns 503 REVOCATION_UNCERTAIN: inspect binding and credential metadata before an explicit retry. The requesting user's matching streams are closed and authority reconciliation is signaled even for this uncertain outcome. No automatic mutation retry.",
        "security": [
          {
            "SessionBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "revoked": {
                      "const": true
                    }
                  },
                  "required": [
                    "revoked"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "synthetic": {
                    "summary": "Confirmed revocation response shape",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "revoked": true
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "integration_id": {
                    "type": "string",
                    "format": "uuid"
                  }
                },
                "required": [
                  "integration_id"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/integrations/reauth/start": {
      "post": {
        "operationId": "post_integrations_reauth_start",
        "summary": "Start purpose-bound five-minute reauthentication",
        "security": [
          {
            "SessionBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Challenge"
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic password plus MFA challenge",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "operation_id": "66666666-6666-4666-8666-666666666666",
                      "methods": [
                        "password"
                      ],
                      "mfa_required": true,
                      "expires_at": 1893456300
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "429": {
            "description": "Credential security admission limit reached; existing security middleware response. Wait before an explicit retry, and never automatically replay secret issuance."
          }
        },
        "x-liftx-required-scope": "",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "operation_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "credential",
                      "binding"
                    ]
                  },
                  "request": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/CredentialRequest"
                      },
                      {
                        "$ref": "#/components/schemas/BindingRequest"
                      }
                    ]
                  }
                },
                "required": [
                  "operation_id",
                  "purpose",
                  "request"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "description": "Session-owned Settings contract. Ordinary API keys and TradingView capabilities cannot authenticate this route. Use the Liftx Settings application; this is not a third-party bot endpoint. Shares credential-security admission of 12 requests per minute per source IP across these issuance/reauthentication POST operations; separate from the five-attempt approval budget. Metadata and revocation are exempt. No trading usage quota.",
        "x-liftx-security-rate-limit": {
          "requests": 12,
          "window_seconds": 60,
          "key": "source_ip",
          "scope": "integration_security"
        }
      }
    },
    "/integrations/reauth/verify": {
      "post": {
        "operationId": "post_integrations_reauth_verify",
        "summary": "Verify password or bound Apple token and MFA",
        "security": [
          {
            "SessionBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Approval"
                },
                "examples": {
                  "synthetic": {
                    "summary": "Synthetic purpose-bound approval",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "operation_id": "66666666-6666-4666-8666-666666666666",
                      "approved": true,
                      "expires_at": 1893456300
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "429": {
            "description": "Credential security admission limit reached; existing security middleware response. Wait before an explicit retry, and never automatically replay secret issuance."
          }
        },
        "x-liftx-required-scope": "",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "operation_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "proof": {
                    "$ref": "#/components/schemas/Proof"
                  }
                },
                "required": [
                  "operation_id",
                  "proof"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "description": "Session-owned Settings contract. Ordinary API keys and TradingView capabilities cannot authenticate this route. Use the Liftx Settings application; this is not a third-party bot endpoint. Shares credential-security admission of 12 requests per minute per source IP across these issuance/reauthentication POST operations; separate from the five-attempt approval budget. Metadata and revocation are exempt. No trading usage quota.",
        "x-liftx-security-rate-limit": {
          "requests": 12,
          "window_seconds": 60,
          "key": "source_ip",
          "scope": "integration_security"
        }
      }
    },
    "/integrations/commands": {
      "get": {
        "operationId": "get_integrations_commands",
        "summary": "List account command receipts in authenticated Settings",
        "security": [
          {
            "SessionBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptPage"
                },
                "examples": {
                  "page": {
                    "summary": "Synthetic top-level receipt page",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "commands": [
                        {
                          "id": "99999999-9999-4999-8999-999999999999",
                          "client_command_id": "signal-a:exit-001",
                          "action": "terminate",
                          "state": "partial",
                          "position_id": null,
                          "error_code": null,
                          "created_at": 1893456000,
                          "updated_at": 1893456060,
                          "group": {
                            "target": "strategy",
                            "target_count": 2,
                            "counts": {
                              "accepted": 0,
                              "dispatching": 0,
                              "execution_observed": 0,
                              "handed_off": 1,
                              "rejected": 0,
                              "expired": 1,
                              "operator_required": 0
                            }
                          }
                        },
                        {
                          "id": "22222222-2222-4222-8222-222222222222",
                          "client_command_id": "demo-controller:cycle-001:open",
                          "action": "open",
                          "state": "handed_off",
                          "position_id": "11111111-1111-4111-8111-111111111111",
                          "error_code": null,
                          "created_at": 1893456000,
                          "updated_at": 1893456001
                        }
                      ],
                      "next_cursor": null
                    }
                  },
                  "empty": {
                    "summary": "Synthetic empty receipt history",
                    "description": "Synthetic documentation data, not an account snapshot, executable market configuration or production-availability assertion. IDs, quantities, prices, times and values are illustrative.",
                    "value": {
                      "commands": [],
                      "next_cursor": null
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "description": "Session-owned Settings contract. Ordinary API keys and TradingView capabilities cannot authenticate this route. Use the Liftx Settings application; this is not a third-party bot endpoint. "
      }
    },
    "/integrations/commands/get": {
      "get": {
        "operationId": "get_integrations_commands_get",
        "summary": "Read account-owned receipt and bounded group detail in Settings",
        "security": [
          {
            "SessionBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                },
                "examples": {
                  "open_handed_off": {
                    "summary": "Synthetic OPEN owner evidence; not fill completion",
                    "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": "22222222-2222-4222-8222-222222222222",
                      "client_command_id": "demo-controller:cycle-001:open",
                      "action": "open",
                      "state": "handed_off",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456001
                    }
                  },
                  "modify_observed": {
                    "summary": "Synthetic MODIFY return; inspect current state",
                    "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": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
                      "client_command_id": "demo-controller:cycle-001:modify",
                      "action": "modify",
                      "state": "execution_observed",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456002
                    }
                  },
                  "termination_handed_off": {
                    "summary": "Synthetic durable close request; not proof of flatness",
                    "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": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
                      "client_command_id": "demo-controller:cycle-001:terminate",
                      "action": "terminate",
                      "state": "handed_off",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456003,
                      "terminal_request_kind": 1,
                      "terminal_request_seq": 1
                    }
                  },
                  "uncertain_modification": {
                    "summary": "Synthetic unresolved modification; operator reconciliation required",
                    "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": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
                      "client_command_id": "demo-controller:cycle-001:modify",
                      "action": "modify",
                      "state": "operator_required",
                      "position_id": "11111111-1111-4111-8111-111111111111",
                      "error_code": "EXECUTION_UNCERTAIN",
                      "created_at": 1893456000,
                      "updated_at": 1893456002
                    }
                  },
                  "partial_group": {
                    "summary": "Synthetic two-target group with different resolved outcomes",
                    "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": "99999999-9999-4999-8999-999999999999",
                      "client_command_id": "signal-a:exit-001",
                      "action": "terminate",
                      "state": "partial",
                      "position_id": null,
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456060,
                      "group": {
                        "target": "strategy",
                        "target_count": 2,
                        "counts": {
                          "accepted": 0,
                          "dispatching": 0,
                          "execution_observed": 0,
                          "handed_off": 1,
                          "rejected": 0,
                          "expired": 1,
                          "operator_required": 0
                        }
                      },
                      "targets": [
                        {
                          "id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
                          "client_command_id": "liftx-group:99999999-9999-4999-8999-999999999999:11111111-1111-4111-8111-111111111111",
                          "action": "terminate",
                          "state": "handed_off",
                          "position_id": "11111111-1111-4111-8111-111111111111",
                          "error_code": null,
                          "created_at": 1893456000,
                          "updated_at": 1893456003,
                          "terminal_request_kind": 1,
                          "terminal_request_seq": 1,
                          "group_id": "99999999-9999-4999-8999-999999999999"
                        },
                        {
                          "id": "dddddddd-dddd-4ddd-8ddd-dddddddddddd",
                          "client_command_id": "liftx-group:99999999-9999-4999-8999-999999999999:cccccccc-cccc-4ccc-8ccc-cccccccccccc",
                          "action": "terminate",
                          "state": "expired",
                          "position_id": "cccccccc-cccc-4ccc-8ccc-cccccccccccc",
                          "error_code": "COMMAND_EXPIRED",
                          "created_at": 1893456000,
                          "updated_at": 1893456060,
                          "group_id": "99999999-9999-4999-8999-999999999999"
                        }
                      ]
                    }
                  },
                  "empty_group": {
                    "summary": "Synthetic zero-target capture; does not prove flatness",
                    "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": "99999999-9999-4999-8999-999999999999",
                      "client_command_id": "signal-a:exit-001",
                      "action": "terminate",
                      "state": "execution_observed",
                      "position_id": null,
                      "error_code": null,
                      "created_at": 1893456000,
                      "updated_at": 1893456060,
                      "group": {
                        "target": "strategy",
                        "target_count": 0,
                        "counts": {
                          "accepted": 0,
                          "dispatching": 0,
                          "execution_observed": 0,
                          "handed_off": 0,
                          "rejected": 0,
                          "expired": 0,
                          "operator_required": 0
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "x-liftx-required-scope": "",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "description": "Session-owned Settings contract. Ordinary API keys and TradingView capabilities cannot authenticate this route. Use the Liftx Settings application; this is not a third-party bot endpoint. "
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "lx_api_<credential UUID>.<256-bit secret>"
      },
      "SessionBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "existing authenticated Liftx session"
      }
    },
    "schemas": {
      "Credential": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "exchange_link_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            }
          },
          "instrument_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "integration_id",
          "name",
          "kind",
          "prefix",
          "scopes",
          "exchange_link_ids",
          "instrument_ids",
          "created_at",
          "expires_at",
          "revoked_at"
        ],
        "additionalProperties": false
      },
      "Binding": {
        "type": "object",
        "properties": {
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string"
          },
          "exchange_link_id": {
            "type": "integer",
            "format": "int64"
          },
          "instrument_id": {
            "type": "string"
          },
          "position_request": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PositionRequest"
              },
              {
                "type": "null"
              }
            ]
          },
          "max_quantity": {
            "type": "string"
          },
          "source_instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "position_mode": {
            "type": "string",
            "enum": [
              "single",
              "multiple"
            ],
            "description": "Single rejects a new OPEN while this setup has known active or pending/uncertain work. Multiple permits distinct simultaneous lifecycle references."
          },
          "allow_market_terminate": {
            "type": "boolean",
            "description": "Explicit permission for termination targeting all captured Liftx positions on the exact linked market, including manual and other strategies. Immutable and fresh-auth bound."
          }
        },
        "required": [
          "integration_id",
          "mode",
          "exchange_link_id",
          "instrument_id",
          "position_request",
          "max_quantity",
          "source_instance_id",
          "revision",
          "position_mode",
          "allow_market_terminate"
        ],
        "additionalProperties": false
      },
      "Receipt": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "client_command_id": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "accepted",
              "dispatching",
              "handed_off",
              "execution_observed",
              "rejected",
              "expired",
              "operator_required",
              "partial"
            ]
          },
          "position_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          },
          "terminal_request_kind": {
            "type": "integer",
            "enum": [
              1,
              2
            ]
          },
          "terminal_request_seq": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "group_id": {
            "type": "string",
            "format": "uuid",
            "description": "Parent group on a child termination receipt."
          },
          "group": {
            "$ref": "#/components/schemas/GroupProgress"
          },
          "targets": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/GroupTargetReceipt"
            },
            "description": "Group detail only: at most 64 frozen ordinary termination receipts. Targets cannot contain nested groups or target arrays. Omitted on list responses and zero-target groups."
          }
        },
        "required": [
          "id",
          "client_command_id",
          "action",
          "state",
          "position_id",
          "error_code",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false,
        "description": "Durable command receipt, never a fill/completion assertion. Terminal request fields correlate a durable termination owner handoff. Terminal arm writes kind/sequence while retaining dispatching; owner return or startup canonical evidence advances handed_off. Group parent position_id is null. Precedence is operator_required, dispatching, accepted, then homogeneous resolved state or partial. Zero-target parent is execution_observed. Counts and child states do not prove exposure is flat.",
        "dependentRequired": {
          "terminal_request_kind": [
            "terminal_request_seq"
          ],
          "terminal_request_seq": [
            "terminal_request_kind"
          ],
          "targets": [
            "group"
          ]
        },
        "allOf": [
          {
            "if": {
              "required": [
                "group"
              ]
            },
            "then": {
              "properties": {
                "position_id": {
                  "type": "null"
                },
                "action": {
                  "const": "terminate"
                }
              },
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "group_id"
                    ]
                  },
                  {
                    "required": [
                      "terminal_request_kind"
                    ]
                  },
                  {
                    "required": [
                      "terminal_request_seq"
                    ]
                  }
                ]
              }
            }
          }
        ]
      },
      "ExecutedOrder": {
        "type": "object",
        "properties": {
          "price_atomic": {
            "type": "string"
          },
          "price_scale": {
            "type": "integer",
            "format": "int64"
          },
          "quantity_atomic": {
            "type": "string"
          },
          "quantity_scale": {
            "type": "integer",
            "format": "int64"
          },
          "fee_atomic": {
            "type": "string"
          },
          "fee_scale": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "price_atomic",
          "price_scale",
          "quantity_atomic",
          "quantity_scale",
          "fee_atomic",
          "fee_scale"
        ],
        "additionalProperties": false
      },
      "PositionOrder": {
        "type": "object",
        "properties": {
          "row_id": {
            "type": "integer",
            "format": "int64"
          },
          "created_at_ms": {
            "type": "integer",
            "format": "int64"
          },
          "price_atomic": {
            "type": "string"
          },
          "price_scale": {
            "type": "integer",
            "format": "int64"
          },
          "quantity_atomic": {
            "type": "string"
          },
          "quantity_scale": {
            "type": "integer",
            "format": "int64"
          },
          "executed_qty_sum_atomic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "executed_qty_sum_scale": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "executed_fee_sum_atomic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "executed_fee_sum_scale": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "executed_avg_fill_price_atomic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "executed_avg_fill_price_scale": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "executed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExecutedOrder"
            }
          },
          "projected_order_status": {
            "type": "integer",
            "format": "int64"
          },
          "order_fsm_state": {
            "type": "integer",
            "format": "int64"
          },
          "exchange_submitted": {
            "type": "boolean"
          },
          "slot_id": {
            "type": "string"
          },
          "order_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "sl_step_percent": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "tp_step_percent": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "tp_quantity_percent": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "sl_type": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "sl_order_type": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "sl_price_rearrangement": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "slx_tp_trailing_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "slx_each_tp_trailing": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "slx_sl_trailing_breakeven_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "slx_sl_trigger_price_trailing_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "slx": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "activation_price_atomic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "activation_price_scale": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "activation_price_triggered": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "activation_tp_trigger": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "slx_tp_breakeven": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
              }
            ]
          },
          "slx_sl_trailing_breakeven_indent_percent": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "trailing_peak_price_atomic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "trailing_peak_price_scale": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "price_atomic",
          "price_scale",
          "quantity_atomic",
          "quantity_scale",
          "executed",
          "projected_order_status",
          "order_fsm_state",
          "exchange_submitted"
        ],
        "additionalProperties": false
      },
      "Position": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "user_id": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "type": "integer",
            "format": "int64"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "instrument_id": {
            "type": "string"
          },
          "instrument_type": {
            "type": "integer",
            "format": "int64"
          },
          "instrument_topology": {
            "type": "integer",
            "format": "int64"
          },
          "position_side": {
            "type": "integer",
            "format": "int64"
          },
          "base": {
            "type": "string"
          },
          "quote": {
            "type": "string"
          },
          "exchange": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "public_feed_id": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "exchange_link_id": {
            "type": "integer",
            "format": "int64"
          },
          "exchange_position_id": {
            "type": "string"
          },
          "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": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PositionOrder"
            }
          },
          "open_order_type": {
            "type": "integer",
            "format": "int64"
          },
          "close_orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PositionOrder"
            }
          },
          "sl_enabled": {
            "type": "boolean"
          },
          "stop_loss_orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PositionOrder"
            }
          },
          "slx_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "tp_enabled": {
            "type": "boolean"
          },
          "tp_price_rearrangement": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "tp_grid_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "num_tp_orders": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "take_profit_orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PositionOrder"
            }
          },
          "tp_order_type": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "terminal_request_kind": {
            "type": "integer",
            "format": "int64"
          },
          "terminal_request_phase": {
            "type": "integer",
            "format": "int64"
          },
          "terminal_request_queue_index": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "terminal_request_queue_size": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "position_fsm_state": {
            "type": "integer",
            "format": "int64"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          },
          "tick_step_atomic": {
            "type": "string"
          },
          "tick_step_scale": {
            "type": "integer",
            "format": "int64"
          },
          "lot_step_base_atomic": {
            "type": "string"
          },
          "lot_step_base_scale": {
            "type": "integer",
            "format": "int64"
          },
          "min_size_base_atomic": {
            "type": "string"
          },
          "min_size_base_scale": {
            "type": "integer",
            "format": "int64"
          },
          "contract_value_atomic": {
            "type": "string"
          },
          "contract_value_scale": {
            "type": "integer",
            "format": "int64"
          },
          "funding_fee_quote_atomic": {
            "type": "string"
          },
          "funding_fee_quote_scale": {
            "type": "integer",
            "format": "int64"
          },
          "alloc_open_executed_atomic": {
            "type": "string"
          },
          "alloc_open_executed_scale": {
            "type": "integer",
            "format": "int64"
          },
          "alloc_close_executed_atomic": {
            "type": "string"
          },
          "alloc_close_executed_scale": {
            "type": "integer",
            "format": "int64"
          },
          "alloc_net_exposure_atomic": {
            "type": "string"
          },
          "alloc_net_exposure_scale": {
            "type": "integer",
            "format": "int64"
          },
          "executed_cost_quote_atomic": {
            "type": "string"
          },
          "executed_cost_quote_scale": {
            "type": "integer",
            "format": "int64"
          },
          "next_funding_fee_quote_atomic": {
            "type": "string"
          },
          "next_funding_fee_quote_scale": {
            "type": "integer",
            "format": "int64"
          },
          "next_funding_rate_atomic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "next_funding_rate_scale": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "next_funding_time": {
            "type": "integer",
            "format": "int64"
          },
          "liquidation_price_atomic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "liquidation_price_scale": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "user_id",
          "status",
          "revision",
          "instrument_id",
          "instrument_type",
          "instrument_topology",
          "position_side",
          "base",
          "quote",
          "exchange_link_id",
          "order_grid_enabled",
          "open_orders",
          "open_order_type",
          "sl_enabled",
          "tp_enabled",
          "position_fsm_state",
          "created_at",
          "updated_at",
          "tick_step_atomic",
          "tick_step_scale",
          "lot_step_base_atomic",
          "lot_step_base_scale",
          "min_size_base_atomic",
          "min_size_base_scale",
          "contract_value_atomic",
          "contract_value_scale",
          "funding_fee_quote_atomic",
          "funding_fee_quote_scale",
          "alloc_open_executed_atomic",
          "alloc_open_executed_scale",
          "alloc_close_executed_atomic",
          "alloc_close_executed_scale",
          "alloc_net_exposure_atomic",
          "alloc_net_exposure_scale",
          "executed_cost_quote_atomic",
          "executed_cost_quote_scale",
          "next_funding_fee_quote_atomic",
          "next_funding_fee_quote_scale",
          "next_funding_time"
        ],
        "additionalProperties": false,
        "description": "Canonical owner publication. Fixed-point coefficients and scales; revision is used for modify preconditions. Lifecycle fields and attached orders are observations, not command receipt completion."
      },
      "OrderAmendment": {
        "type": "object",
        "properties": {
          "slot_id": {
            "type": "string"
          },
          "order_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact current Liftx physical order UUID, not an exchange order ID."
          },
          "price_atomic": {
            "type": "string",
            "pattern": "^-?[0-9]{1,128}$"
          },
          "price_scale": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 30
          },
          "quantity_atomic": {
            "type": "string",
            "pattern": "^-?[0-9]{1,128}$"
          },
          "quantity_scale": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 30
          }
        },
        "required": [],
        "additionalProperties": false,
        "description": "Existing amendment decoder accepts optional exact slot/order identity and optional paired price/quantity fields; trading owner validates applicability. Preserve identities from the current modification snapshot."
      },
      "PositionRequest": {
        "type": "object",
        "properties": {
          "action": {
            "type": "integer",
            "const": 1
          },
          "instrument_id": {
            "type": "string",
            "description": "Opaque canonical catalog ID on the exact exchange link. Determines spot/derivative/inverse topology; never derive from chart ticker."
          },
          "trading_currency": {
            "type": "string",
            "description": "Eligible spot settlement currency; preserve canonical currency on modification."
          },
          "quantity_asset": {
            "type": "string",
            "description": "Catalog base or quote asset for input quantities. Normalization and venue contract conversion remain adapter-owned."
          },
          "position_side": {
            "type": "integer",
            "enum": [
              1,
              2
            ],
            "description": "1 long; 2 short. Immutable after creation; exact catalog/account eligibility applies."
          },
          "open_order_type": {
            "type": "integer",
            "format": "int64",
            "enum": [
              1,
              2,
              3
            ],
            "description": "1 limit, 2 market, 3 virtual limit. Supported combinations depend on the typed adapter and order role."
          },
          "exchange_link_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "open_slot_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 65535
          },
          "order_amendments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderAmendment"
            }
          },
          "margin_mode": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64",
                "enum": [
                  1,
                  2
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Derivatives: 1 cross, 2 isolated. Required on creation and immutable thereafter."
          },
          "leverage": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64",
                "minimum": 1,
                "maximum": 32767
              },
              {
                "type": "null"
              }
            ],
            "description": "Required positive derivative creation leverage within the exact catalog/adapter limit; omit unchanged leverage on modify to avoid unnecessary preflight."
          },
          "order_grid_enabled": {
            "type": "boolean"
          },
          "num_open_orders": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "maximum": 65535
              },
              {
                "type": "null"
              }
            ]
          },
          "sl_enabled": {
            "type": "boolean"
          },
          "sl_type": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64",
                "enum": [
                  1,
                  2
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "1 from position, 2 from average."
          },
          "sl_step_percent": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ],
            "description": "Percentage points multiplied by 1,000,000; trading owner validates applicability."
          },
          "sl_price_rearrangement": {
            "type": "boolean"
          },
          "sl_order_type": {
            "type": "integer",
            "format": "int64",
            "enum": [
              1,
              2,
              3
            ],
            "description": "1 limit, 2 market, 3 virtual limit. Supported combinations depend on the typed adapter and order role."
          },
          "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"
              }
            ],
            "description": "Percentage points multiplied by 1,000,000; trading owner validates applicability."
          },
          "slx_sl_trigger_price_trailing_enabled": {
            "type": "boolean"
          },
          "slx_sl_trigger_price_trailing_pl_percent_activation": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ],
            "description": "Percentage points multiplied by 1,000,000; trading owner validates applicability."
          },
          "slx_sl_trigger_price_trailing_indent_percent": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ],
            "description": "Percentage points multiplied by 1,000,000; trading owner validates applicability."
          },
          "slx_sl_trigger_price_trailing_step": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ],
            "description": "Percentage points multiplied by 1,000,000; trading owner validates applicability."
          },
          "tp_enabled": {
            "type": "boolean"
          },
          "tp_price_rearrangement": {
            "type": "boolean"
          },
          "tp_grid_enabled": {
            "type": "boolean"
          },
          "num_tp_orders": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "maximum": 65535
              },
              {
                "type": "null"
              }
            ]
          },
          "tp_quantity_percents": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32",
              "minimum": 1,
              "maximum": 2147483647
            },
            "maxItems": 65535,
            "description": "Required for enabled TP. Preserve builder weights: single full TP uses 1000000; grid weights use percentage points times 1000000. Canonical protection normalization handles both."
          },
          "tp_pnls": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            },
            "maxItems": 65535,
            "description": "Required for enabled TP. Rearranged TP: positive price-distance percent from fee-aware breakeven times 1000000, maximum 100000000; not leveraged ROI. Static unused entries may be zero."
          },
          "tp_slot_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 65535
          },
          "tp_order_type": {
            "type": "integer",
            "format": "int64",
            "enum": [
              1,
              2,
              3
            ],
            "description": "1 limit, 2 market, 3 virtual limit. Supported combinations depend on the typed adapter and order role."
          },
          "open_prices_atomic": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^-?[0-9]{1,128}$"
            },
            "maxItems": 65535
          },
          "open_prices_scale": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 30
            },
            "maxItems": 65535
          },
          "open_quantities_atomic": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^-?[0-9]{1,128}$"
            },
            "maxItems": 65535
          },
          "open_quantities_scale": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 30
            },
            "maxItems": 65535
          },
          "tp_prices_atomic": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^-?[0-9]{1,128}$"
            },
            "maxItems": 65535
          },
          "tp_prices_scale": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 30
            },
            "maxItems": 65535
          },
          "tp_quantities_atomic": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^-?[0-9]{1,128}$"
            },
            "maxItems": 65535,
            "description": "Builder may use zero placeholders; canonical protection owner sizes from actual exposure and TP weights."
          },
          "tp_quantities_scale": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 30
            },
            "maxItems": 65535
          },
          "sl_price_atomic": {
            "type": "string",
            "pattern": "^-?[0-9]{1,128}$"
          },
          "sl_price_scale": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30
          },
          "slx_activation_price_atomic": {
            "type": "string",
            "pattern": "^-?[0-9]{1,128}$"
          },
          "slx_activation_price_scale": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30
          },
          "slx_price_atomic": {
            "type": "string",
            "pattern": "^-?[0-9]{1,128}$"
          },
          "slx_price_scale": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30
          }
        },
        "required": [
          "action",
          "instrument_id",
          "exchange_link_id",
          "quantity_asset",
          "position_side",
          "open_order_type",
          "order_grid_enabled",
          "open_prices_atomic",
          "open_prices_scale",
          "open_quantities_atomic",
          "open_quantities_scale",
          "sl_enabled",
          "slx_enabled",
          "tp_enabled"
        ],
        "additionalProperties": false,
        "description": "Existing PositionRequest codec, also used by advanced TradingView. Paired row arrays must have equal lengths. Adapter batch limits and 256 KiB command body apply below the post-decode row ceiling. Creation and enabled protections require their operational fields. API modify requires outer expected_revision and fresh exact slot/order identities. TV modify must preserve OPEN rows. See position-request.md for all fields and units.",
        "allOf": [
          {
            "if": {
              "properties": {
                "sl_enabled": {
                  "const": true
                }
              },
              "required": [
                "sl_enabled"
              ]
            },
            "then": {
              "required": [
                "sl_price_rearrangement",
                "sl_order_type"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "tp_enabled": {
                  "const": true
                }
              },
              "required": [
                "tp_enabled"
              ]
            },
            "then": {
              "required": [
                "tp_price_rearrangement",
                "tp_grid_enabled",
                "tp_order_type",
                "tp_prices_atomic",
                "tp_prices_scale",
                "tp_quantities_atomic",
                "tp_quantities_scale",
                "tp_quantity_percents",
                "tp_pnls"
              ]
            }
          }
        ]
      },
      "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
      },
      "PositionsPage": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "exchange_link_id": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "request_id": {
            "type": "integer",
            "format": "int64"
          },
          "offset": {
            "type": "integer",
            "format": "int64"
          },
          "limit": {
            "type": "integer",
            "format": "int64"
          },
          "total": {
            "type": "integer",
            "format": "int64"
          },
          "has_more": {
            "type": "boolean"
          },
          "positions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Position"
            }
          },
          "incomplete": {
            "type": "boolean"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "has_more",
          "positions"
        ],
        "additionalProperties": false
      },
      "Balances": {
        "type": "object",
        "properties": {
          "exchange_link_id": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "updates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "asset": {
                  "type": "string"
                },
                "free_atomic": {
                  "type": "string"
                },
                "free_scale": {
                  "type": "integer",
                  "format": "int64"
                }
              },
              "required": [
                "asset",
                "free_atomic",
                "free_scale"
              ],
              "additionalProperties": false
            }
          },
          "snapshot_complete": {
            "type": "boolean"
          }
        },
        "required": [
          "exchange_link_id",
          "updates"
        ],
        "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
      },
      "ReceiptPage": {
        "type": "object",
        "properties": {
          "commands": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Receipt"
            }
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "commands",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "Command": {
        "type": "object",
        "properties": {
          "client_command_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Unique immutable namespace event identity; liftx-group: prefix is reserved."
          },
          "issued_at": {
            "type": "integer",
            "format": "int64"
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          },
          "action": {
            "type": "string",
            "enum": [
              "open",
              "modify",
              "terminate"
            ]
          },
          "exchange_link_id": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "instrument_id": {
            "type": "string"
          },
          "position_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_revision": {
            "type": "integer",
            "minimum": 1
          },
          "request": {
            "$ref": "#/components/schemas/PositionRequest"
          },
          "target": {
            "type": "string",
            "const": "position",
            "description": "Optional explicit exact-position target; group selectors are TradingView-only."
          }
        },
        "required": [
          "client_command_id",
          "issued_at",
          "expires_at",
          "action",
          "exchange_link_id",
          "instrument_id"
        ],
        "additionalProperties": false,
        "description": "Immutable namespace+client ID; lifespan <=300s. Open omits position_id; modify/terminate require it. Modify requires expected_revision; terminate omits request. Open/modify require request. Identical retries return original receipt, changed payload is 409.",
        "allOf": [
          {
            "if": {
              "properties": {
                "action": {
                  "const": "open"
                }
              }
            },
            "then": {
              "required": [
                "request"
              ],
              "not": {
                "required": [
                  "position_id"
                ]
              }
            }
          },
          {
            "if": {
              "properties": {
                "action": {
                  "const": "modify"
                }
              }
            },
            "then": {
              "required": [
                "request",
                "position_id",
                "expected_revision"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "action": {
                  "const": "terminate"
                }
              }
            },
            "then": {
              "required": [
                "position_id"
              ],
              "not": {
                "required": [
                  "request"
                ]
              }
            }
          }
        ]
      },
      "TradingViewCommand": {
        "type": "object",
        "properties": {
          "client_command_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Unique immutable namespace event identity; liftx-group: prefix is reserved."
          },
          "issued_at": {
            "type": "integer",
            "format": "int64"
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          },
          "action": {
            "type": "string",
            "enum": [
              "open",
              "modify",
              "terminate",
              "cancel",
              "close"
            ]
          },
          "exchange_link_id": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "instrument_id": {
            "type": "string"
          },
          "expected_revision": {
            "type": "integer",
            "minimum": 1
          },
          "request": {
            "$ref": "#/components/schemas/PositionRequest"
          },
          "client_position_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "position_started_at": {
            "type": "integer",
            "minimum": 1
          },
          "source_instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "minimum": 1
          },
          "binding_revision": {
            "type": "integer",
            "minimum": 1
          },
          "target": {
            "type": "string",
            "enum": [
              "position",
              "strategy",
              "market"
            ],
            "description": "Omitted/position requires exact lifecycle reference. Strategy or market selects termination groups only; market requires the immutable grant."
          }
        },
        "required": [
          "client_command_id",
          "issued_at",
          "expires_at",
          "action",
          "exchange_link_id",
          "instrument_id",
          "source_instance_id",
          "sequence",
          "binding_revision"
        ],
        "additionalProperties": false,
        "description": "Immutable source/revision and exact market. Each new OPEN uses a new lifecycle reference and sequence above the source watermark. Known-position termination remains per-reference ordered; groups freeze at most 64 targets and never reselect on retry. Advanced OPEN and MODIFY use the existing PositionRequest; capped MODIFY preserves OPEN rows. Pine has no execution-feedback channel.",
        "allOf": [
          {
            "if": {
              "properties": {
                "target": {
                  "enum": [
                    "strategy",
                    "market"
                  ]
                }
              },
              "required": [
                "target"
              ]
            },
            "then": {
              "properties": {
                "action": {
                  "enum": [
                    "terminate",
                    "cancel",
                    "close"
                  ]
                }
              },
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "client_position_id"
                    ]
                  },
                  {
                    "required": [
                      "position_started_at"
                    ]
                  },
                  {
                    "required": [
                      "expected_revision"
                    ]
                  },
                  {
                    "required": [
                      "request"
                    ]
                  }
                ]
              }
            },
            "else": {
              "required": [
                "client_position_id",
                "position_started_at"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "action": {
                  "const": "modify"
                }
              },
              "required": [
                "action"
              ]
            },
            "then": {
              "required": [
                "request"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "action": {
                  "enum": [
                    "terminate",
                    "cancel",
                    "close"
                  ]
                }
              },
              "required": [
                "action"
              ]
            },
            "then": {
              "not": {
                "required": [
                  "request"
                ]
              }
            }
          }
        ]
      },
      "TradingViewEvent": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "writeOnly": true
          },
          "command": {
            "$ref": "#/components/schemas/TradingViewCommand"
          },
          "alert": {
            "$ref": "#/components/schemas/TradingViewAlert"
          }
        },
        "required": [
          "token"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "required": [
              "command"
            ],
            "not": {
              "required": [
                "alert"
              ]
            }
          },
          {
            "required": [
              "alert"
            ],
            "not": {
              "required": [
                "command"
              ]
            }
          }
        ],
        "description": "Exactly one non-null command or alert object. The restricted body token authenticates either transport; both converge on the same canonical command admission."
      },
      "CredentialRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "kind": {
            "type": "string",
            "enum": [
              "api",
              "tradingview"
            ]
          },
          "scopes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "read",
                "positions:open",
                "positions:modify",
                "positions:terminate",
                "templates:write"
              ]
            }
          },
          "exchange_link_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          "instrument_ids": {
            "type": "array",
            "maxItems": 64,
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          },
          "integration_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "name",
          "kind",
          "scopes",
          "exchange_link_ids",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "BindingRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "kind": {
            "type": "string",
            "const": "tradingview"
          },
          "scopes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "positions:open",
                "positions:modify",
                "positions:terminate"
              ]
            }
          },
          "exchange_link_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          "instrument_ids": {
            "type": "array",
            "maxItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string"
            },
            "minItems": 1
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          },
          "mode": {
            "type": "string",
            "enum": [
              "guided",
              "advanced"
            ]
          },
          "position_request": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PositionRequest"
              },
              {
                "type": "null"
              }
            ]
          },
          "max_quantity": {
            "type": "string",
            "maxLength": 128
          },
          "source_instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "position_mode": {
            "type": "string",
            "enum": [
              "single",
              "multiple"
            ],
            "description": "Single rejects a new OPEN while this setup has known active or pending/uncertain work. Multiple permits distinct simultaneous lifecycle references."
          },
          "allow_market_terminate": {
            "type": "boolean",
            "description": "Explicit permission for termination targeting all captured Liftx positions on the exact linked market, including manual and other strategies. Immutable and fresh-auth bound."
          }
        },
        "required": [
          "name",
          "kind",
          "scopes",
          "exchange_link_ids",
          "instrument_ids",
          "expires_at",
          "mode",
          "max_quantity",
          "source_instance_id",
          "position_mode",
          "allow_market_terminate"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "if": {
              "properties": {
                "mode": {
                  "const": "guided"
                }
              },
              "required": [
                "mode"
              ]
            },
            "then": {
              "required": [
                "position_request"
              ],
              "properties": {
                "position_request": {
                  "$ref": "#/components/schemas/PositionRequest"
                }
              }
            },
            "else": {
              "properties": {
                "position_request": {
                  "type": "null"
                }
              }
            }
          }
        ]
      },
      "Proof": {
        "type": "object",
        "properties": {
          "password": {
            "type": "string",
            "maxLength": 128,
            "writeOnly": true
          },
          "apple_token": {
            "type": "string",
            "maxLength": 4096,
            "writeOnly": true
          },
          "mfa_code": {
            "type": "string",
            "pattern": "^[0-9]{6}$",
            "writeOnly": true
          }
        },
        "required": [],
        "additionalProperties": false,
        "oneOf": [
          {
            "required": [
              "password"
            ],
            "not": {
              "required": [
                "apple_token"
              ]
            }
          },
          {
            "required": [
              "apple_token"
            ],
            "not": {
              "required": [
                "password"
              ]
            }
          }
        ]
      },
      "Challenge": {
        "type": "object",
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "methods": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "password",
                "apple"
              ]
            }
          },
          "apple_nonce": {
            "type": "string"
          },
          "mfa_required": {
            "type": "boolean"
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "operation_id",
          "methods",
          "mfa_required",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "Approval": {
        "type": "object",
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "approved": {
            "const": true
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "operation_id",
          "approved",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "IssuedCredential": {
        "type": "object",
        "properties": {
          "credential": {
            "$ref": "#/components/schemas/Credential"
          },
          "binding": {
            "$ref": "#/components/schemas/Binding"
          },
          "secret": {
            "type": "string",
            "readOnly": true,
            "description": "One-time secret on successful first issuance only."
          },
          "webhook_url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "credential"
        ],
        "additionalProperties": false,
        "description": "Secret only on first successful issue; duplicates return metadata. Never automatically repeat issuance after ambiguity."
      },
      "Scope": {
        "type": "object",
        "properties": {
          "exchange_link_id": {
            "type": "integer",
            "format": "int64"
          },
          "environment": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          }
        },
        "required": [
          "exchange_link_id",
          "environment",
          "currency"
        ],
        "additionalProperties": false
      },
      "PNLSelection": {
        "type": "object",
        "properties": {
          "market": {
            "type": "string"
          },
          "pair_id": {
            "type": "string"
          }
        },
        "required": [
          "market",
          "pair_id"
        ],
        "additionalProperties": false
      },
      "Pair": {
        "type": "object",
        "properties": {
          "pair_id": {
            "type": "string"
          },
          "base": {
            "type": "string"
          },
          "quote": {
            "type": "string"
          }
        },
        "required": [
          "pair_id",
          "base",
          "quote"
        ],
        "additionalProperties": false
      },
      "PairOptions": {
        "type": "object",
        "properties": {
          "scope": {
            "$ref": "#/components/schemas/Scope"
          },
          "market": {
            "type": "string"
          },
          "search": {
            "type": "string"
          },
          "cursor": {
            "type": "string"
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Pair"
            }
          },
          "next_cursor": {
            "type": "string"
          }
        },
        "required": [
          "scope",
          "market",
          "search",
          "cursor",
          "options",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "Decimal": {
        "type": "object",
        "properties": {
          "atomic": {
            "type": "string"
          },
          "scale": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "atomic",
          "scale"
        ],
        "additionalProperties": false
      },
      "HistoryPoint": {
        "type": "object",
        "properties": {
          "rate_at": {
            "type": "integer",
            "format": "int64"
          },
          "time": {
            "type": "integer",
            "format": "int64"
          },
          "value": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Decimal"
              },
              {
                "type": "null"
              }
            ]
          },
          "complete": {
            "type": "boolean"
          },
          "resolution": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "rate_at",
          "time",
          "value",
          "complete",
          "resolution"
        ],
        "additionalProperties": false
      },
      "History": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "string"
          },
          "scope": {
            "$ref": "#/components/schemas/Scope"
          },
          "as_of": {
            "type": "integer",
            "format": "int64"
          },
          "points": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HistoryPoint"
            }
          },
          "before": {
            "type": "integer",
            "format": "int64"
          },
          "after": {
            "type": "integer",
            "format": "int64"
          },
          "selection": {
            "$ref": "#/components/schemas/PNLSelection"
          }
        },
        "required": [
          "revision",
          "scope",
          "as_of",
          "points",
          "before",
          "after",
          "selection"
        ],
        "additionalProperties": false
      },
      "PositionHistory": {
        "type": "object",
        "properties": {
          "position_id": {
            "type": "string"
          },
          "quote": {
            "type": "string"
          },
          "from": {
            "type": "integer",
            "format": "int64"
          },
          "to": {
            "type": "integer",
            "format": "int64"
          },
          "as_of": {
            "type": "integer",
            "format": "int64"
          },
          "history_from": {
            "type": "integer",
            "format": "int64"
          },
          "history_at": {
            "type": "integer",
            "format": "int64"
          },
          "after": {
            "type": "integer",
            "format": "int64"
          },
          "complete": {
            "type": "boolean"
          },
          "terminal": {
            "type": "boolean"
          },
          "reset_required": {
            "type": "boolean"
          },
          "points": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PositionHistoryPoint"
            }
          }
        },
        "required": [
          "position_id",
          "quote",
          "from",
          "to",
          "as_of",
          "history_from",
          "history_at",
          "after",
          "complete",
          "terminal",
          "reset_required",
          "points"
        ],
        "additionalProperties": false
      },
      "LiquidationTier": {
        "type": "object",
        "properties": {
          "min_size": {
            "type": "string"
          },
          "max_size": {
            "type": "string"
          },
          "maintenance_rate": {
            "type": "string"
          }
        },
        "required": [
          "min_size",
          "max_size",
          "maintenance_rate"
        ],
        "additionalProperties": false
      },
      "LiquidationContext": {
        "type": "object",
        "properties": {
          "tiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LiquidationTier"
            }
          },
          "expiration": {
            "type": "integer",
            "format": "int64"
          },
          "unavailable": {
            "type": "string"
          }
        },
        "required": [
          "tiers",
          "expiration"
        ],
        "additionalProperties": false
      },
      "TradingCurrencies": {
        "type": "object",
        "properties": {
          "currencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "currencies"
        ],
        "additionalProperties": false
      },
      "FeeRate": {
        "type": "object",
        "properties": {
          "instrument_type": {
            "type": "integer",
            "format": "int64"
          },
          "fee_schedule_id": {
            "type": "string"
          },
          "maker": {
            "type": "string"
          },
          "taker": {
            "type": "string"
          }
        },
        "required": [
          "instrument_type",
          "fee_schedule_id",
          "maker",
          "taker"
        ],
        "additionalProperties": false
      },
      "PositionHistoryPoint": {
        "type": "object",
        "properties": {
          "rate_at": {
            "type": "integer",
            "format": "int64"
          },
          "time": {
            "type": "integer",
            "format": "int64"
          },
          "value": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Decimal"
              },
              {
                "type": "null"
              }
            ]
          },
          "complete": {
            "type": "boolean"
          },
          "resolution": {
            "type": "integer",
            "format": "int64"
          },
          "gap_before": {
            "type": "boolean"
          }
        },
        "required": [
          "rate_at",
          "time",
          "value",
          "complete",
          "resolution",
          "gap_before"
        ],
        "additionalProperties": false
      },
      "Symbol": {
        "type": "object",
        "properties": {
          "instrument_id": {
            "type": "string"
          },
          "fee_schedule_id": {
            "type": "string"
          },
          "base": {
            "type": "string"
          },
          "quote": {
            "type": "string"
          },
          "lot_size_atomic": {
            "type": "string"
          },
          "lot_size_scale": {
            "type": "integer",
            "format": "int64"
          },
          "tick_size_atomic": {
            "type": "string"
          },
          "tick_size_scale": {
            "type": "integer",
            "format": "int64"
          },
          "instrument_type": {
            "type": "integer",
            "format": "int64"
          },
          "instrument_topology": {
            "type": "integer",
            "format": "int64"
          },
          "leverage": {
            "type": "integer",
            "format": "int64"
          },
          "min_size_atomic": {
            "type": "string"
          },
          "min_size_scale": {
            "type": "integer",
            "format": "int64"
          },
          "contract_value_atomic": {
            "type": "string"
          },
          "contract_value_scale": {
            "type": "integer",
            "format": "int64"
          },
          "max_limit_size_atomic": {
            "type": "string"
          },
          "max_limit_size_scale": {
            "type": "integer",
            "format": "int64"
          },
          "max_market_size_atomic": {
            "type": "string"
          },
          "max_market_size_scale": {
            "type": "integer",
            "format": "int64"
          },
          "max_limit_amount_atomic": {
            "type": "string"
          },
          "max_limit_amount_scale": {
            "type": "integer",
            "format": "int64"
          },
          "max_market_amount_atomic": {
            "type": "string"
          },
          "max_market_amount_scale": {
            "type": "integer",
            "format": "int64"
          },
          "symbol_hash": {
            "type": "string"
          },
          "state": {
            "type": "string"
          }
        },
        "required": [
          "instrument_id",
          "fee_schedule_id",
          "base",
          "quote",
          "lot_size_atomic",
          "lot_size_scale",
          "tick_size_atomic",
          "tick_size_scale",
          "instrument_type",
          "instrument_topology",
          "leverage",
          "min_size_atomic",
          "min_size_scale",
          "contract_value_atomic",
          "contract_value_scale",
          "state"
        ],
        "additionalProperties": false
      },
      "GroupProgress": {
        "type": "object",
        "properties": {
          "target": {
            "type": "string",
            "enum": [
              "strategy",
              "market"
            ]
          },
          "target_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 64
          },
          "counts": {
            "type": "object",
            "properties": {
              "accepted": {
                "type": "integer",
                "minimum": 0,
                "maximum": 64
              },
              "dispatching": {
                "type": "integer",
                "minimum": 0,
                "maximum": 64
              },
              "execution_observed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 64
              },
              "handed_off": {
                "type": "integer",
                "minimum": 0,
                "maximum": 64
              },
              "rejected": {
                "type": "integer",
                "minimum": 0,
                "maximum": 64
              },
              "expired": {
                "type": "integer",
                "minimum": 0,
                "maximum": 64
              },
              "operator_required": {
                "type": "integer",
                "minimum": 0,
                "maximum": 64
              }
            },
            "required": [
              "accepted",
              "dispatching",
              "execution_observed",
              "handed_off",
              "rejected",
              "expired",
              "operator_required"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "target",
          "target_count",
          "counts"
        ],
        "additionalProperties": false,
        "description": "Counts sum to the immutable target_count. Zero targets records an observed empty selection, not market flatness."
      },
      "TradingViewAlert": {
        "type": "object",
        "properties": {
          "fired_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$",
            "description": "TradingView {{timenow}} after substitution. UTC whole-second trigger time; no offset or fractions."
          },
          "action": {
            "type": "string",
            "enum": [
              "open",
              "terminate"
            ]
          },
          "target": {
            "type": "string",
            "enum": [
              "position",
              "strategy",
              "market"
            ]
          },
          "exchange_link_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "instrument_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "source_instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "binding_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "max_lag_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 300
          },
          "request": {
            "$ref": "#/components/schemas/PositionRequest"
          }
        },
        "required": [
          "fired_at",
          "action",
          "target",
          "exchange_link_id",
          "instrument_id",
          "source_instance_id",
          "binding_revision",
          "max_lag_seconds"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "if": {
              "properties": {
                "action": {
                  "const": "open"
                }
              }
            },
            "then": {
              "properties": {
                "target": {
                  "const": "position"
                }
              }
            },
            "else": {
              "properties": {
                "target": {
                  "enum": [
                    "strategy",
                    "market"
                  ]
                }
              },
              "not": {
                "required": [
                  "request"
                ]
              }
            }
          }
        ],
        "description": "Ordinary OPEN/EXIT alert pair. Guided OPEN omits request; advanced OPEN requires full canonical request. OPEN identity/reference are derived from source and fired second. Sequence is Unix milliseconds with termination ranked +1. One distinct OPEN and EXIT per second per setup; identical payload duplicates return original receipt, changed payload conflicts. EXIT has no exact lifecycle reference. Source authority, permissions, quantity cap, receipt and trading execution remain canonical. Do not mix this pair with a Pine producer."
      },
      "GroupTargetReceipt": {
        "type": "object",
        "description": "One captured termination target in a group receipt. Targets are ordinary command receipts, never nested groups. Each identifies its frozen position and parent group. Its state and durable terminal-request fields do not prove exposure is flat.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "client_command_id": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "const": "terminate",
            "description": "Every captured group target is an ordinary termination command."
          },
          "state": {
            "type": "string",
            "enum": [
              "accepted",
              "dispatching",
              "handed_off",
              "execution_observed",
              "rejected",
              "expired",
              "operator_required"
            ]
          },
          "position_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact position UUID frozen into this group target at admission."
          },
          "error_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          },
          "terminal_request_kind": {
            "type": "integer",
            "enum": [
              1,
              2
            ]
          },
          "terminal_request_seq": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "group_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact parent group UUID; always present on a captured target."
          }
        },
        "required": [
          "id",
          "client_command_id",
          "action",
          "state",
          "position_id",
          "error_code",
          "created_at",
          "updated_at",
          "group_id"
        ],
        "additionalProperties": false,
        "dependentRequired": {
          "terminal_request_kind": [
            "terminal_request_seq"
          ],
          "terminal_request_seq": [
            "terminal_request_kind"
          ]
        }
      }
    }
  }
}
