Command Reference

The complete surge command surface. Run surge --help for the built-in version of this list; every command also accepts --help.

Global flags

Flag Alias Description
--project <path> -p The directory to publish. Also settable as the first positional argument.
--domain <domain> -d The domain to act on. Also settable as a positional argument or via the CNAME file.
--preview --stage, -s Publish as a preview deploy instead of cutting over production.
--message <msg> -m Attach a deploy message to the revision.
--add <email> -a Add a collaborator during publish.
--remove <email> -r Remove a collaborator during publish.
--token <token> Authenticate with a token instead of the stored login. The SURGE_TOKEN environment variable does the same.
--endpoint <url> -e Target a different Surge API endpoint.
--version -V Print the CLI version.
--help -h Print the command listing.

Publishing

surge [path] [domain]

Publish a directory to a domain. Prompts for anything not supplied; reads the domain from a CNAME file when present; suggests a generated .surge.sh subdomain otherwise (enter _ at the prompt for a fresh suggestion). Respects .surgeignore. Prefix the domain with https:// to force HTTPS redirects for the project. → Publishing

surge teardown <domain>

Remove the project from the domain and the CDN. → Revisions

Revisions

surge list [domain]

Without a domain: every project on your account, with age, tooling, and plan. With a domain: the project's revisions—preview URL, age, author, size, and message—with the live revision highlighted. → Revisions

surge rollback <domain>

Serve the previous revision.

surge rollfore <domain>

Serve the next revision (the inverse of rollback).

surge cutover <domain> [revision]

Serve the latest revision, or the given one. Ships preview deploys.

surge discard <domain> [revision]

Remove a revision from the system. If it was live, production moves to a neighboring revision; discarding the last revision takes the project offline.

Domains & DNS

surge dns <domain>

List the domain's custom DNS records. → Domains & DNS

surge dns <domain> add <type> <name> <value>

Add a DNS record. MX records take a priority: surge dns <domain> add MX <priority> <value> (host defaults to @) or add MX <name> <priority> <value>.

surge dns <domain> rem <id>

Remove a DNS record by the id shown in the listing.

surge zone <domain>

Print the domain's complete zone in BIND format, including records Surge manages automatically. Supports the same add/rem subcommands as dns.

SSL

surge encrypt <domain>

Provision a managed SSL certificate for the domain and install it across the CDN. Renews automatically. → SSL Certificates

surge certs <domain>

Show the certificates installed for the domain: subject, issuer, alt names, expiry, auto-renewal.

surge ssl <domain> --pem <file>

Upload a custom certificate as a PEM bundle (cert + intermediates + key). Validated before being applied. Paid plans.

Configuration & diagnostics

surge config <domain>

View the project's platform settings; pass --<setting> <value> flags to change them. → Project Configuration

surge files <domain>

List every file in the live revision with its size, as served by the CDN.

surge audit <domain>

Report each edge node's state for the domain: revision, file count, size, certificate validity.

surge bust <domain>

Purge the project from the cache on all edge nodes.

Analytics

surge traffic <domain>

Visits, uniques, connections, encryption share, cache hit rates, top pages, 404s, redirects, and sources for the past two weeks. → Analytics

surge audience <domain>

Browsers, operating systems, and devices of your visitors.

surge usage <domain>

Per-file bandwidth served, with a projected monthly total.

surge load <domain>

Connection volume per datacenter across the network.

Collaborators

surge invite <domain> <emails…>

Invite one or more people to publish to the project. → Collaborators

surge revoke <domain> <emails…>

Revoke publishing rights immediately.

Account

surge login

Authenticate (or create an account) and store a token in ~/.netrc. → Account & Plans

surge logout

Remove the stored token.

surge whoami

Show the logged-in email and plan.

surge verify

Send an email verification link to your address.

surge token

Print a token for CI and automation. → CI & Automation

surge plan [--web | --manage]

Change your account plan interactively, or print a private browser link for checkout (--web) or full billing management (--manage).

surge card

Update the payment card on file.

surge nuke

Permanently delete your account. Requires all projects to be torn down first.