# Quickstart: REST API

Integrate thin.host website hosting and domain provisioning into any application using the REST API.

## 1. Get a Platform API Key

Sign up at [thin.host](https://thin.host/signup), then open [Email & API → Settings](https://thin.host/platform/settings) in your dashboard to create an API key. Issue one key per app or agent that integrates with thin.host — each is labelled and can be revoked on its own.

> Sending email (`POST /v1/emails`) needs a separate, founder-approved access step beyond the API key. See [Get access to email](https://thin.host/docs/email).

## 2. Publish a Website

Send pages as HTML strings (assets go in `assets` as base64). The site is live at the returned `url` immediately. Requires a key created from the dashboard so it's linked to your account.

```bash
curl -X POST https://thin.host/v1/websites \
  -H "X-Platform-API-Key: th_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My Site",
    "slug": "my-site",
    "pages": [{"path": "/", "html": "<html><body><h1>Hello</h1></body></html>"}]
  }'

# Response includes: "url": "https://thin.host/s/my-site/"
```

Update it later with `PATCH /v1/websites/my-site` — pages upsert by path.

## 3. Provision a Domain

### curl

```bash
curl -X POST https://thin.host/v1/domains \
  -H "X-Platform-API-Key: th_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "mysite.com",
    "origin_url": "https://myapp.vercel.app",
    "end_user_email": "user@example.com"
  }'
```

### Python

```python
import requests

resp = requests.post(
    "https://thin.host/v1/domains",
    headers={"X-Platform-API-Key": "th_live_your_key"},
    json={
        "domain": "mysite.com",
        "origin_url": "https://myapp.vercel.app",
        "end_user_email": "user@example.com",
    },
)
data = resp.json()
print(data["claim_url"])  # Send this to the user
```

### Node.js

```javascript
const resp = await fetch("https://thin.host/v1/domains", {
  method: "POST",
  headers: {
    "X-Platform-API-Key": "th_live_your_key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    domain: "mysite.com",
    origin_url: "https://myapp.vercel.app",
    end_user_email: "user@example.com",
  }),
});
const data = await resp.json();
console.log(data.claim_url); // Send this to the user
```

## 4. Check Status

```bash
curl https://thin.host/v1/domains/{id} \
  -H "X-Platform-API-Key: th_live_your_key"

# Response:
# {
#   "id": "...",
#   "hostname": "mysite.com",
#   "status": "active",
#   "dns_status": "resolved",
#   "ssl_status": "active",
#   "payment_status": "paid",
#   "ready": true
# }
```

## 5. Update Origin

```bash
curl -X PATCH https://thin.host/v1/domains/{id} \
  -H "X-Platform-API-Key: th_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"origin_url": "https://new-deploy.vercel.app"}'
```

See the [REST API Reference](https://thin.host/docs/api) for full endpoint documentation.

---
Canonical page: https://thin.host/docs/quickstart-rest
