src/share/api/config-write.json
 src/share/api/dhcp-disable.json
 src/share/api/dhcp-enable.json
+src/share/api/extended-info4-upgrade.json
 src/share/api/gss-tsig-get-all.json
 src/share/api/gss-tsig-get.json
 src/share/api/gss-tsig-key-del.json
 
 
    The new query types are only supported with the memfile lease backend.
 
+.. _command-extended-info4-upgrade:
+
+The ``extended-info4-upgrade`` Command
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+With SQL lease database backends the relay and remote IDs are in new columns
+so to make old leases (old means from an older Kea version) visible to
+the hook library the lease database must be upgraded. This is the function
+of the ``extended-info4-upgrade`` command.
+
 .. _bulk-lease-query-dhcpv6:
 
 DHCPv6 Bulk Leasequery
 
 api_files += $(top_srcdir)/src/share/api/config-write.json
 api_files += $(top_srcdir)/src/share/api/dhcp-disable.json
 api_files += $(top_srcdir)/src/share/api/dhcp-enable.json
+api_files += $(top_srcdir)/src/share/api/extended-info4-upgrade.json
 api_files += $(top_srcdir)/src/share/api/gss-tsig-get-all.json
 api_files += $(top_srcdir)/src/share/api/gss-tsig-get.json
 api_files += $(top_srcdir)/src/share/api/gss-tsig-key-del.json
 
--- /dev/null
+{
+    "access": "write",
+    "avail": "2.3.8",
+    "brief": [
+        "This command sanitizes extended info of all IPv4 leases and fills relay and remote ID columns in the SQL lease database."
+    ],
+    "cmd-syntax": [
+        "{",
+        "    \"command\": \"extended-info4-upgrade\"",
+        "    }",
+        "}"
+    ],
+    "description": "See <xref linkend=\"command-extended-info4-upgrade\"/>",
+    "hook": "lease_query",
+    "name": "extended-info4-upgrade",
+    "resp-comment": [
+        "This command should be used when some old leases are present in the lease database using a SQL backend."
+    ],
+    "resp-syntax": [
+        "{",
+        "  \"arguments\": {",
+        "  },",
+        "  \"result\": 0,",
+        "  \"text\": \"to be done\"",
+        "}"
+    ],
+    "support": [
+        "kea-dhcp6"
+    ]
+}