htmlhost.co

Documentation

Everything you need to deploy, manage, and edit HTML sites from the browser, terminal, or API.

Quick start

Get a live site in under 30 seconds. No account required for anonymous hosting. Sign in for more sites, longer TTLs, and AI editing.

Option 1: Browser

Go to htmlhost.co/new, paste or drop an HTML file, pick a TTL, and hit Publish. Done.

Option 2: CLI

bash# Install globally
npm i -g htmlhost-cli

# Authenticate (get a token at htmlhost.co/settings#keys)
htmlhost login

# Deploy (auto-detects index.html in current directory)
htmlhost deploy
# ✓ Live at https://bold-fern-x3k.htmlhost.co
#   Linked → .htmlhost (future deploys update this site)

Option 3: cURL

bashcurl -X POST https://htmlhost.co/api/sites \
  -H "Authorization: Bearer hh_live_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Hello World</h1>","ttl":"7d"}'

CLI reference

The htmlhost CLI is a zero-dependency Node.js tool. Requires Node 18+.

bashnpm i -g htmlhost-cli

htmlhost login

Authenticate with an API token. Tokens are generated at Settings → API keys. Credentials are saved to ~/.htmlhostrc.

htmlhost deploy [file]

Deploy an HTML file and get a live URL. If no file is specified, defaults to index.html in the current directory.

Parameter
Type
Description
--ttl <value>stringSet TTL: 1d, 7d, 30d, never
--slug <slug>stringRe-deploy to a specific site
--title <title>stringSet the site title
--newflagForce a new site (ignore .htmlhost link)
--no-assetsflagSkip automatic local asset uploading

Automatic asset uploading

When you deploy, the CLI automatically scans your HTML for local file references — scripts, stylesheets, images, fonts, video, and audio. Each local file is uploaded to your media library, and the references in the HTML are rewritten to point at the hosted URLs. This means your deployed site is fully self-contained and always works.

Files larger than 10 MB are skipped to avoid accidentally depleting storage. External URLs (https://, data:, etc.) are left untouched.

bash# Deploy with automatic asset uploading (default)
htmlhost deploy
# ✓ Found 3 local assets to upload
#
# ✓ styles.css (4.2 KB) → https://htmlhost.co/m/a1b2c3d4
# ✓ app.js (12.1 KB) → https://htmlhost.co/m/e5f6a7b8
# ✓ hero.png (340 KB) → https://htmlhost.co/m/c9d0e1f2
#
# ● Deploying new site…
# ✓ Live at https://bold-fern-x3k.htmlhost.co

# Skip asset uploading
htmlhost deploy --no-assets

The following references are detected and processed:

  • <script src>, <link href> — JS and CSS files
  • <img src>, <img srcset> — images
  • <video src>, <video poster>, <audio src> — media
  • url() in <style> blocks and inline styles — CSS backgrounds, fonts, etc.

Project linking (.htmlhost)

After the first deploy, the CLI saves the site slug to a .htmlhost file in your project directory. On subsequent deploys, the CLI detects this file and asks what to do:

text? This project is linked to bold-fern-x3k.htmlhost.co

    1. Overwrite existing site
    2. Create a new site instead
    3. Cancel
    4. Always overwrite (remember for this project)
    5. Always create new (remember for this project)

  Enter choice (1-5):

Choosing option 4 or 5 saves the preference to .htmlhost, so you won't be asked again for that project. Use --new to skip the prompt and force a new site.

bash# First deploy — creates site and .htmlhost link
htmlhost deploy

# Second deploy — prompts to overwrite or create new
htmlhost deploy

# Deploy a specific file
htmlhost deploy contact.html

# Force a new site (bypass .htmlhost)
htmlhost deploy --new

htmlhost list

List all your sites in a formatted table showing slug, URL, size, TTL, and expiry.

htmlhost delete <slug>

Delete a site by slug. Use --force to skip the confirmation prompt.

htmlhost upload <file|dir>

Upload images, fonts, or other assets to your media library. Returns permanent URLs to use in your HTML.

bash# Single file
htmlhost upload logo.png
# → https://htmlhost.co/m/a3f91c2b

# Entire directory
htmlhost upload ./assets/

htmlhost whoami

Show the authenticated user's email, handle, and plan.

htmlhost logout

Remove saved credentials from ~/.htmlhostrc.

REST API

All endpoints accept Authorization: Bearer <token> headers. Generate tokens at Settings → API keys.

Base URL: https://htmlhost.co

GET
/api/sites
List all your sites with usage stats
POST
/api/sites
Deploy a new site or re-deploy to existing slug
DELETE
/api/sites?slug={slug}
Delete a site by slug
GET
/api/media
List your media files
POST
/api/media
Upload a media file (multipart/form-data)
DELETE
/api/media
Delete a media file by ID
GET
/api/tokens
List your API tokens
POST
/api/tokens
Create a new API token
DELETE
/api/tokens?id={id}
Revoke an API token
GET
/api/tokens/me
Validate token and return user info

Deploy

POST /api/sites

Create a new site or update an existing one.

Parameter
Type
Description
htmlstringRequired. The HTML content to deploy
titlestringOptional. Falls back to <title> tag or auto-generated name
ttlstringOptional. 1d, 7d, 30d, or never. Defaults to plan default
slugstringOptional. If provided, re-deploys to that existing site

Response

json{
  "ok": true,
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "slug": "bold-fern-x3k",
  "url": "bold-fern-x3k.htmlhost.co",
  "version": 1,
  "ttl": "7d",
  "expiresAt": "2026-05-11T08:00:00.000Z"
}

GET /api/sites

Returns all your sites and aggregate usage stats.

json{
  "sites": [
    {
      "id": "...",
      "slug": "bold-fern-x3k",
      "title": "My Portfolio",
      "url": "bold-fern-x3k.htmlhost.co",
      "sizeBytes": 4200,
      "size": "4.1 KB",
      "ttl": "7d",
      "expiresAt": "2026-05-11T08:00:00.000Z",
      "createdAt": "2026-05-04T08:00:00.000Z",
      "updatedAt": "2026-05-04T08:00:00.000Z"
    }
  ],
  "usage": {
    "siteCount": 1,
    "maxSites": 20,
    "totalBytes": 4200,
    "maxBytes": 524288000,
    "plan": "free"
  }
}

DELETE /api/sites

Delete by slug or UUID.

bashcurl -X DELETE "https://htmlhost.co/api/sites?slug=bold-fern-x3k" \
  -H "Authorization: Bearer hh_live_your_token"

Media library

Upload images, fonts, and other assets. Each file gets a permanent URL served from Cloudflare's edge CDN. Use these URLs in your HTML.

Tip: When you htmlhost deploy, local assets are automatically uploaded to your media library and the HTML references are rewritten — no manual upload step needed. See the CLI → Automatic asset uploading section for details.

Upload via cURL

bashcurl -X POST https://htmlhost.co/api/media \
  -H "Authorization: Bearer hh_live_your_token" \
  -F "file=@logo.png"

Upload via CLI

bashhtmlhost upload logo.png
htmlhost upload ./images/

Allowed file types

Images (PNG, JPG, GIF, SVG, WebP, ICO), fonts (WOFF, WOFF2, TTF, OTF), documents (PDF), video (MP4, WebM), audio (MP3, OGG, WAV), and code assets (CSS, JS, JSON).

AI visual editing

The browser editor includes an AI assistant that can edit your HTML visually. Click any element, describe the change in natural language, and watch it update live.

Built-in AI

Free plan: 10 AI edits per day. Pro plan: 100 edits per day. Uses platform-managed API keys — no setup required.

Bring your own key (BYOK)

For unlimited edits, add your own API key from any supported provider. Keys are stored in your browser's localStorage and never sent to our servers.

Provider
Models
Key prefix
OpenAIGPT-4o, GPT-4o-minisk-...
AnthropicClaude Sonnet 4, Claude Haikusk-ant-...
GoogleGemini 2.5 Flash, Gemini 2.5 ProAIza...

Custom domains

Pro users can connect custom domains to any site. Go to Settings → Domains and add your domain.

DNS setup

textType:  CNAME
Name:  your-subdomain (or @ for apex)
Value: sites.htmlhost.co
TTL:   Auto

SSL is provisioned automatically. Propagation takes 1–10 minutes. We verify ownership via DNS lookup.

API tokens

Tokens authenticate CLI and API requests. Generate them at Settings → API keys.

Token format

texthh_live_a91fc7b3d2e014c8f5a6b9d0e1f2a3b4c5d6e7f8

Tokens start with hh_live_ and contain 48 hex characters. The raw token is shown once at creation. We store only the SHA-256 hash on our servers.

Security

  • Tokens are hashed server-side — we never store the raw token
  • ~/.htmlhostrc is created with 0600 permissions (owner-only)
  • Revoke a token instantly from Settings — all sessions using it stop immediately
  • Maximum 10 tokens per account

Plans & limits

Limit
Anonymous
Free
Pro ($9/mo)
Sites520Unlimited
Storage50 MB500 MB10 GB
Max TTL7 days30 daysNever
AI edits10/day100/day
Expired site restore
Custom domains
API / CLI
Media library50 MB1 GB

What happens when a site expires?

When a site's TTL elapses, the public URL goes offline (returns a 410). The site stays in your dashboard so you don't lose track of it.

  • Free users can delete expired sites or upgrade to Pro to restore them
  • Pro users can still preview expired sites and republish with one click to bring them back online
  • Expired sites don't count toward your active site quota

Questions? Reach out at hey@htmlhost.co

htmlhost.co