Create or update a note
const url = 'https://api.engram.page/notes';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"content":"# Engram\n\nAn AI-powered personal knowledge base.\n","mtime":1718900000,"path":"Projects/Engram.md","tags":["project","ai"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.engram.page/notes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "content": "# Engram\n\nAn AI-powered personal knowledge base.\n", "mtime": 1718900000, "path": "Projects/Engram.md", "tags": [ "project", "ai" ] }'Creates a note or updates the existing one at the same path. Updates are merged convergently (CRDT) with the stored content. Optionally pass base_hash — the content_hash you last read — for compare-and-swap semantics: if the note changed since that read, the write returns 409 with the current server note instead of merging. Notes over 10MB are rejected with 413, and exceeding the plan’s note cap returns 402.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Note to upsert
object
Compare-and-swap guard: the content_hash you last read for this note. If the note changed since, the write returns 409 instead of merging.
Example
{ "content": "# Engram\n\nAn AI-powered personal knowledge base.\n", "mtime": 1718900000, "path": "Projects/Engram.md", "tags": [ "project", "ai" ]}Responses
Section titled “Responses”Created/updated
object
object
OKF frontmatter description field
OKF frontmatter created/date field
OKF frontmatter timestamp/modified/updated field
Client mtime (epoch seconds)
Present when parse_status is “degraded”: {code, message, detail}
object
Frontmatter parse outcome
OKF frontmatter resource field
OKF frontmatter type field
Example
{ "note": { "parse_status": "ok", "path": "Projects/engram.md" }}Version conflict
object
object
OKF frontmatter description field
OKF frontmatter created/date field
OKF frontmatter timestamp/modified/updated field
Client mtime (epoch seconds)
Present when parse_status is “degraded”: {code, message, detail}
object
Frontmatter parse outcome
OKF frontmatter resource field
OKF frontmatter type field
Example
{ "error": "version_conflict", "server_note": { "parse_status": "ok", "path": "Projects/engram.md" }}Note exceeds 10MB
Validation error