> ## Documentation Index
> Fetch the complete documentation index at: https://docs.1eye.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Website Pixel

> Retrieve the pixel installation script and manage secondary tracking domains and excluded URLs.

Retrieve your installation script and tracking domains. Add secondary domains, replace their excluded URLs, and remove secondary domains.

## Base URL

```text theme={null}
https://api.1eye.ai/v1/website-pixel
```

## Authentication

All requests require a workspace API key:

```http theme={null}
Authorization: Bearer 1eye_live_xxxxxxxxx
```

The examples use `$API_KEY` for your API key. The key determines the workspace; you do not supply a workspace ID. See [Authentication](https://docs.1eye.ai/api-reference/auth.md).

## Endpoints

| Method | Endpoint | Description |
| - | - | - |
| `GET` | `/v1/website-pixel` | Retrieve the complete configuration. |
| `POST` | `/v1/website-pixel/domains` | Register a secondary domain and optional exclusions. |
| `PATCH` | `/v1/website-pixel/domains/{domain}` | Replace a domain's excluded URLs. |
| `DELETE` | `/v1/website-pixel/domains/{domain}` | Remove a secondary domain. |

## Website Pixel object

```json theme={null}
{
  "client_id": "wor_123456789012345678",
  "status": "installed",
  "script": "<script>\n  (function() {\n    var s = document.createElement(\"script\");\n    s.src = \"https://vision.1eye.ai/pixel.js\";\n    s.setAttribute(\"data-client-id\", \"wor_123456789012345678\");\n    s.defer = true;\n    document.head.appendChild(s);\n  })();\n</script>",
  "domains": [
    {
      "domain": "snowbricks.example",
      "is_primary": true,
      "status": "installed",
      "excluded_urls": [
        "dev.snowbricks.example/"
      ]
    },
    {
      "domain": "snowbricks-demo.example",
      "is_primary": false,
      "status": "not_installed",
      "excluded_urls": [
        "snowbricks-demo.example/internal"
      ]
    }
  ]
}
```

All names, domains, identifiers, amounts, URLs, and timestamps in these examples are illustrative.

| Field | Type | Description |
| - | - | - |
| `client_id` | string | Workspace ID (`wor_`). |
| `status` | string | Overall installation state: `installed` or `not_installed`. |
| `script` | string | Complete workspace-specific installation script. |
| `domains` | array | Every configured domain, including its exclusions. |

### Domain fields

| Field | Type | Description |
| - | - | - |
| `domain` | string | Registered hostname. |
| `is_primary` | boolean | Whether this is the Workspace primary domain. |
| `status` | string | Detected installation state for this domain. |
| `excluded_urls` | string array | URLs excluded from tracking on this domain or its subdomains. |

Installation status is read-only and detected by 1eye. Overall `status` is `installed` when installation is detected on at least one configured domain. Retrieving a script or adding a domain does not establish installation.

If no domains are configured, GET returns `status: not_installed`, the complete script, and `domains: []`.

## 1. Retrieve Website Pixel

`GET /v1/website-pixel`

```bash theme={null}
curl "https://api.1eye.ai/v1/website-pixel" \
  -H "Authorization: Bearer $API_KEY"
```

**200 OK** — returns the complete Website Pixel object above. No query parameters, sorting, or pagination are supported.

Install the returned script using the [Website Pixel guide](https://docs.1eye.ai/get-started/install-website-pixel.md). The script is workspace-specific and cannot be modified through this API.

## 2. Add a secondary domain

`POST /v1/website-pixel/domains`

```bash theme={null}
curl -X POST "https://api.1eye.ai/v1/website-pixel/domains" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "snowbricks-demo.example",
  "excluded_urls": [
    "snowbricks-demo.example/internal"
  ]
}'
```

### Example response

**201 Created** — returns the new domain object directly.

```json theme={null}
{
  "domain": "snowbricks-demo.example",
  "is_primary": false,
  "status": "not_installed",
  "excluded_urls": [
    "snowbricks-demo.example/internal"
  ]
}
```

`domain` is required. `excluded_urls` is optional and defaults to an empty array. Duplicate domains are rejected rather than silently updated. Only `domain` and `excluded_urls` are accepted in POST.

### Domain validation

Send a hostname such as `snowbricks-demo.example` or `app.snowbricks.example`. Do not include a URL scheme, path, query string, fragment, credentials, or wildcard. Hostname case is normalized.

## 3. Replace excluded URLs

`PATCH /v1/website-pixel/domains/{domain}`

```bash theme={null}
curl -X PATCH "https://api.1eye.ai/v1/website-pixel/domains/snowbricks-demo.example" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "excluded_urls": [
    "snowbricks-demo.example/private",
    "app.snowbricks-demo.example/login"
  ]
}'
```

### Example response

**200 OK**

```json theme={null}
{
  "domain": "snowbricks-demo.example",
  "is_primary": false,
  "status": "not_installed",
  "excluded_urls": [
    "snowbricks-demo.example/private",
    "app.snowbricks-demo.example/login"
  ]
}
```

PATCH accepts exactly `excluded_urls`. It replaces the entire array; it does not append or merge entries. Send `{"excluded_urls": []}` to clear all exclusions.

You may update exclusions on the primary domain. Domain names, installation status, `is_primary`, and the script are read-only. PATCH never creates a missing domain.

### Excluded URL validation

Every exclusion must have the selected domain's hostname or a subdomain of it. Supported UI-style values include `snowbricks-demo.example/private` and `app.snowbricks-demo.example/`. Custom wildcard and regular-expression rules are not supported.

A hostname containing the domain only as a substring, such as `snowbricks-demo.example.other.example`, is not a subdomain and is rejected. Equivalent duplicate exclusions and unrelated hostnames are rejected. The entire request is validated before any exclusions are changed.

## 4. Delete a secondary domain

`DELETE /v1/website-pixel/domains/{domain}`

```bash theme={null}
curl -X DELETE "https://api.1eye.ai/v1/website-pixel/domains/snowbricks-demo.example" \
  -H "Authorization: Bearer $API_KEY"
```

**204 No Content** — the body is empty. The domain disappears from subsequent GET responses. A nonexistent or inaccessible domain returns 404.

## Primary domain protection

The Workspace configuration determines the primary domain. This API cannot rename it, replace it, designate another primary domain, or delete it.

Attempting to delete the primary domain returns 400:

```json theme={null}
{
  "error": {
    "code": "invalid_request",
    "message": "The primary domain cannot be deleted.",
    "param": "domain",
    "request_id": "req_123456789012345678"
  }
}
```

Domain configuration changes affect future tracking. They do not delete historical Buyers, Signals, or attribution. Use [Signal Settings](https://docs.1eye.ai/api-reference/signal-settings.md) to configure Website trigger flags and daily Buyer limits.

## Errors

| Status | Error code | Description |
| - | - | - |
| 400 | `invalid_parameter` | A request field or query parameter is invalid. |
| 400 | `invalid_request` | The operation would delete the protected primary domain. |
| 404 | `not_found` | The domain does not exist or is inaccessible. |
| 401 | `authentication_error` | The API key is missing, invalid, or revoked. |
| 403 | `permission_denied` | The key does not have permission for this operation. |
| 429 | `rate_limit_exceeded` | The workspace API rate limit was exceeded. |
| 500 | `internal_error` | An unexpected server error occurred. |
| 503 | `service_unavailable` | The service is temporarily unavailable. |

Errors use the standard [error envelope](https://docs.1eye.ai/api-reference/errors.md). Use `request_id` when contacting support.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.