Working with notes
Formats
Bodies are Markdown (content_markdown). Ask for TipTap JSON with ?format=json or both with ?format=both. On write send one of content_markdown or content_json.
Code-mode notes ("mode": "code") carry a files array instead of a body.
Pagination and search
GET /notes is newest-first and cursor-paginated:
curl "https://notes-api.palmcode.cl/api/v1/notes?limit=25&q=invoice&tag=work" \
-H "Authorization: Bearer $PALMNOTES_TOKEN"
# → { "data": [...], "meta": { "next_cursor": "…" } }
curl "https://notes-api.palmcode.cl/api/v1/notes?limit=25&cursor=<next_cursor>" \
-H "Authorization: Bearer $PALMNOTES_TOKEN"let cursor: string | null = null;
do {
const url = new URL('https://notes-api.palmcode.cl/api/v1/notes');
url.searchParams.set('limit', '25');
if (cursor) url.searchParams.set('cursor', cursor);
const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.PALMNOTES_TOKEN}` } });
const { data, meta } = await res.json();
for (const note of data) console.log(note.title);
cursor = meta.next_cursor;
} while (cursor);import os, requests
headers = {"Authorization": f"Bearer {os.environ['PALMNOTES_TOKEN']}"}
params = {"limit": 25}
while True:
body = requests.get("https://notes-api.palmcode.cl/api/v1/notes", params=params, headers=headers).json()
for note in body["data"]:
print(note["title"])
cursor = body["meta"]["next_cursor"]
if not cursor:
break
params["cursor"] = cursornext_cursor is null on the last page. Lists return a short excerpt; add include=content for full bodies.
Avoiding lost updates
Every note has an opaque version. Send it back as If-Match when updating; a stale value returns 409 version_conflict.
curl -X PATCH https://notes-api.palmcode.cl/api/v1/notes/$ID \
-H "Authorization: Bearer $PALMNOTES_TOKEN" \
-H "If-Match: $VERSION" \
-H "Content-Type: application/json" \
-d '{"title":"New title"}'const res = await fetch(`https://notes-api.palmcode.cl/api/v1/notes/${id}`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.PALMNOTES_TOKEN}`,
'If-Match': version, // the `version` you last read
'Content-Type': 'application/json',
},
body: JSON.stringify({ title: 'New title' }),
});
if (res.status === 409) {
// version_conflict: re-read the note, merge, retry
}import os, requests
r = requests.patch(
f"https://notes-api.palmcode.cl/api/v1/notes/{note_id}",
headers={
"Authorization": f"Bearer {os.environ['PALMNOTES_TOKEN']}",
"If-Match": version, # the `version` you last read
},
json={"title": "New title"},
)
if r.status_code == 409:
pass # version_conflict: re-read the note, merge, retryDeleting and history
DELETE /notes/{id} moves the note to the trash; add ?permanent=true to remove it for good. Each regular note keeps its last 10 versions; list them under /notes/{id}/versions and restore with POST …/versions/{vid}/restore (the current state is saved first, so restoring is reversible).