Create notes
Stay organized with collections
Save and categorize content based on your preferences.
The Google Keep API allows you to create two types of notes: a text note and a list note. This document shows how to create each type.
Create a text note
The following sample shows how to create a text note:
REST
Call notes.create with a Note resource. Place the TextContent in the Section of the note.
Java
/**
* Creates a new text note.
*
* @throws IOException
* @return The newly created text note.
*/
privateNotecreateTextNote(Stringtitle,StringtextContent)throwsIOException{
SectionnoteBody=newSection().setText(newTextContent().setText(textContent));
NotenewNote=newNote().setTitle(title).setBody(noteBody);
returnkeepService.notes().create(newNote).execute();
}
Create a list note
The following sample shows how to create a list note:
REST
Call notes.create with a Note resource. Place the ListContent in the Section of the note.
Java
/**
* Creates a new list note.
*
* @throws IOException
* @return The newly created list note.
*/
privateNotecreateListNote()throwsIOException{
// Create a checked list item.
ListItemcheckedListItem=
newListItem().setText(newTextContent().setText("Send meeting invites")).setChecked(true);
// Create a list item with two children.
ListItemuncheckedListItemWithChildren=
newListItem()
.setText(newTextContent().setText("Prepare the presentation"))
.setChecked(false)
.setChildListItems(
Arrays.asList(
newListItem().setText(newTextContent().setText("Review metrics")),
newListItem().setText(newTextContent().setText("Analyze sales projections")),
newListItem().setText(newTextContent().setText("Share with leads"))));
// Creates an unchecked list item.
ListItemuncheckedListItem=
newListItem().setText(newTextContent().setText("Send summary email")).setChecked(true);
NotenewNote=
newNote()
.setTitle("Marketing review meeting")
.setBody(
newSection()
.setList(
newListContent()
.setListItems(
Arrays.asList(
checkedListItem,
uncheckedListItemWithChildren,
uncheckedListItem))));
returnkeepService.notes().create(newNote).execute();
}