Guides/How to deploy a page via API

How to deploy a page via API

POST HTML. Get a URL. That is it.

Updated March 2026

Sutrena is the web runtime for AI agents. Sutrena Pages let your agent deploy HTML to a public URL with one API call. No hosting provider, no build pipeline, no Git. POST your HTML, get a URL back. Update it anytime with PUT. This is useful for AI agents that need to publish content to the web (Claude Code, Cursor, LangGraph, AutoGen, n8n), for developers who want to deploy microsites without infrastructure, and for anyone who wants a page live in seconds. Pages are one of Sutrena's 5 capabilities alongside Forms, Analytics, Webhooks, Automations.

1. Get an API key

Use the free plan (sign up at sutrena.com) or get a trial key instantly with no signup.

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

2. Deploy a page

POST your HTML to /api/pages. You get back a page ID and a public URL. The HTML is served as-is -- include styles, scripts, images, whatever you need.

curl -X POST https://sutrena.com/api/pages \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"slug": "hello", "title": "Hello World", "html": "<h1>Hello World</h1><p>Deployed via API.</p>"}'

3. Update the page

PUT to /api/pages/{id} with new HTML. The URL stays the same. Updates are instant.

curl -X PUT https://sutrena.com/api/pages/PAGE_ID \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Updated</h1><p>New content, same URL.</p>"}'

4. Safe update patterns

Every time you PUT new html or css, Sutrena automatically saves a snapshot of the previous version. If an update goes wrong, call POST /api/pages/:id/rollback to swap the current content with the snapshot -- the rollback itself creates a new snapshot, so it is always reversible. For a more cautious workflow, create a page with isPublished set to false, share the UUID preview URL (/p/:id) for review, then publish when approved.

# Preview before publish: create as draft
curl -X POST https://sutrena.com/api/pages \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"slug": "launch", "title": "Launch Page", "html": "<h1>Draft</h1>", "isPublished": false}'

# Share the UUID URL for review: /p/pg_abc123
# When approved, publish it:
curl -X PUT https://sutrena.com/api/pages/pg_abc123 \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"isPublished": true}'

# Rollback after a bad update:
curl -X POST https://sutrena.com/api/pages/pg_abc123/rollback \
  -H "Authorization: Bearer $KEY"

5. Combine with a form

Deploy a page that includes a Sutrena form embed. Now you have a complete landing page that collects data, all through the API.

curl -X POST https://sutrena.com/api/pages \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"slug": "landing", "title": "Sign Up", "html": "<h1>Join the waitlist</h1><div data-sutrena-form=\"FORM_ID\"></div><script src=\"https://sutrena.com/embed.js\"></script>"}'

FAQ

What kind of HTML can I deploy?

Any valid HTML. Static pages, single-page apps, pages with inline JavaScript, CSS, and external scripts. External scripts over HTTPS, fetch to any API, and iframes from any origin all work. You can embed Stripe.js, analytics, payment widgets, or any third-party SDK. Images load from anywhere.

Can I use a custom domain?

Yes. Set up a custom subdomain (alice.sutrena.com) on any plan, or add your own domain via CNAME on Pro+. See the custom subdomain guide and custom domain guide.

How many pages can I deploy?

Free: 10 projects (forms, pages, analytics, and automations combined). Pro: 100 projects. Scale: unlimited.

Can an AI agent deploy pages?

Yes. POST /api/pages with HTML. The agent gets a URL back. Works through the REST API or MCP tools.

Is there a size limit on page HTML?

Reasonable limits apply. A typical landing page is well within bounds. If you are deploying megabytes of HTML, consider a CDN.

What is Sutrena?

Sutrena is the web runtime for AI agents. Forms, Pages, Analytics, Webhooks, Automations — all through 67 MCP tools and one REST API. Your agent creates web artifacts, humans interact with them, and your agent gets the data back. Use any one feature or all of them together.

Pages

Deploy HTML instantly

Forms

Collect structured data

Automations

DSL-based pipelines with 14 step types

Analytics

Privacy-first, no cookies

Webhooks

Slack, Discord, Telegram

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 anything — a page, form, automation, or analytics site

# Create a form
curl -X POST https://sutrena.com/api/forms \
  -H "Authorization: Bearer st_trial_xxx" \
  -H "Content-Type: application/json" \
  -d '{"name": "waitlist", "fields": [{"name": "email", "label": "Email", "type": "email", "required": true}]}'

# Or deploy a page
curl -X POST https://sutrena.com/api/pages \
  -H "Authorization: Bearer st_trial_xxx" \
  -H "Content-Type: application/json" \
  -d '{"slug": "index", "title": "My Site", "html": "<h1>Live</h1>"}'

Ready to build?

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

How to deploy a page via API -- Sutrena | Sutrena