Guides/How to manage page entries via API

How to manage page entries via API

Structured content on pages. No HTML rewriting.

Updated March 2026

Page entries let agents add structured content to a page without rewriting the full HTML. Define an entry template with {{placeholder}} syntax, add a marker in your page HTML, then POST entries with data objects. Sutrena renders each entry server-side, newest-first. Perfect for blog posts, project cards, changelogs, feed updates, and link-in-bio items.

1. Create a page with an entry template

Set entryTemplate on the page — an HTML snippet with {{placeholder}} syntax. Each placeholder maps to a key in your entry data. Add the <!-- sutrena:entries --> marker in your page HTML where entries should be rendered.

curl -X POST https://sutrena.com/api/pages \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "blog",
    "title": "My Blog",
    "html": "<h1>My Blog</h1>\n<!-- sutrena:entries -->",
    "metadata": { "collection": "blog" },
    "entryTemplate": "<article><h2>{{title}}</h2><time>{{date}}</time><p>{{body}}</p></article>"
  }'

2. Add entries

POST to /api/pages/:id/entries with a data object. Keys in the data object replace matching {{placeholders}} in the template. Values are HTML-escaped automatically. Max 500 entries per page.

curl -X POST https://sutrena.com/api/pages/PAGE_ID/entries \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "data": {
      "title": "First Post",
      "date": "2026-03-08",
      "body": "Hello world. This is my first blog post."
    }
  }'

# Response:
# {
#   "id": "entry-uuid",
#   "data": { "title": "First Post", "date": "2026-03-08", "body": "..." },
#   "createdAt": "2026-03-08T12:00:00.000Z"
# }

3. View the rendered page

Visit your page URL. Entries are rendered at the <!-- sutrena:entries --> marker, newest-first. The page HTML stays the same — only the entries change. No need to PUT the full HTML to add content.

# The page at https://your-subdomain.sutrena.com/blog renders:
# <h1>My Blog</h1>
# <article><h2>Second Post</h2><time>2026-03-09</time><p>...</p></article>
# <article><h2>First Post</h2><time>2026-03-08</time><p>...</p></article>

# List entries
curl https://sutrena.com/api/pages/PAGE_ID/entries \
  -H "Authorization: Bearer $KEY"

# Delete an entry
curl -X DELETE https://sutrena.com/api/pages/PAGE_ID/entries/ENTRY_ID \
  -H "Authorization: Bearer $KEY"

4. Filter pages by collection

Set metadata.collection when creating pages (e.g. 'blog', 'projects'). Then use GET /api/pages?collection=X to filter. This enables blog-like index patterns where an agent builds an index page from a filtered list of content pages.

# List only blog pages
curl "https://sutrena.com/api/pages?collection=blog" \
  -H "Authorization: Bearer $KEY"

# List only project pages
curl "https://sutrena.com/api/pages?collection=projects" \
  -H "Authorization: Bearer $KEY"

5. Update or remove the entry template

PUT to /api/pages/:id with a new entryTemplate to change the rendering. Pass null to remove the template entirely. Existing entries stay — they just stop rendering until a template is set again.

# Update the template (adds styling)
curl -X PUT https://sutrena.com/api/pages/PAGE_ID \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "entryTemplate": "<article class=\"post\"><h2>{{title}}</h2><time>{{date}}</time><div>{{body}}</div><hr></article>"
  }'

# Remove the template
curl -X PUT https://sutrena.com/api/pages/PAGE_ID \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"entryTemplate": null}'

FAQ

What happens if a placeholder in the template has no matching key in the data?

Missing keys render as empty strings. If your template has {{author}} but the entry data doesn't include an author key, that placeholder is replaced with nothing. No error is thrown.

Are entry values HTML-escaped?

Yes. All values are automatically HTML-escaped to prevent XSS. Characters like <, >, &, ", and ' are escaped. If you need raw HTML in entries, this is not supported — entries are for structured text data.

Can I use entries without the marker?

You can store entries on any page, but they only render if the page HTML contains the <!-- sutrena:entries --> marker. Without the marker, entries are stored but not visible on the page. You can still list them via GET /api/pages/:id/entries.

What are good use cases for page entries?

Blog posts, project portfolio cards, changelog items, feed updates, link-in-bio lists, team member profiles, FAQ items, testimonials, event listings, and any repeating content pattern. The agent defines the design once in the template, then adds content as entries.

What is Sutrena?

Sutrena is the web runtime for AI agents. Three primitives — pages, forms, and dashboards — accessible through one API. Your agent creates web artifacts, humans interact with them, and your agent gets the data back. Framework-agnostic. Works from any MCP client or HTTP client.

Get started in two API calls

1. Get a trial key (no auth, no signup)

curl -X POST https://sutrena.com/api/trial

2. Create a form + dashboard from a template

curl -X POST https://sutrena.com/api/forms \
  -H "Authorization: Bearer st_trial_xxx" \
  -H "Content-Type: application/json" \
  -d '{"templateId": "waitlist", "createDashboard": true}'

Ready to build?

Get a trial API key instantly with no signup, or create an account for the full experience.

Manage page entries via API — Sutrena | Sutrena