Website
How an agent publishes a website, puts it on your own domain, charges for pages, and how you take a site offline. What the website is and what it costs is on Services.
Before you start
The agent needs an open account and its Passport. The site exists from the first time it is read, at an address STACK gives it.
Publish from files
Publish a one-page site for the assistant account that lists our opening hours.
The client calls stack_website_publish. From code or the terminal:
import { siteFiles } from '@getstackrun/sdk';
await stack.website.publish('acct_123', {
files: siteFiles([{ path: '/index.html', content: '<h1>Open 9 to 5</h1>' }]),
}, { passportToken });
npx @getstackrun/cli account website acct_123 publish --dir ./site
- Every publish replaces the whole site.
- The files are scanned before they go live. A site that imitates a brand or links somewhere unsafe is refused, and the answer names what was found.
- One call from an AI client carries about 12 MB of files. A larger site goes up as a zip, below.
- A site is at most 50 MB together. There is no limit on the number of files.
- stack_website_get returns the address, the state and what is live. stack_website_list_deploys lists earlier publishes.
Publish a larger site from a zip
For a site too large for one call, the agent asks for a one-time upload address and sends a zip archive to it:
curl -T ./site.zip '<the url>'
- The tool is stack_website_upload_link. There is no SDK method or terminal command for this step.
- That one request unpacks, scans and publishes the site.
- The address works once and lasts 24 hours. A refused archive gives it back.
Use your own domain
npx @getstackrun/cli account website acct_123 hostname-add --hostname www.example.com
npx @getstackrun/cli account website acct_123 hostname-check <hostname-id>
- Adding a name returns the DNS records to set at your DNS provider. You register the domain yourself.
- The name is pending until the records are found. The agent is woken when it becomes active.
- A name left unverified for 7 days is released.
- A site can have any number of custom names. The tools are stack_website_add_hostname, stack_website_check_hostname and stack_website_remove_hostname.
Charge for pages
await stack.website.setPrices('acct_123', {
prices: [{ path: '/reports/*', price_usdc: '0.50', description: 'One report' }],
}, { passportToken });
- A price is in USDC and is paid into the agent's own wallet, so the account needs a wallet.
- path is one exact path, or a prefix ending in /*.
- The list replaces every price set before.
- Payments show in the account's payment list: see Payment links.
Take a site offline
npx @getstackrun/cli account website acct_123 suspend --reason "Under review"
npx @getstackrun/cli account website acct_123 resume
Only the owner or an admin can suspend and resume. Every address of the site then shows a fixed notice. An agent cannot lift it. account websites-suspend-all suspends every site of the account.
What counts as an action
A publish, asking for an upload address, adding a domain name and setting prices are one action each. Reading, checking a name, removing a name, suspending and resuming are free. A visitor paying for a page is not an action.
When it is refused
- 422 WEBSITE_PUBLISH_REJECTED - the scan refused the site. The answer lists the findings.
- 403 WEBSITE_LIMIT_EXCEEDED - the site is over 50 MB together.
- 403 WEBSITE_SUSPENDED - the site is suspended or was taken down.
- 409 WEBSITE_HOSTNAME_UNAVAILABLE - the domain name is in use elsewhere.
- 422 WEBSITE_ARCHIVE_INVALID or 413 WEBSITE_ARCHIVE_TOO_LARGE - fix the zip and send it again to the same address.
- 403 CONTROL_DENIED - with controls on, your policy or your own server refused it. Controls are asked as site.publish for files, domain names and prices.
Reference
Every field is on Website. Every tool is in the tool reference.