---
name: static-app
description: Use when the user wants to publish, deploy or host something at a live URL (a static site, HTML page, report, docs, prototype, PDF) on Static.app, or to manage Static.app sites, files, pages, settings, analytics, custom domains, DNS or form submissions with the `static` CLI.
---

# Static.app CLI

`static` publishes static files to a live URL and manages the sites behind them. Static.app hosts static files only (HTML, CSS, JS, images, PDFs, client-side apps).

## Before anything else

1. Run `static whoami --json`.
   - Exit code 3 means no key or a refused key. Ask the user to run `static login` (or set `STATIC_API_KEY`) with a key from https://static.app/account/api. Never invent a key, and never ask the user to paste one into the chat.
   - `static: command not found`: ask the user to install it with `curl -fsSL https://static.app/install.sh | sh`.
2. Add `--json` to every command. Output is then one JSON value on stdout; an error is `{"error": "...", "code": N}` on stdout with a non-zero exit code.

## Deploy

```sh
static deploy --json              # current directory
static deploy dist --json         # a build folder
static deploy report.html --json  # one file (HTML is served as the index)
static deploy site.zip --json     # an existing archive
```

- The result is `{"site": "<pid>", "url": "https://...", "created": true|false, ...}`. Give the user `url` exactly as returned (`file_url` instead, when present). Do not guess or rewrite addresses.
- The first deploy of a new site writes `.static.json` (`{"site": "<pid>"}`) in the current directory. Later `static deploy` runs there update the same site. Run deploy from the same directory every time, and don't delete that file.
- Deploy the built output (`dist`, `build`, `out`, `public`), not the source tree. Run the project's build first if there is one. The folder needs an `index.html` at its top.
- Skipped automatically: `.git`, `node_modules`, `.DS_Store`, `.static.json`, `.env*`. The archive limit is 200MB.
- `--name my-site` picks the subdomain of a new site: lowercase a-z with at most one hyphen between letters, no digits. `--site PID` updates a specific site.
- To change a few files rather than redeploy, use `static files write`.

## Site PID

Most commands take a site PID: ten characters from 0-9 and a-z, such as `0aw4jtby1z`. Get it from `static sites --json` or `.static.json`. In a directory with `.static.json` the PID can be left out (`static files list --json`). `static sites delete` always needs it spelled out.

## Rules

- Never delete a site, files, DNS records or form entries unless the user asked for that specific deletion. `static sites delete PID --yes` cannot be undone.
- Don't change a domain's nameservers or DNS without an explicit request: it can take sites offline.
- Out of scope: server-side code (PHP, Node servers, Python), databases and server-side secrets. Buying, renewing and transferring domains happen in the dashboard at https://static.app, not here.
- A refusal that mentions a plan or permission is not a bug. Check `static whoami --json` (plan, plan_active, permissions) and tell the user what is needed.

## Commands

```
static whoami
static deploy [PATH] [--site PID] [--name NAME] [--url ARCHIVE_URL]
static link PID | static unlink
static sites [list] | sites get [PID] | sites delete PID --yes | sites download [PID] [-o FILE] [--link]
static files list [PID]
static files read [PID] PATH
static files write [PID] LOCAL_PATH... [--to REMOTE_DIR] [--create-only]
static files delete [PID] PATH...
static files download [PID] PATH... [-o DIR] [--link]
static settings get [PID]
static settings set [PID] title=.. description=.. is_js_app=true|false use_pretty_urls=true|false analytics=disabled|public|private
static settings analytics [PID] disabled|public|private
static password set [PID] --password P | password remove [PID]
static analytics [PID] [--report overview|pages|os|browsers|locations|referring_sites|referrers|keyphrases] [--limit N]
static pages list [PID] | pages get [PID] PAGE_PID
static pages update [PID] PAGE_PID custom_url=.. visibility=public|hidden|password password=.. is_homepage=true|false description=.. redirect_target=.. redirect_type=301|302|307|308 custom_error=404
static domain get [PID] | domain connect [PID] DOMAIN | domain disconnect [PID]
static domain www-redirect [PID] on|off | domain free-redirect [PID] on|off
static domains [list] | domains get DOMAIN | domains dns DOMAIN
static domains dns add DOMAIN --type A --name @ --data 1.2.3.4 [--ttl 3600] [--priority N]
static domains dns update DOMAIN RECORD_ID --type .. --name .. --data .. | domains dns delete DOMAIN RECORD_ID
static domains nameservers DOMAIN NS1 NS2 ... | domains assign DOMAIN SITE_PID | domains unassign DOMAIN
static forms list [PID] | forms get [PID] FORM_ID
static forms entries [PID] FORM_ID [--limit N] [--offset N] | forms delete-entry [PID] FORM_ID ENTRY_ID
static workspaces [list] | workspaces switch WORKSPACE_PID
static help [command]
```

Notes:
- `files write` with a directory uploads it under its own name (like `cp -r`); `.` uploads the current directory's contents. `--to` sets the target directory inside the site.
- `files read` prints the file. Files over 1MB are refused; use `files download`.
- `domain connect` is for a domain registered elsewhere: its DNS must point here first (`static domain get` lists the records). For a domain registered with Static.app use `domains assign`.
- A custom domain and password protection need a paid plan.

## Exit codes

0 ok, 1 error, 2 usage error, 3 not logged in or key refused (401/403), 4 not found (404).
