diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php
index 71687c7a60920fe971fd367a662502c898d32748..3b4a523b8848c3aa86d9d84ec6dd88c8f92ad6c2 100644
--- a/lib/private/Comments/Comment.php
+++ b/lib/private/Comments/Comment.php
@@ -42,6 +42,7 @@ class Comment implements IComment {
 		'actorId'         => '',
 		'objectType'      => '',
 		'objectId'        => '',
+		'referenceId'     => null,
 		'creationDT'      => null,
 		'latestChildDT'   => null,
 	];
@@ -395,6 +396,36 @@ class Comment implements IComment {
 		return $this;
 	}
 
+	/**
+	 * returns the reference id of the comment
+	 *
+	 * @return string|null
+	 * @since 19.0.0
+	 */
+	public function getReferenceId(): ?string {
+		return $this->data['referenceId'];
+	}
+
+	/**
+	 * sets (overwrites) the reference id of the comment
+	 *
+	 * @param string $referenceId e.g. sha256 hash sum
+	 * @return IComment
+	 * @since 19.0.0
+	 */
+	public function setReferenceId(?string $referenceId): IComment {
+		if ($referenceId === null) {
+			$this->data['referenceId'] = $referenceId;
+		} else {
+			$referenceId = trim($referenceId);
+			if ($referenceId === '') {
+				throw new \InvalidArgumentException('Non empty string expected.');
+			}
+			$this->data['referenceId'] = $referenceId;
+		}
+		return $this;
+	}
+
 	/**
 	 * sets the comment data based on an array with keys as taken from the
 	 * database.
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index f1c7224359774ea3ea5bd4145992c1e02afd906b..aad7cad020095ab67d3a28a9d7e5b98174e8c0fe 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -96,6 +96,7 @@ class Manager implements ICommentsManager {
 			$data['latest_child_timestamp'] = new \DateTime($data['latest_child_timestamp']);
 		}
 		$data['children_count'] = (int)$data['children_count'];
+		$data['reference_id'] = $data['reference_id'] ?? null;
 		return $data;
 	}
 
diff --git a/lib/public/Comments/IComment.php b/lib/public/Comments/IComment.php
index aac68a4036ba10dbf672102f44438bd22b384ce7..b98a015a30e4954898685a77b20d40da0c2019d1 100644
--- a/lib/public/Comments/IComment.php
+++ b/lib/public/Comments/IComment.php
@@ -263,4 +263,21 @@ interface IComment {
 	 */
 	public function setObject($objectType, $objectId);
 
+	/**
+	 * returns the reference id of the comment
+	 *
+	 * @return string|null
+	 * @since 19.0.0
+	 */
+	public function getReferenceId(): ?string;
+
+	/**
+	 * sets (overwrites) the reference id of the comment
+	 *
+	 * @param string|null $referenceId e.g. sha256 hash sum
+	 * @return IComment
+	 * @since 19.0.0
+	 */
+	public function setReferenceId(?string $referenceId): IComment;
+
 }