Source: https://datafa.st/docs/api/account/websites
Markdown source: https://datafa.st/docs/api/account/websites.md
Description: List, create, and update websites from the REST API.

# Websites

Use these endpoints to manage websites from a backend, script, or AI agent. Creating websites requires a `dft_` account token. Website-scoped reads and settings updates can use a `dft_` token or a matching `df_` website key when supported.

Use this API when onboarding customers into DataFast from your own product, provisioning demo websites for an agent, or building an internal admin panel. Website deletion is intentionally dashboard-only, so destructive automation cannot remove a website by accident.

Base path: `https://datafa.st/api/v1/admin`

| Endpoint | Method | Path | Permission | Purpose |
|---|---|---|---|---|
| [List websites](/docs/api/account/websites/list) | GET | `/websites` | `websites:read` | List websites available to the token |
| [Create website](/docs/api/account/websites/create) | POST | `/websites` | `websites:write` | Create a website |
| [Get website](/docs/api/account/websites/retrieve) | GET | `/websites/{websiteId}` | `settings:read` | Get website settings |
| [Update website](/docs/api/account/websites/update) | PUT | `/websites/{websiteId}` | `settings:write` | Update website settings |
| [Delete website](/docs/api/account/websites/delete) | DELETE | `/websites/{websiteId}` | `websites:write` | Currently returns `403`; website deletion is dashboard-only |

## Create a website

```sh
curl -X POST "https://datafa.st/api/v1/admin/websites" \
  -H "Authorization: Bearer dft_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "example.com",
    "timezone": "America/New_York",
    "name": "Example"
  }'
```

## Update settings

```sh
curl -X PUT "https://datafa.st/api/v1/admin/websites/YOUR_WEBSITE_ID" \
  -H "Authorization: Bearer dft_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New name",
    "kpi": "signup",
    "kpiColorScheme": "green",
    "includeRenewalRevenue": true
  }'
```

Common updatable fields include `domain`, `name`, `timezone`, `currency`, `kpi`, `kpiColorScheme`, `revenueMetric`, `isCookieless`, `includeRenewalRevenue`, `allowedHostnames`, `excludedIps`, `excludedPaths`, `excludedCountries`, and `excludedHostnames`.

Related docs: [website API keys](/docs/api/account/website-keys), [authentication and scopes](/docs/api/authentication), [CLI websites](/docs/cli-websites).

## Code examples

### Create a website

```bash
curl -X POST "https://datafa.st/api/v1/admin/websites" \
  -H "Authorization: Bearer dft_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "example.com",
    "timezone": "America/New_York",
    "name": "Example"
  }'
```

### Success response

```json
{
  "status": "success",
  "data": [
    {
      "websiteId": "665f0b3c4d2e1a0012345678",
      "domain": "example.com",
      "trackingId": "dfid_abc123"
    }
  ]
}
```
