---
name: htmlify-ai
description: >-
  Host a single-file, self-contained HTML document at a
  stable htmlify.ai URL, versioned by path and git commit
  and archived durably in cite.pub. One command: `curl -s
  https://htmlify.ai/SKILL.py | python3 - index.html --path
  tmp/slug/index.html` validates, logs in with the env
  credentials, uploads, and verifies. Backed by the
  TCAI_USERNAME/TCAI_PASSWORD trycopilot account.
---

# htmlify.ai

htmlify.ai stores demo-grade single-file HTML documents. Every upload is archived into cite.pub, the durable archive and short-code source: the returned short code resolves at both `https://htmlify.ai/<code>` and `https://cite.pub/<code>`.

## Quick start: upload one file

Run the served helper — `SKILL.py` validates the document,
logs in, uploads, and verifies in one command:

```sh
curl -s https://htmlify.ai/SKILL.py | python3 - index.html \
  --path tmp/2026-07-09-some-slug/index.gpt.html
```

It reads `TCAI_USERNAME` and `TCAI_PASSWORD` from the
environment (for example `set -a; . ~/my/.env; set +a`) and
resolves the commit from the current repository's HEAD; pass
`--commit <sha|HEAD>` and `--repo <dir>` to override, and
`--dry-run` to validate without uploading. Success prints JSON
with `canonical_url`, `short_code`, `cite_pub_url`, and
`bytes`.

Piping a remote script into `python3` runs remote code; to
inspect it first, `curl -sO https://htmlify.ai/SKILL.py` then
`python3 SKILL.py index.html --path <userpath>`. The raw API
the script uses is documented below.

## URLs

- Canonical: `https://htmlify.ai/<username>/<userpath>@<commit>` where `<commit>` is a 7-char git sha or `HEAD`. Omitting `@<commit>` serves HEAD (the newest upload for that path). `<username>` is `p13i` today.
- Short code: `https://htmlify.ai/<code>` (8 chars; the same code resolves at `https://cite.pub/<code>`).

## Auth (one-time setup)

Reading documents is public. Uploading requires a trycopilot.ai login. Provide `TCAI_USERNAME` and `TCAI_PASSWORD` via the environment or a gitignored `.env`, then mint a bearer token (valid until logout):

```sh
curl -si https://auth.trycopilot.ai/login/ \
  --data-urlencode "email=$TCAI_USERNAME" \
  --data-urlencode "password=$TCAI_PASSWORD" \
  | grep -o 'auth_token=[^;]*'
```

Send the token on API calls as `Authorization: Bearer <auth_token>`.

## Upload

```sh
curl -s "https://htmlify.ai/upload/?path=tmp/2026-07-09-some-slug/index.gpt.html&commit=$(git rev-parse --short=7 HEAD)" \
  -H "Authorization: Bearer $TCAI_AUTH_TOKEN" \
  -H "Content-Type: text/html" \
  --data-binary @index.html
```

A successful upload returns HTTP 201 JSON with `canonical_url`, `short_code`, `cite_pub_url`, and `bytes`. Constraints: self-contained HTML only (inline CSS and JS, no external assets), at most 4 MiB, and the body must open with an HTML doctype or `<html>` tag. Re-uploading the same path and commit appends a new version; the newest wins.

Errors: 400 invalid path, commit, or bytes; 403 missing or invalid token (JSON); 413 oversized body.

## Fetch

```sh
curl -s https://htmlify.ai/p13i/tmp/2026-07-09-some-slug/index.gpt.html
curl -s "https://htmlify.ai/p13i/tmp/2026-07-09-some-slug/index.gpt.html@abc1234"
curl -s https://htmlify.ai/<short_code>
```
