Skip to main content

Creating notes

This endpoint creates a new note.

HTTP Request​

POST https://api.lunatask.app/v1/notes

Body Parameters​

ParameterDescription
notebook_idThe Notebook ID of the notebook where the note should be created (optional, can be found in our apps in the notebook settings)
nameThe name of the note (optional, but impractical if empty)
contentThe content of the note (optional, but impractical if empty, formatted in Markdown)
sourceIdentification of external system where the note is coming from (optional, e.g. "evernote")
source_idThe ID of the record in the external system (optional, e.g. "352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7")

When creating a note, given there's already an existing note in the same notebook with the same source/source_id, the endpoint will return 204 No Content without creating a duplicate.

Whitespace handling in Markdown​

Unfortunately, Markdown treats multiple consecutive blank lines as one blank line. To get around that and to allow a blank line between paragraphs in notes, prepend a backslash and a single space to all consecutive new lines except the first one.

This is the first line.<CR>
\ <CR>
This is the second line.

In this example, the <CR> marker signifies where new line breaks are placed. In most programming languages, the string representation would be "This is the first line.\n\\ \nThis is the second line.".

Example in Ruby​

require 'rest-client'

RestClient.post('https://api.lunatask.app/v1/notes', { name: 'My new note', content: 'My important note content', source: 'evernote', source_id: '352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7', notebook_id: '11b37775-5a34-41bb-b109-f0e5a6084799' }.to_json, { Authorization: "bearer #{access_token}", "Content-Type": 'application/json' })

Response​

The above command returns JSON structured like this:

{
"note": {
"id": "5999b945-b2b1-48c6-aa72-b251b75b3c2e",
"notebook_id": "d1ff35f5-6b25-4199-ab6e-c19fe3fe27f1",
"sources": [
{
"source": "evernote",
"source_id": "352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7"
}
],
"created_at": "2021-01-10T10:39:25Z",
"updated_at": "2021-01-10T10:39:25Z",
"deleted_at": null
}
}