Xuda logo Xuda Docs User Guides
/
xuda.io
← All guides Websites

Xuda Websites API Reference

Source file: xuda-static-websites-api-reference.md

Xuda Websites API Reference

This reference covers the full method surface of Xuda Websites: the thirty-two CPI methods behind generating a site from a prompt, uploading a folder of HTML, publishing immutable versions, rolling back without re-uploading a byte, renaming the free *.xuda.app address, connecting custom domains, reading per-site traffic and tearing the whole thing down. It is written for developers who want to know exactly what each screen calls, what every parameter is named and typed, and which of these methods a developer API key can actually reach today. Every parameter name, type and required flag below is taken from the shipped method contract.

How To Call These Methods

Every method here is a CPI method. CPI methods are dispatched by name over the Xuda API and MCP layer, and the normal credential for that layer is the account API key. For the transport-level detail, including how requests are framed and how the MCP layer exposes methods, see /api-mcp-integration.

Every method returns the platform envelope { code, data }. A success carries code >= 1. A failure carries a negative code plus a message string in data.

Read the next paragraph before you plan an integration. Twenty-nine of the thirty-two methods are flagged private, and a private method is not reachable with a developer API key. In this codebase private: true is the hard operator wall: a full-access key covers every non-private method, and private methods are excluded from the key catalog outright. That leaves three methods an API key can call today:

  • get_account_static_websites, which lists every website in the account. It is also flagged mcp: true, so it is exposed as an MCP tool.
  • get_site_build_image_modes, which reports which website-builder image sources the account is entitled to.
  • destroy_app, which permanently deletes an application and, for a website, tears down its hosted files, every version, its custom hostnames and its per-deployment billing. It carries admin clearance.

The other twenty-nine are dashboard-session methods with clearance: user. They are what the product's own screens call, their caller identity comes from the session rather than from a parameter, and an API key is refused. They are documented in full because they define the product's behavior and because any future API tier would expose them.

Two further flags appear on many of these methods and are called out per method:

  • security: true puts the call behind an extra confirmation gate.
  • broadcast: true pushes the result to the account's open dashboard sessions, so other tabs update without a reload.

Where the method configuration declares no fields block, the parameters listed are the ones the implementation actually reads, and that is stated in the method's notes.

What The Availability Labels Mean

Every method below carries one explicit availability line. Read it first, because it tells you whether you can call the method from your own code today.

  • Availability: API key means an external developer API key or the MCP layer can call it. Three Websites methods carry this label.
  • Availability: Dashboard session means a signed-in user in the Xuda dashboard can call it, and an API key cannot. The account identity comes from the session, never from a parameter.
  • Availability: Public endpoint means no authentication at all. No Websites method carries this label. The product's unauthenticated surface is the served website itself, on *.xuda.app and on any connected custom domain, which is plain HTTP rather than a CPI method.
  • Availability: Operator only means Xuda staff, listed only for completeness. No Websites method carries this label.

Method Index

Method What It Does
get_account_static_websites Lists every website app document in the account.
get_site_build_image_modes Reports which builder image sources the account may use, and why.
generate_site_draft Generates or refines a whole site with AI into a draft folder, and returns a preview URL.
ingest_static_site_source Bulk-writes uploaded source files onto the account's studio filesystem.
list_static_site_folders Lists the account's existing static-site source folders.
get_static_site_preview_url Returns the live preview URL for a site's editable source folder.
list_site_files Lists the paths and sizes in a site's source folder, with no bytes.
read_site_file Reads one source file's text content.
write_site_file Writes or overwrites one source file, without publishing.
create_static_website The full provisioning entry point: plan, subdomain, app, site record and first publish.
deploy_static_website The only publish path: guards the payload, then hands it to deploy_site.
change_static_website_plan Moves one site between hosting tiers and reprices it.
update_static_website_embeds Saves the site-wide profile chat and contact-form embeds.
list_site_versions Lists a site's deployed versions, newest first.
set_site_live_version Rolls the live pointer to a stored version and rewrites the dev draft from it.
delete_site_version Soft-deletes one version and reclaims its bytes.
set_site_subdomain Changes the free *.xuda.app address.
get_site_hostnames The Domain tab payload: subdomain, CNAME target, hostnames, records, pending connection.
attach_site_hostname Connects a custom domain and returns the records to paste.
verify_site_hostname Re-checks a pending hostname record by record over public DNS.
detach_site_hostname Removes a custom domain from a site and unwires the edge.
connect_external_domain Starts nameserver delegation, the only path for a third-party apex domain.
check_external_domain Polls the delegated zone and wires apex plus www once it is active.
disconnect_external_domain Full teardown of a delegated domain, including the Cloudflare zone.
detach_external_domain_from_site Detaches a delegated domain from its site but keeps the zone and the domain record.
get_site_analytics Per-site traffic, breakdowns and cache ratio for 24h, 3d or 7d.
create_site Low-level primitive that creates the xuda_site routing and hosting record.
list_sites Slim list of every website the caller owns.
get_site Returns the complete site document for one site.
deploy_site Uploads a file set as a fresh immutable version and atomically flips the live pointer.
delete_site Tears down a hosted site, its hostnames, its bytes and every version.
destroy_app Permanently deletes the application, which for a website calls delete_site.

get_account_static_websites

Get Account Websites (account_module)

Returns every app_type: 'static_website' app document in the account through a Mango query, up to 1000, in the { rows: [{ id, value }] } shape the dashboard's data store expects. Websites are not emitted by any of the account's CouchDB views, which is why this dedicated query exists and why the sidenav can show a newly created site without a full account reload. A superuser gets every website on the platform rather than only their own.

Availability: API key

Parameters

This method takes no parameters beyond the caller identity.

Notes

  • Clearance user. Not private, so this is one of the three methods reachable with a developer API key.
  • Also flagged mcp: true, so it is exposed as an MCP tool.
  • No min_plan.
  • Capped at 1000 app documents per call.
  • This is the natural starting point for any external integration: it gives you the app_id values that almost every other method in this reference takes.

get_site_build_image_modes

Get Site Build Image Modes (account_module)

Returns which website-builder image modes the account may use, as { svg, stock, gen_low, gen_high, upgrade, reason }. svg and stock are always true. gen_low and gen_high are true only when the account has a paid membership and a non-free ai_workspace_plan whose catalog category is ai_workspace. When they are false, reason carries the exact upgrade sentence the UI shows as a tooltip, which differs depending on whether the membership or the workspace plan is missing. This is the single source of truth shared by the builder gate and the UI selector.

Availability: API key

Parameters

This method takes no parameters beyond the caller identity.

Notes

  • Clearance user. Not private, so this is one of the three methods reachable with a developer API key.
  • No min_plan.
  • Plan gate: this method reports the gate rather than enforcing it. The same rule is enforced server side inside generate_site_draft, so calling the generator with a locked mode is refused there regardless of what a client believes.
  • Call it before you offer an image mode to a user, and show reason when a mode comes back false.

generate_site_draft

Generate Site Draft (ai_module)

Generates or refines a complete website with Codex into a draft folder on the studio filesystem, and returns a /studio-drive/ preview URL. Runs as a job (job_timeout 600000 ms, title "Generate site") with the steps "Preparing workspace", "Generating with AI", "Ready to preview". Before doing any work it refuses on an empty AI credit balance, returning { error: 'credit_limit' }, and it refuses a locked image mode with { error: 'upgrade_required' } and the exact upgrade reason. On a fresh build, never on a refine, it pre-provisions up to three images into ./assets according to image_mode, then instructs the generator to use them. The fresh-build system prompt requires an index.html at the root, relative asset paths, semantic HTML5 with a standalone stylesheet, a required inline-SVG favicon at ./assets/favicon.svg, no build step, and forbids network requests or reading anything outside the working directory. A refine applies the change in place and keeps the existing assets. A per-user concurrency guard prevents two generations at once.

Availability: Dashboard session

Parameters

Name Type Required Description
prompt string Yes What the site should be, or the change to apply.
draft_folder string No Existing draft folder to refine. Omit to start a new draft.
image_mode string No svg (default), stock, gen_low or gen_high. The two generated modes need a paid membership plus a workspace credit plan.
model string No A Codex-eligible model code from the AI catalog. Anything else is ignored and the default is used. Not declared in config.

Notes

  • Clearance user, private: true, broadcast: true. No min_plan field; gating is by credits and by the image-mode rule.
  • Returns { draft_folder, preview_url, summary }.
  • Plan gate: gen_low and gen_high require a paid membership and a non-free ai_workspace_plan in the ai_workspace catalog category. A locked mode answers { error: 'upgrade_required' } with the reason string.
  • Credit gate: an empty AI credit balance answers { error: 'credit_limit' } before Codex runs, which is what the dashboard turns into the buy-credits dialog. Generated images are billed through the normal image credit path.
  • At most three images are provisioned per fresh build, in every mode that provisions any. A refine never re-provisions.
  • The stock mode pulls landscape photos from Pexels and needs a Pexels API key in the on-box secrets file. Without it the mode logs an error and the build falls back to inline SVG visuals.
  • Timeouts: 600000 ms on the job, 240000 ms on each Codex call.
  • Concurrency: one generation per user at a time. A second concurrent call is refused by the guard.
  • Pass draft_folder to refine. Omitting it always starts a brand new draft rather than editing the previous one.

ingest_static_site_source

Ingest Website Source (drive_module)

Bulk-writes source files onto the account's studio filesystem under the given folder. This is how a browser upload gets its bytes to the server: the create wizard batches files at roughly 4 MB per call, and ingest appends, so batches accumulate into one tree. Each file may carry either UTF-8 content or base64 content_b64. Per-file path traversal is rejected, and the resolved folder must stay inside the caller's own root.

Availability: Dashboard session

Parameters

Name Type Required Description
site_folder string Yes Destination folder, for example /static-sites/my-site-k3a9x.
files array Yes Array of { path, content } or { path, content_b64 }.

Notes

  • Clearance user, private: true. No min_plan.
  • Returns { dir, file_count }.
  • Idempotency: this call appends. Calling it twice with the same batch leaves the tree with those files written twice over, not duplicated but overwritten in place; calling it with different batches merges them. Use a fresh per-upload folder name when you want a clean tree, which is what the create wizard does.
  • Batch at roughly 4 MB per call. There is no single-call size that the product exercises beyond that.
  • Path containment is enforced per file, and the resolved folder must stay inside the caller's own tenant root.

list_static_site_folders

List Website Folders (drive_module)

Lists the account's static-site source folders on the studio filesystem, which is the create wizard's "Your sites" picker. Each entry carries the folder name, file count, total bytes, whether an index.html exists, and creation and modification timestamps, so the user can tell slug-named folders apart. Account-scoped, because at this point in the flow there is no app yet.

Availability: Dashboard session

Parameters

This method takes no parameters beyond the session identity.

Notes

  • Clearance user, private: true. No min_plan.
  • Returns { folders: [...] }.
  • Account-scoped rather than app-scoped, which is what makes it usable before a site exists.

get_static_site_preview_url

Get Website Preview URL (drive_module)

Returns the live preview URL for a site's editable source folder, served over the existing /studio-drive/ route so the preview shows the current unpublished draft rather than the deployed version. The URL points at the region host that owns the folder and resolves relative assets at the sub-path. Path containment is enforced, so a crafted folder value cannot escape the caller's own tenant root.

Availability: Dashboard session

Parameters

Name Type Required Description
site_folder string Yes The source folder, for example /static-sites/ai-m9k3x2.

Notes

  • Clearance user, private: true. No min_plan.
  • Returns { url }.
  • This is the Dev preview. It is deliberately not the published site: what it shows is the working draft, including AI-vibe edits that have not been published yet.

list_site_files

List Site Files (drive_module)

Lists the paths and sizes of every file in a site's source folder, without any bytes, so a file navigator stays cheap. Resolves the folder from the app document's static_website.source.folder_path when only app_id is given. Returns an empty list rather than an error when the folder does not exist yet.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
site_folder string No Explicit folder, used instead of resolving from app_id. Not declared in config.

Notes

  • Clearance user, private: true. No min_plan.
  • Returns { folder, files: [{ path, size }] }, sorted by path.
  • A missing folder is not an error. You get an empty list, which is what a site that has never been published or uploaded to looks like.
  • This method reads the studio filesystem, the same source of truth the deploy path and vibe mode use. read_site_file and write_site_file do not; see their notes.

read_site_file

Read Site File (drive_module)

Reads one source file's text content.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
path string Yes Path relative to the site's source folder.

Notes

  • Clearance user, private: true. No min_plan.
  • Returns { path, content, size }.
  • Known resolution caveat. This method resolves the file through the user-drive document index in region object storage, not through the studio filesystem that list_site_files, the deploy path and vibe mode use. For a site whose source lives only on the studio filesystem it reports "file not found". Do not build a file browser on it; use list_site_files for navigation and the /studio-drive/ preview for content.

write_site_file

Write Site File (drive_module)

Writes or overwrites one source file. It deliberately does not publish: the change sits in the draft until the user runs a build, so nothing reaches the live site without an explicit action.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
path string Yes Path relative to the site's source folder.
content string Yes The new file content, as text.

Notes

  • Clearance user, private: true. No min_plan.
  • Returns { path, size }.
  • Writing never publishes. Call deploy_static_website when you want the change live.
  • Same user-drive resolution caveat as read_site_file.

create_static_website

Create Website (app_module)

The full provisioning entry point, run as a job so the create wizard can show progress. It validates the requested hosting tier against the plan catalog, builds the deploy_data that drives the per-deployment cost ledger, allocates a unique free subdomain from the site name (slugified to 3 to 30 DNS-safe characters, checked against a reserved list of roughly 50 entries and against both static-site and VPS-web subdomains), creates the app document with app_type: 'static_website', creates the xuda_site record in the app's assigned home region, then immediately publishes the supplied source folder as version 1.0.0 labeled "Initial deploy". If the first deploy fails the app is still returned so the user can retry from the project view. Any profile embeds chosen in the wizard are applied last and downgrade to a warning rather than failing the create.

Availability: Dashboard session

Parameters

Name Type Required Description
data.app_name string Yes Display name for the website. Also the basis for the free subdomain.
data.static_website_hosting_plan string Yes Plan tier: free, starter, pro or business. Defaults to free.
data.drive_reference object Yes Source location, for example { folder_path: '/static-sites/my-site' }.
data.embeds object No { profile_chat, profile_contact_form } applied after the first publish. Not declared in config.

Notes

  • Clearance user, private: true, broadcast: true. No min_plan.
  • Runs as a job with the steps "Creating site", "Publishing files", "Going live".
  • Plan gate: the tier is validated against the plan catalog. The internal tier keys are free, starter, pro and business; the customer-facing names are Free, Launch, Grow and Scale.
  • The subdomain is derived from the name, not chosen. Change it afterwards with set_site_subdomain.
  • Every tier allows unlimited sites. There is no per-account site cap; the plan is bought per website.
  • A failed first deploy does not roll the app back. You get the app, and you publish again with deploy_static_website.
  • Embed failures are warnings, not failures. The site is created either way.

deploy_static_website

Deploy Website (app_module)

The only publish path. It reads the current bytes from the site's source folder on the pinned studio filesystem (falling back to the legacy user-drive folder for sites created before that migration), runs the safety guards, then hands the files to deploy_site. Guards, in order: refuse an empty or all-empty file set ("The site has no content yet, there is nothing to publish"), refuse an empty index.html ("The site home page is empty"), and refuse a payload over the plan's storage cap with a message naming both sizes. A missing index.html is a warning, not a block, because some uploads legitimately use a different entry document. On success it records the source reference and deployment metadata on the app document and, when a semver is supplied, bumps app_publish_info.version, increments the build counter and stores the release notes and build type.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app to deploy.
drive_reference object Yes Source location, for example { folder_path: '/static-sites/my-site' }.
label string No Release notes for this version.
version_semver string No Human version number such as 1.2.0.
build_type string No major, minor or patch, recorded on the publish info.

Notes

  • Clearance user, private: true. No min_plan.
  • Returns { app_id, site_id, version, file_count, bytes, has_index, skipped, warnings }.
  • Plan gate: the per-site storage cap from the tier's size field is enforced here and nowhere else. Real bytes are estimated as three quarters of the base64 payload.
  • An over-cap publish is refused with both sizes and the plan named. The already-live version keeps serving, so a plan limit never takes a customer offline; only the next publish is blocked.
  • A failed or empty generation can never ship a blank live site. Zero files, an all-empty payload and an empty index.html are all refused before the hosting layer is reached, on every path including a direct call.
  • A missing index.html is a warnings entry, not a refusal.
  • Every successful call creates a new immutable version. This method is not idempotent by design: call it twice and you get two versions.

change_static_website_plan

Change Website Plan (app_module)

Moves one site between hosting tiers. It swaps the tier in deploy_data, recomputes the app_cost ledger with segmentation so the change is prorated for the rest of the cycle, and drops the ledger entirely when the result is the free tier with nothing to bill. Downgrading to Free additionally disconnects every custom domain attached to the site, one at a time and best-effort, and returns the list of domains it removed. Re-selecting the current tier is a no-op that returns unchanged: true.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
plan string Yes Target tier: free, starter, pro or business.

Notes

  • Clearance user, private: true, security: true, broadcast: true. No min_plan.
  • Returns { plan_tier, monthly, detached_domains }.
  • Idempotency: re-selecting the current tier returns unchanged: true and moves no money.
  • Downgrading to Free detaches every custom domain on the site. Those domains stop resolving to it, and the site keeps serving on its free *.xuda.app address. Read detached_domains to see exactly what came off.
  • The plan is per site, not per account. Changing one site's tier does not touch another site.
  • Billing is per deployment on the same app_cost ledger a VPS uses. The free tier writes no ledger at all, so a Free site costs nothing.
  • Mid-cycle moves are prorated by segmenting the ledger.

update_static_website_embeds

Update Website Embeds (app_module)

Saves the two site-wide embed options. For each option it resolves the supplied profile id, verifies the profile belongs to the caller, verifies that the feature is actually switched on for that profile (returning a message that names the profile and says exactly which tab to switch it on in), copies the profile's configured color and, for chat, its corner position, and stores the canonical <uid>.<profile_id> widget id. The two options are validated independently, so a rejected contact form no longer discards a valid chat embed; rejections come back as warnings. Only if every requested option was rejected does the call fail. The result is persisted on the app document and mirrored onto the site document, which is what the serving router reads when it injects the loader tags.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
profile_chat object No { enabled, profile_id }, or null to remove. Adds the profile's chat widget to every page.
profile_contact_form object No { enabled, profile_id }, or null to remove. Mounts the contact form inline where the page has a data-xuda-contact-form container, otherwise as a floating button.

Notes

  • Clearance user, private: true. No min_plan.
  • Ownership is enforced per profile: the profile must belong to the caller, and the feature must already be switched on in that profile.
  • The two options are validated independently. A rejected option comes back in warnings while the accepted one still saves. The call only fails when every requested option was rejected.
  • No redeploy is needed. The serving router injects the loader before </body> on every HTML page it serves, and skips a page that already carries the loader, so injection is idempotent per page.
  • Pass null to remove an embed.

list_site_versions

List Site Versions (domains_module)

Lists a site's deployed versions, newest first, for the Version Control tab. Each row carries both native fields (id, label, deployed_at, file_count, bytes, is_live, semver) and release-shaped aliases (version, release_note, date) so the shared version UI can render static-site versions the same way it renders build releases. Soft-deleted versions are filtered out.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
site_id string No Accepted as an alternative to app_id.

Notes

  • Clearance user, private: true. No min_plan.
  • Readable by the owner, a superuser, or an accepted team member of the owning app.
  • Up to 100 version entries are kept inline on the site document for the version UI.
  • Soft-deleted versions are filtered out of the response.

set_site_live_version

Set Site Live Version (domains_module)

Rolls the live pointer to any previously deployed version without re-uploading a single byte. It also overwrites the editable dev source on the studio filesystem with that version's files, so the next AI edit or build starts from the restored state, and it syncs the app header's version and size chips. This second effect is why the dashboard always confirms first: unpublished draft edits are destroyed. The live version can be moved forward again the same way.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
version string Yes Version id to make live.
site_id string No Accepted as an alternative to app_id.

Notes

  • Clearance user, private: true, security: true, broadcast: true. No min_plan.
  • Destructive side effect. The editable dev draft is overwritten from the restored version's manifest. Unpublished AI-vibe changes are replaced and cannot be recovered. Confirm before you call it.
  • No bytes move. Rollback re-points the site at a stored manifest, so it is effectively instant regardless of site size.
  • The move is reversible in the sense that you can set any other stored version live afterwards, but the draft that was overwritten does not come back.

delete_site_version

Delete Site Version (domains_module)

Soft-deletes one deployed version and reclaims its bytes from the region bucket on a best-effort basis. The currently live version cannot be deleted; the call returns "cannot delete the live version, restore another version first". Owner only.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
version string Yes Version id to delete.
site_id string No Accepted as an alternative to app_id.

Notes

  • Clearance user, private: true, security: true, broadcast: true. No min_plan.
  • Owner only. Team members who can read versions cannot delete them.
  • The live version is refused. Restore another version first, then delete.
  • Byte reclamation is best-effort. The version document is tombstoned either way.

set_site_subdomain

Set Site Subdomain (domains_module)

Changes the free *.xuda.app address, allowed on every plan including Free. The value is lowercased, stripped to letters, numbers and hyphens, trimmed of leading and trailing hyphens and capped at 30 characters; it must end up at least 3 characters long. A 30-entry reserved list is refused ("That subdomain is reserved, pick another"), and an already-taken label is refused ("That subdomain is already taken"). On success the new label is mirrored onto the app document and the new URL is returned.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
subdomain string Yes Desired label, 3 to 30 characters of a-z, 0-9 and -.
site_id string No Accepted as an alternative to app_id.

Notes

  • Clearance user, private: true, security: true, broadcast: true. No min_plan.
  • No plan gate. Renaming the free address works on Free as well as on every paid tier.
  • Reserved labels are refused. The list of 30 includes platform names such as www, api, admin, dashboard, mail, cdn, docs, blog, status and login.
  • Uniqueness is checked across sites, so a taken label is refused rather than silently shared.
  • The old address stops working as soon as the new one is saved. Anything linking to it needs updating.

get_site_hostnames

Get Site Hostnames (domains_module)

The Domain tab's payload. Returns the site's current subdomain and default URL, the CNAME target to point at, the advertised per-domain monthly price, every attached hostname with its type, status, SSL status and required records, and, when one exists, an in-progress nameserver-delegation connection (pending_connection) so the inline setup view can be rebuilt after a page refresh.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
site_id string No Accepted as an alternative to app_id.

Notes

  • Clearance user, private: true. No min_plan.
  • Readable by the owner, a superuser, or an accepted team member.
  • Do not build on two fields in this response. The returned custom_domain_price_monthly and can_connect_domain: true do not match what is actually billed or gated. Nothing is charged per domain today: custom domains are included in the paid tier. The real gate is that the free tier cannot connect a domain at all, and each paid tier has a numeric cap. See Plan Gates And The Plan Ladder.
  • pending_connection is how you resume a half-finished nameserver delegation after a reload.

attach_site_hostname

Attach Site Hostname (domains_module)

Connects a custom domain to a site. Three outcomes are possible. If the domain was bought through Xuda and the caller owns it, Xuda wires a proxied CNAME plus a worker route in its own zone and the hostname is active at once with automatic SSL. Otherwise a Cloudflare for SaaS custom hostname is created with TXT-based domain-control validation, and the response carries the exact records the user pastes at their registrar (routing CNAME or apex A records, an ownership TXT, and the SSL validation TXT records). The call blocks the free tier and enforces the tier's numeric domain cap before doing any of this.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
hostname string Yes The hostname to connect. Protocol and path are stripped, lowercased, must be ASCII and contain a dot.
site_id string No Accepted as an alternative to app_id.

Notes

  • Clearance user, private: true, security: true, broadcast: true.
  • Plan gate: no min_plan field, but the free tier is refused in code with "Custom domains are included on paid plans. Upgrade your site to connect one.", and the tier's custom_domain_limit is enforced with "This plan includes N custom domains. Upgrade the site to connect more."
  • A third-party apex domain cannot be connected this way. Cloudflare for SaaS validation requires a CNAME, which an apex cannot hold at most registrars. Use connect_external_domain instead.
  • A Xuda-registered domain needs no user action at all and is active immediately with free Universal SSL.
  • For a third-party hostname, the response's record set is what the user pastes at their registrar. Re-check progress with verify_site_hostname.

verify_site_hostname

Verify Site Hostname (domains_module)

Re-checks a pending custom hostname. For a Xuda-managed hostname it simply marks it active. For a third-party hostname it re-reads Cloudflare's custom-hostname status and SSL status, refreshes the required record set, collects Cloudflare's own verification and validation errors so a stuck "verifying" explains itself, and then performs a live per-record DNS-over-HTTPS lookup so the response can say which records are already present and which are still missing (records_in of records_total).

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
hostname string Yes The attached hostname to re-check.
site_id string No Accepted as an alternative to app_id.

Notes

  • Clearance user, private: true. No min_plan.
  • Safe to repeat. This is a read-and-refresh call with no destructive effect, which is why the Domain tab polls it.
  • Polling cadence used by the product: every 12 seconds for about 10 minutes. There is no server-side push; verification is client-driven.
  • Per-record DNS lookups run against cloudflare-dns.com over DNS-over-HTTPS, which is what lets the UI say "3 of 5 records detected" instead of showing one opaque spinner.
  • Cloudflare's own validation errors are surfaced verbatim, so a blocker such as an apex that cannot hold a CNAME reads as an actionable message rather than a stall.

detach_site_hostname

Detach Site Hostname (domains_module)

Removes a custom domain from a site. For a Xuda-managed hostname it deletes the DNS record and the worker route; for a third-party hostname it deletes the Cloudflare for SaaS custom hostname and the worker route. It then removes the host map entry, drops the hostname from the site document, recomputes the deployment's cost ledger, and frees the registered domain for reuse once its last hostname on this site is gone.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
hostname string Yes The hostname to detach.
site_id string No Accepted as an alternative to app_id.

Notes

  • Clearance user, private: true, security: true, broadcast: true. No min_plan.
  • Visitors using that hostname stop reaching the site. The site itself stays live on its free *.xuda.app address and on any other attached hostname.
  • The cost ledger is recomputed, and the registered domain is freed for reuse once its last hostname on this site is gone.
  • For a domain connected by nameserver delegation, prefer detach_external_domain_from_site or disconnect_external_domain, which handle the apex and www pair together.

connect_external_domain

Connect External Domain (domains_module)

Starts the nameserver-delegation path, which is the only way to serve a third-party apex domain, because Cloudflare for SaaS validation requires a CNAME and an apex cannot hold one at most registrars. Xuda creates a real Cloudflare zone for the domain in its own account with jump_start, so the customer's existing DNS (MX, SPF, verification records, other subdomains) is imported and nothing breaks, and returns the nameservers to set plus the imported record list. If the zone is already active, apex and www are wired to the site immediately. Re-running it on an already-connected domain is idempotent and self-heals a half-wired zone.

Availability: Dashboard session

Parameters

Name Type Required Description
domain string Yes The domain to connect. Protocol, path and a leading www. are stripped.
app_id string No The static-website app to wire once the zone activates.

Notes

  • Clearance user, private: true, security: true. No min_plan.
  • Idempotent. Re-running it on an already-connected domain repairs a half-wired zone rather than erroring or duplicating anything.
  • The customer's email keeps working. jump_start imports the existing records, and the later wiring step deletes only A, AAAA and CNAME routing records, leaving MX and TXT alone.
  • The domain does not go live until the owner replaces the registrar's nameservers with the two returned here. Poll with check_external_domain.

check_external_domain

Check External Domain (domains_module)

Polls the delegated zone's activation. When Cloudflare reports the zone active, it wires apex and www to the static-site edge (a proxied CNAME, falling back to proxied A records at the apex when a CNAME would collide with MX or TXT records), creates the worker routes, attaches both hostnames to the site, and recomputes billing. Wiring is re-run on every active check, so a partially wired domain repairs itself on the next poll. Returns the zone status, the nameservers, the current record list and whether wiring completed.

Availability: Dashboard session

Parameters

Name Type Required Description
domain string Yes The connected domain to poll.

Notes

  • Clearance user, private: true, security: true. No min_plan.
  • Idempotent and self-healing. Wiring is re-run on every active check, so calling it repeatedly is the intended usage.
  • Polling cadence used by the product: every 12 seconds for up to about 30 minutes. There is no webhook and no cron; activation is discovered by polling.
  • Apex and www are wired as a pair.

disconnect_external_domain

Disconnect External Domain (domains_module)

Full teardown of a connected external domain: detaches apex and www from the site, deletes the Cloudflare zone Xuda was hosting, and removes the domain record entirely. The domain stops resolving once the owner points the nameservers back at their registrar. Only domains whose connection_type is connected can be disconnected here.

Availability: Dashboard session

Parameters

Name Type Required Description
domain string Yes The connected domain to disconnect.

Notes

  • Clearance user, private: true, security: true, broadcast: true. No min_plan.
  • This is the hard teardown. The Cloudflare zone Xuda was hosting is deleted along with the domain record, so the imported DNS Xuda was serving goes with it. The owner must point the nameservers back at their registrar.
  • Only a domain whose connection_type is connected is accepted here.
  • If you only want the domain off this site while keeping it available to attach elsewhere, use detach_external_domain_from_site instead.

detach_external_domain_from_site

Detach External Domain From Site (domains_module)

The softer sibling of disconnect_external_domain. Removes the apex and www routing records, the worker routes, the host map entries and the site hostnames, and clears the domain's site attachment, but keeps the Cloudflare zone and the domain record so the domain stays in the user's Domains list ready to re-attach elsewhere. This is what the Domain tab's Remove button tries first.

Availability: Dashboard session

Parameters

Name Type Required Description
domain string Yes The domain to detach from its site. A leading www. is stripped.

Notes

  • Clearance user, private: true, security: true, broadcast: false. No min_plan.
  • The zone and the domain record survive, so the domain can be re-attached to another site without redoing the nameserver delegation.
  • Apex and www come off together.

get_site_analytics

Get Site Analytics (domains_module)

Per-site traffic from Cloudflare's adaptive HTTP dataset, scoped to this site's hostnames (its *.xuda.app subdomain plus every active custom hostname). The 24-hour window uses 15-minute buckets, 96 points from one query; the 3-day and 7-day windows are queried one day at a time, because Cloudflare caps a single query at one day on this plan, in batches of four and rolled into daily buckets. Returns a zero-filled timeseries of requests, cached requests and bandwidth, a totals block including cache_hit_ratio, and breakdowns for the top 8 paths, top 8 countries, top 12 status codes, top 6 device types, top 8 browsers and top 8 operating systems.

Availability: Dashboard session

Parameters

Name Type Required Description
app_id string Yes Id of the static-website app.
range string No 24h (default), 3d or 7d. Any other value falls back to 24h.
site_id string No Accepted as an alternative to app_id.

Notes

  • Clearance user, private: true. No min_plan.
  • Authorization is by site ownership, superuser, or accepted team membership, because the customer does not own the serving zone.
  • Any Cloudflare failure degrades gracefully to a zeroed series rather than an error. An empty chart can mean no traffic or an upstream hiccup; it never surfaces as a failed call.
  • Unique visitors are not available per subdomain on this plan and are not returned.
  • New traffic appears in the 24-hour view within roughly one 15-minute bucket.
  • An unrecognized range value silently falls back to 24h.

create_site

Create Site (domains_module)

Creates the xuda_site routing and hosting record that a website is served from, and returns its site_id plus the default *.xuda.app URL. This is the low-level primitive: the dashboard never calls it directly, create_static_website does, because a site on its own has no app doc, no plan and no billing. The new site starts with current_version: null, an empty manifest and no hostnames, so it serves a "Site not published yet" page until the first deploy.

Availability: Dashboard session

Parameters

Name Type Required Description
name string No Display name, trimmed and truncated to 80 characters. Defaults to "Untitled site".
mode string No static (default) or spa. spa makes unknown paths fall back to the index document.
subdomain string No The *.xuda.app label to serve on. Lowercased.
app_id string No The owning app doc id, which links the site to plan, billing and team access.
db_region string No Home region for the site's file bytes (data residency).

Notes

  • Clearance user, private: true. No min_plan.
  • The method configuration declares no fields block; the parameters above are what the implementation reads.
  • Prefer create_static_website. A site created here has no app document, so it has no plan, no billing and no team access, and none of the app-scoped methods in this reference can address it.
  • db_region pins where the bytes live. Sites are region-pinned for the life of the site.

list_sites

List Sites (domains_module)

Returns every website owned by the caller, in a slim shape for list views: site_id, name, mode, current_version, version_count, the attached hostnames as plain strings, created_at and updated_at.

Availability: Dashboard session

Parameters

This method takes no parameters beyond the session identity.

Notes

  • Clearance user, private: true. No min_plan.
  • Capped at 999 sites.
  • Ownership only. This method does not include sites shared through a team.
  • For the app-level view an external integration can actually reach, use get_account_static_websites instead.

get_site

Get Site (domains_module)

Returns the complete xuda_site document for one site, including the inline current_manifest, the version list, the hostname entries with their DNS records and status, the embed options and the region pinning.

Availability: Dashboard session

Parameters

Name Type Required Description
site_id string Yes Id of the owned website to fetch.

Notes

  • Clearance user, private: true. No min_plan.
  • Readable by the owner, by a superuser, or by an accepted team member of the owning app.
  • This is the whole document, including the inline manifest, so it is the heaviest read in the product. Use list_site_versions or get_site_hostnames when you only need one slice.

deploy_site

Deploy Site (domains_module)

Uploads a batch of files as a fresh immutable version and atomically flips the live pointer. Files are written to the app's home-region bucket under sites/{site_id}/{version}/{path}; the resulting manifest is persisted twice, as a standalone xuda_site_version document (the full history that makes rollback possible) and inline on the site document as current_manifest (so the serving router needs a single read). The atomic flip is that one save: a request arriving mid-deploy keeps getting the previous version until the line lands. Owner only, no team access.

Availability: Dashboard session

Parameters

Name Type Required Description
site_id string Yes Id of the website to deploy a new version to.
files array Yes Array of { path, content_b64, content_type? }. Paths are normalized; .. is rejected.
version string No Explicit version id. Defaults to a generated v_<base36 timestamp>.
version_semver string No Human version number such as 1.2.0, shown in the version UI.
label string No Release note stored on the version.
source object No Provenance, for example { type: 'studio_fs', folder_path: '/static-sites/my-site' }.
mode string No Switches the site between static and spa as part of the deploy.

Notes

  • Clearance user, private: true. No min_plan.
  • version, version_semver, label, source and mode are read by the implementation but are not declared in the config fields block.
  • Prefer deploy_static_website. This method does not run the empty-payload, empty-index.html or storage-cap guards. Those live one level up.
  • Atomicity: a single document save flips both the live version pointer and the inline manifest, so a visitor arriving mid-deploy sees the old version or the new one, never a mixture.
  • Up to 100 version entries are kept inline on the site document for the version UI.
  • Note that the method's stored configuration description mentions R2 and a KV pointer. The implementation writes to the region object-storage bucket and flips the pointer on the site document instead.
  • Owner only. Team members cannot deploy.

delete_site

Delete Site (domains_module)

Tears down a hosted site completely and in a deliberate order: custom hostnames are detached from the edge first so visitors get a clean 404 rather than a broken-site response mid-delete, then the site's bytes are reclaimed from the home-region bucket, then every version document is tombstoned, then the site document itself. Owner only. In normal use this is reached through destroy_app, not called directly.

Availability: Dashboard session

Parameters

Name Type Required Description
site_id string Yes Id of the website to delete along with its hostnames and stored files.

Notes

  • Clearance user, private: true. No min_plan.
  • Owner only.
  • Irreversible. Every version and every stored byte goes with the site.
  • The app document is not deleted by this method. Use destroy_app to remove the whole project, which reaches this internally.

destroy_app

Destroy App (app_module)

Permanently deletes an application. For a website it takes a dedicated branch that calls delete_site, tearing down the hosted files, every version, the custom hostnames and the per-deployment billing. A pre_destroy_app hook stamps app_cost.terminated_ts synchronously before the destruction job is queued, so the billing UI updates instantly.

Availability: API key

Parameters

Name Type Required Description
app_id string Yes Unique identifier of the application to permanently delete.

Notes

  • Clearance admin, is_async: true, security: true, enforce_usage: true, broadcast: true. Not private, so it is reachable with a developer API key that carries admin clearance. No min_plan.
  • This is the one destructive method in the product an API key can reach. Treat it accordingly.
  • Asynchronous. The call returns once the destruction job is queued, not once the teardown is finished.
  • Billing stops immediately: app_cost.terminated_ts is stamped synchronously, before the job runs.
  • Irreversible, and it takes the site, every version, every stored byte and every custom hostname with it. The dashboard additionally requires the user to type the site name.

Plan Gates And The Plan Ladder

No method in this product carries a min_plan field, so the platform's membership plan gate never fires here. Every gate is enforced inside the module and surfaced as a readable refusal message. There are exactly four of them, plus the AI entitlement rules on the builder.

Gate Where it fires What happens
Per-site storage cap deploy_static_website An over-cap publish is refused with a message naming both sizes and the plan. Real bytes are estimated as three quarters of the base64 payload.
Custom domains on Free attach_site_hostname Refused outright: "Custom domains are included on paid plans. Upgrade your site to connect one."
Numeric custom-domain cap attach_site_hostname Refused past the tier's custom_domain_limit: "This plan includes N custom domains. Upgrade the site to connect more."
Downgrade to Free change_static_website_plan Every connected custom domain is detached from the edge and returned in detached_domains.
AI image generation generate_site_draft, reported by get_site_build_image_modes gen_low and gen_high need a paid membership plus a non-free ai_workspace_plan in the ai_workspace catalog category. A locked mode answers { error: 'upgrade_required' }.
AI credits generate_site_draft An empty balance answers { error: 'credit_limit' } before any generation runs.

The plan catalog defines four tiers. The internal keys are free, starter, pro and business; those are the values the API takes. The customer-facing names are different, and the thing that actually changes between tiers is storage per site.

Tier key Display name Price Storage per site Custom domains
free Free $0 / mo 10 MB none, blocked
starter Launch $5 / mo 100 MB 2
pro Grow $15 / mo 1 GB 10
business Scale $39 / mo 5 GB unlimited

Four things about this ladder are worth knowing before you build against it:

  • Sites are unlimited on every tier. The plan is bought per website, not per account, and there is no per-account site cap.
  • Free costs literally nothing. The cost engine writes no ledger at all when the monthly total is zero.
  • Custom domains are included in the paid tier and cost nothing extra. The configuration still carries a per-domain monthly price and get_site_hostnames still returns it, but the cost engine explicitly treats domains as included and charges no add-on. Do not build a price display on that field.
  • The storage cap is checked at publish, not at upload. An already-over-cap site keeps serving its live version; only the next publish is blocked.

Two plan-catalog fields are stored but not acted on, so do not present them as limits to your users: bandwidth_gb is copied onto the app document on create and on plan change but is never metered anywhere, and sitemap_max_urls has no generation or enforcement code. The catalog flags sitemap, seo_metadata, microdata, password_protect and badge are likewise not built. The forms capability is delivered in practice by the profile contact-form embed rather than by a dedicated forms feature.

Errors

Every method returns the platform envelope { code, data }. A success carries code >= 1. A failure carries a negative code plus a message string in data. This product does not publish a numbered error-code catalog of its own; its refusals are readable sentences meant to be shown to the user as they arrive.

Refusals you should expect and handle by name:

Where Message or shape
deploy_static_website, empty payload "The site has no content yet, there is nothing to publish"
deploy_static_website, empty home page "The site home page is empty"
deploy_static_website, over the storage cap A message naming the payload size, the cap and the plan
attach_site_hostname on Free "Custom domains are included on paid plans. Upgrade your site to connect one."
attach_site_hostname past the cap "This plan includes N custom domains. Upgrade the site to connect more."
set_site_subdomain, reserved label "That subdomain is reserved, pick another"
set_site_subdomain, taken label "That subdomain is already taken"
delete_site_version on the live version "cannot delete the live version, restore another version first"
generate_site_draft, no credits { error: 'credit_limit' }
generate_site_draft, locked image mode { error: 'upgrade_required' } with the exact upgrade reason
update_static_website_embeds, feature off on the profile A message naming the profile and the tab to switch it on in, returned in warnings unless every option was rejected
verify_site_hostname, Cloudflare blocker Cloudflare's own verification and validation errors, passed through verbatim
read_site_file on a studio-filesystem site "file not found", because of the resolution caveat documented on that method

Two calls return warnings rather than failing: deploy_static_website reports a missing index.html in warnings, and update_static_website_embeds reports a per-option rejection in warnings while still saving the accepted option.

Webhooks

This product publishes no webhooks and runs no cron of its own. There is no inbound webhook either. Everything that looks event-driven is client-driven polling against idempotent, self-healing server methods:

  • A verifying custom hostname is re-checked with verify_site_hostname every 12 seconds for up to about 10 minutes.
  • A delegated zone is polled with check_external_domain every 12 seconds for up to about 30 minutes, and the wiring step is re-run on every active check so a partially wired domain repairs itself.

Progress on the two long-running calls, create_static_website and generate_site_draft, is delivered through the platform's job steps rather than through a webhook, and several methods carry broadcast: true so their result is pushed to the account's open dashboard sessions.

The Stripe webhooks that maintain the consolidated subscription belong to the billing layer, not to this product.

Rate Limits, Caps And Timeouts

There is no per-method request rate limit on this product. What it has instead are hard caps and timeouts, and these are the numbers that will actually shape an integration.

Scope Limit
Sites per account Unlimited on every tier
Sites returned by list_sites 999
App documents returned by get_account_static_websites 1000
Version entries kept inline on a site for the version UI 100
Storage per site 10 MB, 100 MB, 1 GB or 5 GB by tier, enforced at publish
Upload batch size used by the product for ingest_static_site_source roughly 4 MB per call
Images provisioned per fresh AI build at most 3, and never on a refine
Concurrent AI generations per user 1
generate_site_draft job timeout 600000 ms (10 minutes)
Codex call timeout inside a generation 240000 ms (4 minutes)
Subdomain label 3 to 30 characters of a-z, 0-9 and -, with 30 reserved names refused
Site display name on create_site truncated to 80 characters
Analytics query window 1 day per Cloudflare query, so 3d and 7d are fetched a day at a time in batches of four
Analytics breakdown sizes top 8 paths, top 8 countries, top 12 status codes, top 6 devices, top 8 browsers, top 8 operating systems

Idempotency And Ordering Guarantees

  • A deploy is atomic. A single document save flips both the live version pointer and the inline manifest, so a visitor arriving mid-deploy sees the old version or the new one, never a mixture.
  • A deploy is not idempotent. Every successful deploy_static_website or deploy_site call creates a new immutable version. Retry only when you want another version.
  • Rollback moves no bytes, and it overwrites the dev draft. set_site_live_version re-points the site at a stored manifest, then rewrites the editable source from that version. Unpublished draft edits are destroyed, which is why the call is security: true.
  • connect_external_domain and check_external_domain are idempotent and self-healing. Re-running either on an already-connected domain repairs a half-wired zone instead of duplicating anything, which is what makes safe polling possible.
  • verify_site_hostname is a pure re-check. It is safe to call as often as you like.
  • change_static_website_plan is a no-op on the current tier, returning unchanged: true and moving no money.
  • ingest_static_site_source appends. Batches accumulate into one tree, so use a fresh per-upload folder name when you want a clean tree.
  • Embed injection is idempotent per page. The serving router skips a page that already carries the loader tag.
  • Deletion is ordered so visitors never see a broken page. Hostnames come off the edge first, then the stored bytes are reclaimed, then every version document is tombstoned, then the site record.

A Note On Adjacent Methods

Four methods look related by name and are not part of this product. Do not build against them expecting static-website behavior.

  • get_website_data and get_website_page (website_module) serve Xuda's own marketing site content out of its own database. They have nothing to do with customer-hosted sites.
  • content_generate and content_list (content_module) are superuser methods that generate Xuda's editorial content on the master server. They are operator surface for a different product.

The serving side of a website is not a CPI surface at all. Once a site is published, it is served over plain HTTP from *.xuda.app and from any connected custom domain, with relative .css, .js and .mjs references stamped ?v=<version>, ETag: W/"<version>", Cache-Control: no-cache, must-revalidate on HTML and public, max-age=86400 on assets, and xu-site, xu-site-version and xu-region response headers. Site bytes are never publicly reachable: the origin mints a short-lived presigned URL per request and streams the response, so the storage bucket stays private.