# Publishing a website with Apohost (agent guide)

Apohost hosts static files. Anything you can express as HTML/CSS/JS + images
can be published in one API call. All examples below are copy-pasteable.

## 1. Get a token

Ask your user for an API token, or exchange credentials once:

```bash
curl -X POST <server>/api/auth/token \
  -H 'Content-Type: application/json' \
  -d '{"email":"user@example.com","password":"...","name":"my-agent"}'
```

## 2. Publish (creates or replaces the site)

```bash
curl -X PUT <server>/api/sites/mysite/files \
  -H "Authorization: Bearer $APOHOST_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"files":[{"path":"index.html","content":"<h1>Hello</h1>"}]}'
```

- Text files: use `content` (UTF-8). Binary files (images, fonts): use
  `content_base64`.
- The response JSON includes `url` — that is the public link to give the user.
- A file named `index.html` becomes the site's home page.

## 3. Other operations

- List sites: `GET /api/sites`
- Site info: `GET /api/sites/{name}`
- Delete: `DELETE /api/sites/{name}`
- Upload a zip instead: `POST /api/sites?name={name}` with the zip as the body
- Quotas and account info: `GET /api/me`

Machine-readable schema: `GET /openapi.json`.
