{
  "$schema": "../rpc-schema-draft.json",
  "type": "object",
  "rpc": "listoffers",
  "title": "Command for listing offers",
  "description": [
    "The **listoffers** RPC command list all offers, or with `offer_id`, only the offer with that offer_id (if it exists)."
  ],
  "categories": [
    "readonly"
  ],
  "request": {
    "required": [],
    "additionalProperties": false,
    "properties": {
      "offer_id": {
        "type": "hash",
        "description": [
          "Offer_id to get details for (if it exists)."
        ]
      },
      "active_only": {
        "type": "boolean",
        "description": [
          "If set and is true, only offers with `active` true are returned."
        ]
      }
    }
  },
  "response": {
    "required": [
      "offers"
    ],
    "additionalProperties": false,
    "properties": {
      "offers": {
        "type": "array",
        "items": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "offer_id",
            "active",
            "single_use",
            "bolt12",
            "used"
          ],
          "properties": {
            "offer_id": {
              "type": "hash",
              "description": [
                "The id of this offer (merkle hash of non-signature fields)."
              ]
            },
            "active": {
              "type": "boolean",
              "description": [
                "Whether this can still be used."
              ]
            },
            "single_use": {
              "type": "boolean",
              "description": [
                "Whether this expires as soon as it's paid."
              ]
            },
            "bolt12": {
              "type": "string",
              "description": [
                "The bolt12 encoding of the offer."
              ]
            },
            "description": {
              "added": "v26.04",
              "type": "string",
              "description": [
                "The user-specified bolt 12 description."
              ]
            },
            "used": {
              "type": "boolean",
              "description": [
                "True if an associated invoice has been paid."
              ]
            },
            "label": {
              "type": "string",
              "description": [
                "The (optional) user-specified label."
              ]
            }
          }
        }
      }
    }
  },
  "author": [
    "Rusty Russell [rusty@rustcorp.com.au](mailto:rusty@rustcorp.com.au) is mainly responsible."
  ],
  "see_also": [
    "lightning-offer(7)",
    "lightning-listoffers(7)"
  ],
  "resources": [
    "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
  ],
  "examples": [
    {
      "request": {
        "id": "example:listoffers#1",
        "method": "listoffers",
        "params": {
          "active_only": true
        }
      },
      "response": {
        "offers": [
          {
            "offer_id": "offeridl21000002100000210000021000002100000210000021000002100000",
            "active": true,
            "single_use": false,
            "bolt12": "lno1qgsq000bolt210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000",
            "description": "Fish sale!",
            "used": false
          },
          {
            "offer_id": "offeridl22000002200000220000022000002200000220000022000002200000",
            "active": true,
            "single_use": false,
            "bolt12": "lno1qgsq000bolt220002200022000220002200022000220002200022000220002200022000220002200022000220002200022000220002200022000220002200022000",
            "description": "Coffee",
            "used": false
          },
          {
            "offer_id": "offeridl23000002300000230000023000002300000230000023000002300000",
            "active": true,
            "single_use": false,
            "bolt12": "lno1qgsq000bolt230002300023000230002300023000230002300023000230002300023000230002300023000230002300023000230002300023000230002300023000",
            "description": "Movie ticket",
            "used": false
          }
        ]
      }
    },
    {
      "request": {
        "id": "example:listoffers#2",
        "method": "listoffers",
        "params": [
          "offeridl23000002300000230000023000002300000230000023000002300000"
        ]
      },
      "response": {
        "offers": [
          {
            "offer_id": "offeridl23000002300000230000023000002300000230000023000002300000",
            "active": true,
            "single_use": false,
            "bolt12": "lno1qgsq000bolt230002300023000230002300023000230002300023000230002300023000230002300023000230002300023000230002300023000230002300023000",
            "used": false
          }
        ]
      }
    }
  ]
}
