5.3 Core API Reference
The Standard Garden API lets external clients — the Obsidian plugin, the CLI, your own scripts — publish and manage notes in your garden.
Authentication
All endpoints require an API key, sent as a header:
x-api-key: sg_...
Get your key via the ::api command in the Command Palette (sign in first). The same view lets you rotate the key and copy it. Keys are stored hashed (SHA-256) — the plaintext is only shown at generation, so copy it then.
Endpoints
GET /api/me
Verify a key and identify its owner. Used by clients to confirm the connection.
Response:
{ "username": "jean", "id": "..." }
PUT /api/publish/:slug
Create or update a note. The slug is the identifier — publishing twice to the same slug updates the note (idempotent, perfect for one-way sync from Obsidian).
Body:
{ "content": "# My Note\n\nMarkdown content…", "title": "My Note" }
Response: 201 (created) or 200 (updated)
{ "success": true, "url": "/@jean/my-note", "slug": "my-note", "nano_id": "..." }
Rate limit: 60 requests/minute — roomy enough to sync a large vault.
DELETE /api/publish/:slug
Unpublish a note. Removes it permanently, including its attachments.
Response: { "success": true, "slug": "my-note" }
POST /api/publish/attachment
Upload an image before publishing the note that embeds it.
Format: multipart/form-data with fields file (the image) and slug (the note it belongs to).
Limits: images only (png, jpeg, gif, webp, svg, avif) · 200 MB max per file · 30 requests/minute.
Response:
{ "url": "/cdn/…", "filename": "uuid.png" }
POST /api/ai/theme
Generate design tokens for a note — the AI reads the content (and an optional style instruction) and returns frontmatter tokens (colors, fonts, rhythm). This is what powers the “Generate” button in the Obsidian plugin’s panel.
Body:
{ "instruction": "warm autumn palette", "noteContent": "…", "currentTokens": {} }
Response: { "tokens": { "color-light-accent": "#…", "font-header": "…" } }
Rate limit: 10 requests/minute (each call costs real AI tokens).
Errors
All endpoints return JSON errors with meaningful status codes: 401 (missing/invalid key), 400 (bad input), 413 (file too large), 429 (rate limited — check the Retry-After header), 503 (service not configured).
See Also
- Customization Reference — frontmatter, tokens, themes
- CLI Reference — command-line publishing
- The Obsidian Protocol — the recommended client