{
  "swagger": "2.0",
  "info": {
    "title": "xudrpc.proto",
    "version": "version not set"
  },
  "schemes": [
    "http",
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/v1/cancelorder": {
      "post": {
        "summary": "Cancel placed order from the orderbook.",
        "operationId": "CancelOrder",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/xudrpcCancelOrderResponse"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/xudrpcCancelOrderRequest"
            }
          }
        ],
        "tags": [
          "Xud"
        ]
      }
    },
    "/v1/connect": {
      "post": {
        "summary": "Connect to an XU node.",
        "operationId": "Connect",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/xudrpcConnectResponse"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/xudrpcConnectRequest"
            }
          }
        ],
        "tags": [
          "Xud"
        ]
      }
    },
    "/v1/disconnect": {
      "post": {
        "summary": "Disconnect from a connected peer XU node.",
        "operationId": "Disconnect",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/xudrpcDisconnectResponse"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/xudrpcDisconnectRequest"
            }
          }
        ],
        "tags": [
          "Xud"
        ]
      }
    },
    "/v1/executeswap": {
      "post": {
        "summary": "Execute an atomic swap",
        "operationId": "ExecuteSwap",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/xudrpcExecuteSwapResponse"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/xudrpcExecuteSwapRequest"
            }
          }
        ],
        "tags": [
          "Xud"
        ]
      }
    },
    "/v1/info": {
      "get": {
        "summary": "Get general information about this Exchange Union node.",
        "operationId": "GetInfo",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/xudrpcGetInfoResponse"
            }
          }
        },
        "tags": [
          "Xud"
        ]
      }
    },
    "/v1/orders": {
      "get": {
        "summary": "Get a list of standing orders from the order book.",
        "operationId": "GetOrders",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/xudrpcGetOrdersResponse"
            }
          }
        },
        "parameters": [
          {
            "name": "pair_id",
            "description": "The trading pair for which to retrieve orders.",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "max_results",
            "description": "The maximum number of orders to return from either side of the order book.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int64"
          }
        ],
        "tags": [
          "Xud"
        ]
      }
    },
    "/v1/pairs": {
      "get": {
        "summary": "Get the list of the order book's available pairs.",
        "operationId": "GetPairs",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/xudrpcGetPairsResponse"
            }
          }
        },
        "tags": [
          "Xud"
        ]
      }
    },
    "/v1/peers": {
      "get": {
        "summary": "Get a list of connected peers.",
        "operationId": "ListPeers",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/xudrpcListPeersResponse"
            }
          }
        },
        "tags": [
          "Xud"
        ]
      }
    },
    "/v1/placeorder": {
      "post": {
        "summary": "Add an order to the order book.\nIf price is zero or unspecified a market order will get added.",
        "operationId": "PlaceOrder",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/xudrpcPlaceOrderResponse"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/xudrpcPlaceOrderRequest"
            }
          }
        ],
        "tags": [
          "Xud"
        ]
      }
    },
    "/v1/shutdown": {
      "post": {
        "summary": "Begin shutting down xud.",
        "operationId": "Shutdown",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/xudrpcShutdownResponse"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/xudrpcShutdownRequest"
            }
          }
        ],
        "tags": [
          "Xud"
        ]
      }
    },
    "/v1/subscribepeerorders": {
      "get": {
        "summary": "Subscribe to peer order events.",
        "operationId": "SubscribePeerOrders",
        "responses": {
          "200": {
            "description": "(streaming responses)",
            "schema": {
              "$ref": "#/definitions/xudrpcSubscribePeerOrdersResponse"
            }
          }
        },
        "tags": [
          "Xud"
        ]
      }
    },
    "/v1/subscribeswaps": {
      "get": {
        "summary": "Subscribe executed swaps.",
        "operationId": "SubscribeSwaps",
        "responses": {
          "200": {
            "description": "(streaming responses)",
            "schema": {
              "$ref": "#/definitions/xudrpcSubscribeSwapsResponse"
            }
          }
        },
        "tags": [
          "Xud"
        ]
      }
    }
  },
  "definitions": {
    "xudrpcCancelOrderRequest": {
      "type": "object",
      "properties": {
        "order_id": {
          "type": "string",
          "title": "The local id of the order to cancel"
        },
        "pair_id": {
          "type": "string",
          "title": "The trading pair that the order to cancel is for"
        }
      }
    },
    "xudrpcCancelOrderResponse": {
      "type": "object",
      "properties": {
        "canceled": {
          "type": "boolean",
          "format": "boolean",
          "title": "Indicates whether an order was successfully canceled"
        }
      }
    },
    "xudrpcConnectRequest": {
      "type": "object",
      "properties": {
        "host": {
          "type": "string"
        },
        "port": {
          "type": "integer",
          "format": "int64"
        },
        "node_pub_key": {
          "type": "string"
        }
      }
    },
    "xudrpcConnectResponse": {
      "type": "object",
      "properties": {
        "result": {
          "type": "string",
          "title": "A message describing the result of the connection request"
        }
      }
    },
    "xudrpcDisconnectRequest": {
      "type": "object",
      "properties": {
        "node_pub_key": {
          "type": "string"
        }
      }
    },
    "xudrpcDisconnectResponse": {
      "type": "object",
      "properties": {
        "result": {
          "type": "string"
        }
      }
    },
    "xudrpcExecuteSwapRequest": {
      "type": "object",
      "properties": {
        "target_address": {
          "type": "string"
        },
        "payload": {
          "$ref": "#/definitions/xudrpcSwapPayload"
        }
      }
    },
    "xudrpcExecuteSwapResponse": {
      "type": "object",
      "properties": {
        "result": {
          "type": "string"
        }
      }
    },
    "xudrpcGetInfoResponse": {
      "type": "object",
      "properties": {
        "num_peers": {
          "type": "integer",
          "format": "int32"
        },
        "num_pairs": {
          "type": "integer",
          "format": "int32"
        },
        "version": {
          "type": "string"
        },
        "orders": {
          "$ref": "#/definitions/xudrpcOrdersCount"
        },
        "lndbtc": {
          "$ref": "#/definitions/xudrpcLndInfo"
        },
        "lndltc": {
          "$ref": "#/definitions/xudrpcLndInfo"
        },
        "raiden": {
          "$ref": "#/definitions/xudrpcRaidenInfo"
        }
      }
    },
    "xudrpcGetOrdersResponse": {
      "type": "object",
      "properties": {
        "peer_orders": {
          "$ref": "#/definitions/xudrpcOrders",
          "title": "A list of peer orders"
        },
        "own_orders": {
          "$ref": "#/definitions/xudrpcOrders",
          "title": "A list of orders placed locally"
        }
      }
    },
    "xudrpcGetPairsResponse": {
      "type": "object",
      "properties": {
        "pairs": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/xudrpcPair"
          }
        }
      }
    },
    "xudrpcListPeersResponse": {
      "type": "object",
      "properties": {
        "peers": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/xudrpcPeer"
          }
        }
      }
    },
    "xudrpcLndChannels": {
      "type": "object",
      "properties": {
        "active": {
          "type": "integer",
          "format": "int32"
        },
        "inactive": {
          "type": "integer",
          "format": "int32"
        },
        "pending": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "xudrpcLndInfo": {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "channels": {
          "$ref": "#/definitions/xudrpcLndChannels"
        },
        "chains": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "blockheight": {
          "type": "integer",
          "format": "int32"
        },
        "uris": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "version": {
          "type": "string"
        }
      }
    },
    "xudrpcOrder": {
      "type": "object",
      "properties": {
        "price": {
          "type": "number",
          "format": "double",
          "description": "The price of the order, precise to 6 decimal places."
        },
        "quantity": {
          "type": "number",
          "format": "double",
          "description": "The quantity of the order, precise to 6 decimal places."
        },
        "pair_id": {
          "type": "string",
          "title": "The trading pair that this order is for"
        },
        "peer_pub_key": {
          "type": "string",
          "title": "The node pub key of the peer that created this order"
        },
        "id": {
          "type": "string",
          "title": "A UUID for this order"
        },
        "local_id": {
          "type": "string",
          "title": "The local id for this order"
        },
        "created_at": {
          "type": "string",
          "format": "int64",
          "title": "The epoch time when this order was created"
        },
        "invoice": {
          "type": "string",
          "title": "Lightning invoice"
        },
        "canceled": {
          "type": "boolean",
          "format": "boolean",
          "title": "Indicates whether an order was canceled"
        }
      }
    },
    "xudrpcOrderMatch": {
      "type": "object",
      "properties": {
        "maker": {
          "$ref": "#/definitions/xudrpcOrder"
        },
        "taker": {
          "$ref": "#/definitions/xudrpcOrder"
        }
      }
    },
    "xudrpcOrders": {
      "type": "object",
      "properties": {
        "buy_orders": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/xudrpcOrder"
          },
          "title": "A list of buy orders sorted by descending price"
        },
        "sell_orders": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/xudrpcOrder"
          },
          "title": "A list of sell orders sorted by ascending price"
        }
      }
    },
    "xudrpcOrdersCount": {
      "type": "object",
      "properties": {
        "peer": {
          "type": "integer",
          "format": "int32"
        },
        "own": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "xudrpcPair": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "base_currency": {
          "type": "string"
        },
        "quote_currency": {
          "type": "string"
        },
        "swap_protocol": {
          "type": "string"
        }
      }
    },
    "xudrpcPeer": {
      "type": "object",
      "properties": {
        "address": {
          "type": "string",
          "title": "The socket address with host and port for this peer"
        },
        "node_pub_key": {
          "type": "string",
          "title": "The node pub key to uniquely identify this peer"
        },
        "inbound": {
          "type": "boolean",
          "format": "boolean",
          "title": "Indicates whether this peer was connected inbound"
        },
        "pairs": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "title": "A list of trading pair tickers supported by this peer"
        },
        "xud_version": {
          "type": "string",
          "title": "The version of xud being used by the peer"
        },
        "seconds_connected": {
          "type": "integer",
          "format": "int32",
          "title": "The time in seconds that we have been connected to this peer"
        }
      }
    },
    "xudrpcPlaceOrderRequest": {
      "type": "object",
      "properties": {
        "price": {
          "type": "number",
          "format": "double",
          "description": "The price of the order, precise to 6 decimal places."
        },
        "quantity": {
          "type": "number",
          "format": "double",
          "description": "The quantity of the order, precise to 6 decimal places."
        },
        "pair_id": {
          "type": "string",
          "title": "The trading pair that the order is for"
        },
        "order_id": {
          "type": "string",
          "title": "The local id to assign to the order"
        }
      }
    },
    "xudrpcPlaceOrderResponse": {
      "type": "object",
      "properties": {
        "matches": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/xudrpcOrderMatch"
          },
          "title": "A list of orders matching the newly placed order"
        },
        "remaining_order": {
          "$ref": "#/definitions/xudrpcOrder",
          "title": "The remaining portion of the order, after matches, that enters the order book"
        }
      }
    },
    "xudrpcRaidenInfo": {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "address": {
          "type": "string"
        },
        "channels": {
          "type": "integer",
          "format": "int32"
        },
        "version": {
          "type": "string"
        }
      }
    },
    "xudrpcShutdownRequest": {
      "type": "object"
    },
    "xudrpcShutdownResponse": {
      "type": "object",
      "properties": {
        "result": {
          "type": "string",
          "title": "A message describing the result of the shutdown request"
        }
      }
    },
    "xudrpcSubscribePeerOrdersResponse": {
      "type": "object",
      "properties": {
        "order": {
          "$ref": "#/definitions/xudrpcOrder"
        }
      }
    },
    "xudrpcSubscribeSwapsResponse": {
      "type": "object",
      "properties": {
        "order": {
          "type": "string",
          "title": "The order which was executed for the swap with updated remaining quantity"
        }
      }
    },
    "xudrpcSwapPayload": {
      "type": "object",
      "properties": {
        "role": {
          "type": "string"
        },
        "sending_amount": {
          "type": "string",
          "format": "uint64"
        },
        "sending_token": {
          "type": "string"
        },
        "receiving_amount": {
          "type": "string",
          "format": "uint64"
        },
        "receiving_token": {
          "type": "string"
        },
        "node_pub_key": {
          "type": "string"
        }
      }
    }
  }
}
