{
  "$schema": "../rpc-schema-draft.json",
  "type": "object",
  "added": "v22.11",
  "rpc": "listinvoicerequests",
  "title": "Command for querying invoice_request status",
  "description": [
    "The **listinvoicerequests** RPC command gets the status of a specific `invoice_request`, if it exists, or the status of all `invoice_requests` if given no argument."
  ],
  "categories": [
    "readonly"
  ],
  "request": {
    "required": [],
    "additionalProperties": false,
    "properties": {
      "invreq_id": {
        "type": "string",
        "description": [
          "A specific invoice can be queried by providing the `invreq_id`, which is presented by lightning-invoicerequest(7), or can be calculated from a bolt12 invoice."
        ]
      },
      "active_only": {
        "type": "boolean",
        "description": [
          "If it is *True* then only active invoice requests are returned."
        ],
        "default": "*False*"
      }
    }
  },
  "response": {
    "required": [
      "invoicerequests"
    ],
    "additionalProperties": false,
    "properties": {
      "invoicerequests": {
        "type": "array",
        "items": {
          "type": "object",
          "additionalProperties": true,
          "required": [
            "invreq_id",
            "single_use",
            "active",
            "bolt12",
            "used"
          ],
          "properties": {
            "invreq_id": {
              "type": "hash",
              "description": [
                "The SHA256 hash of all invoice_request fields less than 160."
              ]
            },
            "active": {
              "type": "boolean",
              "description": [
                "Whether the invoice_request is currently active."
              ]
            },
            "single_use": {
              "type": "boolean",
              "description": [
                "Whether the invoice_request will become inactive after we pay an invoice for it."
              ]
            },
            "bolt12": {
              "type": "string",
              "description": [
                "The bolt12 string starting with lnr."
              ]
            },
            "used": {
              "type": "boolean",
              "description": [
                "Whether the invoice_request has already been used."
              ]
            },
            "label": {
              "type": "string",
              "description": [
                "The label provided when creating the invoice_request."
              ]
            }
          }
        }
      }
    }
  },
  "author": [
    "Rusty Russell [rusty@rustcorp.com.au](mailto:rusty@rustcorp.com.au) is mainly responsible."
  ],
  "see_also": [
    "lightning-invoicerequests(7)",
    "lightning-disableinvoicerequest(7)"
  ],
  "resources": [
    "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
  ],
  "examples": [
    {
      "request": {
        "id": "example:listinvoicerequests#1",
        "method": "listinvoicerequests",
        "params": [
          "invreqid03030303030303030303030303030303030303030303030303030303"
        ]
      },
      "response": {
        "invoicerequests": [
          {
            "invreq_id": "invreqid02020202020202020202020202020202020202020202020202020202",
            "active": false,
            "single_use": true,
            "bolt12": "lno1qgsq000bolt240002400024000240002400024000240002400024000240002400024000240002400024000240002400024000240002400024000240002400024000",
            "used": false
          }
        ]
      }
    },
    {
      "request": {
        "id": "example:listinvoicerequests#2",
        "method": "listinvoicerequests",
        "params": {}
      },
      "response": {
        "invoicerequests": [
          {
            "invreq_id": "invreqid02020202020202020202020202020202020202020202020202020202",
            "active": false,
            "single_use": true,
            "bolt12": "lno1qgsq000bolt240002400024000240002400024000240002400024000240002400024000240002400024000240002400024000240002400024000240002400024000",
            "used": false
          },
          {
            "invreq_id": "invreqid01010101010101010101010101010101010101010101010101010101",
            "active": false,
            "single_use": true,
            "bolt12": "lno1qgsq000bolt210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000",
            "used": true
          }
        ]
      }
    }
  ]
}
