data FEATURE add lyd_new_ext_any()
diff --git a/src/tree_data.c b/src/tree_data.c
index 7b9d461..e94d8d5 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1117,6 +1117,33 @@
     return LY_SUCCESS;
 }
 
+API LY_ERR
+lyd_new_ext_any(const struct lysc_ext_instance *ext, const char *name, const void *value, ly_bool use_value,
+        LYD_ANYDATA_VALUETYPE value_type, struct lyd_node **node)
+{
+    struct lyd_node *ret = NULL;
+    const struct lysc_node *schema;
+    struct ly_ctx *ctx = ext ? ext->module->ctx : NULL;
+
+    LY_CHECK_ARG_RET(ctx, ext, node, name, LY_EINVAL);
+
+    schema = lysc_ext_find_node(ext, NULL, name, 0, LYD_NODE_ANY, 0);
+    if (!schema) {
+        if (ext->argument) {
+            LOGERR(ctx, LY_EINVAL, "Any node \"%s\" not found in instance \"%s\" of extension %s.",
+                    name, ext->argument, ext->def->name);
+        } else {
+            LOGERR(ctx, LY_EINVAL, "Any node \"%s\" not found in instance of extension %s.", name, ext->def->name);
+        }
+        return LY_ENOTFOUND;
+    }
+    LY_CHECK_RET(lyd_create_any(schema, value, value_type, use_value, &ret));
+
+    *node = ret;
+
+    return LY_SUCCESS;
+}
+
 /**
  * @brief Update node value.
  *
diff --git a/src/tree_data.h b/src/tree_data.h
index bc77d3d..c9f3ef8 100644
--- a/src/tree_data.h
+++ b/src/tree_data.h
@@ -128,7 +128,7 @@
  * Note, that in case the node is defined in an extension instance, the functions mentioned above do not work until you
  * provide parent where the new node is supposed to be inserted. The reason is that all the functions searches for the
  * top-level nodes directly inside modules. To create a top-level node defined in an extension instance, use
- * ::lyd_new_ext_inner(), ::lyd_new_ext_term() and ::lyd_new_ext_list() functions.
+ * ::lyd_new_ext_inner(), ::lyd_new_ext_term(), ::lyd_new_ext_any() and ::lyd_new_ext_list() functions.
  *
  * The [metadata](@ref howtoPluginsExtensionsMetadata) (and attributes in opaq nodes) can be created with ::lyd_new_meta()
  * and ::lyd_new_attr().
@@ -176,6 +176,7 @@
  * - ::lyd_new_ext_inner()
  * - ::lyd_new_ext_term()
  * - ::lyd_new_ext_list()
+ * - ::lyd_new_ext_any()
  *
  * - ::lyd_dup_single()
  * - ::lyd_dup_siblings()
@@ -1024,6 +1025,8 @@
 /**
  * @brief Create a new any node in the data tree.
  *
+ * To create a top-level any node defined in an extension instance, use ::lyd_new_ext_any().
+ *
  * @param[in] parent Parent node for the node being created. NULL in case of creating a top level element.
  * @param[in] module Module of the node being created. If NULL, @p parent module will be used.
  * @param[in] name Schema node name of the new data node. The node can be #LYS_ANYDATA or #LYS_ANYXML.
@@ -1039,6 +1042,23 @@
         ly_bool use_value, LYD_ANYDATA_VALUETYPE value_type, ly_bool output, struct lyd_node **node);
 
 /**
+ * @brief Create a new top-level any node defined in the given extension instance.
+ *
+ * To create an any node with parent (no matter if defined inside extension instance or a standard tree) or a top-level
+ * any node of a standard module's tree, use ::lyd_new_any().
+ *
+ * @param[in] ext Extension instance where the any node being created is defined.
+ * @param[in] name Schema node name of the new data node. The node can be #LYS_ANYDATA or #LYS_ANYXML.
+ * @param[in] value Value for the node. Expected type is determined by @p value_type.
+ * @param[in] use_value Whether to directly take @p value and assign it to the node or make a copy.
+ * @param[in] value_type Type of the provided value in @p value.
+ * @param[out] node The created node.
+ * @return LY_ERR value.
+ */
+LY_ERR lyd_new_ext_any(const struct lysc_ext_instance *ext, const char *name, const void *value, ly_bool use_value,
+        LYD_ANYDATA_VALUETYPE value_type, struct lyd_node **node);
+
+/**
  * @brief Create new metadata.
  *
  * @param[in] ctx libyang context,