Source: https://datafa.st/docs/api/account/websites/update
Markdown source: https://datafa.st/docs/api/account/websites/update.md
Description: Update website settings.

# Update website

`PUT https://datafa.st/api/v1/admin/websites/{websiteId}`

Update website settings such as name, timezone, currency, KPI, tracking rules, and notification preferences. Send only the fields you want to change.

Viewers cannot write. Members can update most settings; team management remains owner-only.

## Request

#### Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `websiteId` | string | — | Website ObjectId. From [List websites](/docs/api/account/websites/list) (`_id` field). Example: `665f0b3c4d2e1a0012345678`. |

#### Body parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `domain` | string | No | Tracked domain without `https://`. Example: `"example.com"`. Must pass DataFast domain validation. |
| `name` | string\|null | No | Name shown in the dashboard. Example: `"My SaaS"`. Optional on create. |
| `timezone` | string | No | Timezone used to interpret dates and group analytics buckets. Defaults to the website timezone. IANA timezone for dashboard periods and API date grouping. Examples: `"America/New_York"`, `"Europe/Paris"`, `"UTC"`. |
| `currency` | string | No | ISO 4217 currency for revenue. Example: `"USD"`, `"EUR"`. |
| `kpi` | string | No | Goal name used as the dashboard KPI card. Must match a tracked goal. Example: `"signup"`. List names via [List tracked goals](/docs/api/account/tracked-goals/list). |
| `kpiColorScheme` | string | No | Dashboard KPI card color. Example: `"orange"`, `"blue"`. |
| `revenueMetric` | string | No | How revenue is summarized. Example: `"revenue"` or `"mrr"` when supported. |
| `sendWeeklyReports` | boolean | No | `true` to email weekly analytics summaries. |
| `sendViralTrafficAlerts` | boolean | No | `true` to notify on traffic spikes. |
| `isPublicDashboardEnabled` | boolean | No | `true` to enable a shareable public dashboard link. |
| `isPublicDataEnabled` | boolean | No | `true` to expose metrics on public dashboards/widgets. |
| `isCookieless` | boolean | No | `true` for cookieless tracking mode. See [script configuration](/docs/script-configuration). |
| `isAttackModeEnabled` | boolean | No | `true` to enable attack-mode bot filtering. |
| `includeRenewalRevenue` | boolean | No | `true` to count renewal revenue in KPI totals. |
| `allowedHostnames` | string[] | No | Hostnames allowed to send events. Example: `["example.com", "www.example.com"]`. |
| `isAllHostnamesAllowed` | boolean | No | `true` to accept events from any hostname. |
| `excludedIps` | string[] | No | IPs excluded from tracking. Example: `["203.0.113.10"]`. |
| `excludedPaths` | string[] | No | URL paths excluded from tracking. Example: `["/admin", "/preview"]`. |
| `excludedCountries` | string[] | No | Country names or codes excluded from tracking. |
| `excludedHostnames` | string[] | No | Hostnames excluded from tracking. |

#### Example request body

Send only fields you want to change:

```json
{
  "name": "Renamed product",
  "timezone": "Europe/Paris",
  "currency": "EUR",
  "kpi": "signup",
  "includeRenewalRevenue": true,
  "excludedPaths": ["/admin", "/preview"]
}
```

## Response

Returns a JSON object with `status: "success"` and endpoint-specific fields in `data`.

#### Response fields

| Field | Type | Description |
| --- | --- | --- |
| `data[]._id` | string | Website ObjectId. |
| `data[].domain` | string | Website domain. |
| `data[].name` | string\|null | Human-readable name for the resource or event. The exact meaning depends on the endpoint. |
| `data[].trackingId` | string | Script tracking ID. |
| `data[].timezone` | string | Timezone used to interpret dates and group analytics buckets. Defaults to the website timezone. |
| `data[].currency` | string | Currency code for money values, such as `USD` or `EUR`. |
| `data[].kpi` | string\|null | Configured KPI goal or metric. |
| `data[].kpiColorScheme` | string\|null | KPI color scheme. |
| `data[].revenueMetric` | string\|null | Revenue metric preference. |
| `data[].isCookieless` | boolean | Whether cookieless tracking is enabled. |
| `data[].includeRenewalRevenue` | boolean | Whether renewal revenue is included in KPI calculations. |
| `data[].allowedHostnames` | string[] | Allowed hostnames. |
| `data[].excludedIps` | string[] | Excluded IPs. |
| `data[].excludedPaths` | string[] | Excluded paths. |
| `data[].excludedCountries` | string[] | Excluded countries. |
| `data[].excludedHostnames` | string[] | Excluded hostnames. |

### Authentication

Use a `dft_` account token with `settings:write`.

A `df_` website API key for the same website can also call this route when the path `websiteId` matches the key's website. Write access with a `df_` key is capped at **member** level — owner-only actions such as [team management](/docs/api/account/team) require a `dft_` token and owner role.

### Errors

**400** — No valid fields in body or invalid domain.

**403** — Viewer role or website access denied.

See [API errors](/docs/api#errors) for the standard error envelope, auth failures, validation errors, permission errors, and rate limits.

## Code examples

### Example request

```bash
curl -X PUT "https://datafa.st/api/v1/admin/websites/{websiteId}" \
  -H "Authorization: Bearer dft_xxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"New name","timezone":"Europe/Paris","kpi":"signup"}'
```

### Success response

```json
{
  "status": "success",
  "data": [{
    "_id": "665f0b3c4d2e1a0012345678",
    "domain": "example.com",
    "name": "Example",
    "trackingId": "dfid_abc123",
    "timezone": "America/New_York",
    "currency": "USD",
    "kpi": "signup",
    "isCookieless": false,
    "includeRenewalRevenue": true,
    "allowedHostnames": ["example.com"],
    "excludedIps": [],
    "excludedPaths": [],
    "excludedCountries": [],
    "excludedHostnames": []
  }]
}
```
