Skip to main content

Annotations

Information about a document's annotations can be retrieved with the following APIs.

Getting a document's annotations#

Annotations for a document can be retrieved directly on the document object (via document.annotations). For information on getting a user's documents, see the getting user documents guide.

Get unread annotation count#

You can get the unread count for a user's document with the getUnreadCountForDocument API. This is useful for display an unread message icon in your UI.

client.getUnreadCountForDocument(document): number

document must be the full document object, including its annotations. Guidance on getting this object can be found in the getting user documents guide.

Check if annotation is unread#

To check if a singular annotation is unread, use the isAnnotationUnread API.

client.isAnnotationUnread(annotation): boolean

This will return true if the annotation is unread, otherwise it will return false.

Mark all annotations as read#

You can use the markAllAnnotationsAsRead API to set all annotations in the document with the provided document id for current user.

client.markAllAnnotationsAsRead(documentId)

This will update the unread annotation count of the document.

Copy annotations#

You can use the copyAnnotations API to copy annotations from one document to another. You can use this API to do document versioning.

client.copyAnnotations(
from: string, // Id of the document that you want copy from
to: string, // Id of the document that you want copy to
options: {
copyAllAnnotations?: boolean, // Option to copy all annotations
annotationIds?: string[] // Option to copy annotations by their id
}
): Promise<boolean>

This will create a new id for each annotation you copied.