{
  "$schema": "../rpc-schema-draft.json",
  "type": "object",
  "rpc": "disconnect",
  "title": "Command for disconnecting from another lightning node",
  "description": [
    "The disconnect RPC command closes an existing connection to a peer, identified by *id*, in the Lightning Network, as long as it doesn't have an active channel."
  ],
  "request": {
    "required": [
      "id"
    ],
    "additionalProperties": false,
    "properties": {
      "id": {
        "type": "pubkey",
        "description": [
          "The public key of the peer to terminate the connection. It can be discovered as peer_id in the output of the listpeerchannels command."
        ]
      },
      "force": {
        "type": "boolean",
        "description": [
          "If set to True, it will disconnect even with an active channel."
        ]
      }
    }
  },
  "response": {
    "additionalProperties": false,
    "properties": {}
  },
  "errors": [
    "On error the returned object will contain `code` and `message` properties, with `code` being one of the following:",
    "",
    "- -32602: If the given parameters are wrong.",
    "- -1: Catchall nonspecific error."
  ],
  "author": [
    "Michael Hawkins [michael.hawkins@protonmail.com](mailto:michael.hawkins@protonmail.com)."
  ],
  "see_also": [
    "lightning-connect(7)",
    "lightning-listpeerchannels(7)"
  ],
  "resources": [
    "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
  ],
  "examples": [
    {
      "request": {
        "id": "example:disconnect#1",
        "method": "disconnect",
        "params": {
          "id": "nodeid040404040404040404040404040404040404040404040404040404040404",
          "force": false
        }
      },
      "response": {}
    },
    {
      "request": {
        "id": "example:disconnect#2",
        "method": "disconnect",
        "params": {
          "id": "nodeid050505050505050505050505050505050505050505050505050505050505",
          "force": true
        }
      },
      "response": {}
    }
  ]
}
