> For the complete documentation index, see [llms.txt](https://docs.edgetag.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.edgetag.io/api/getting-started/implementation/website.md).

# Website

In our APIs, we are referencing a website as a [Tag](/api/api/tag.md). Creating a tag is the most essential step, as it serves as the foundation for all subsequent calls. When you create a tag, we will return `tagId` and `domain` back to you. The domain is a subdomain that we generated for this tag, a first-party subdomain. This `tagId` is an identifier that you will need to save on your end, as it will be required for all subsequent calls related to this specific website.

#### My own Cloudflare account

If you would like to host websites in your own Cloudflare account, make sure that you first add a [Host](/api/api/host.md#post-host) (make sure that you save `hostId` as you will need it in this step). After that, you will need to set `managed` to  `false` and set `hostId` to the ID that you received from the host POST call.

Before adding a host, ensure that Cloudflare is set up according to our recommendations.

[Tag](/api/api/tag.md#post-tag)

{% tabs %}
{% tab title="JavaScript" %}

```javascript
fetch('https://api-sandbox.edgetag.io/tag', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your-token',
    'Team-Id': '{your-team-id}'
  },
  body: JSON.stringify({
    name: 'Domain',
    rootDomain: 'domain.com',
    debug: false,
    sameSite: 'Lax',
    managed: false,
    hostId: '{your-host-id}',
    teamId: '{your-team-id}',
    cookieMapKey: '_shopify_y',
    platform: "SHOPIFY"
  })
})
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl --request POST \
  --url https://api-sandbox.edgetag.io/tag \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {your-token}' \
  --header 'Content-Type: application/json' \
  --header 'Team-Id: {your-team-id}' \
  --data '{
	"name": "Domain",
	"rootDomain": "domain.com",
	"debug": false,
	"sameSite": "Lax",
	"managed": false,
	"hostId": "{your-host-id}",
	"teamId": "{your-team-id}",
	"cookieMapKey": "_shopify_y",
	"platform": "SHOPIFY"
}'
```

{% endtab %}
{% endtabs %}

#### Managed account

A managed account in our Cloudflare infrastructure can be easily defined with `managed` the flag set to `true`  and an empty string for `hostId`. For each website, we create a dedicated bubble in Cloudflare, ensuring that all data is processed and stored separately. Infrastructure was designed with privacy in mind.

[Tag](/api/api/tag.md#post-tag)

{% tabs %}
{% tab title="JavaScript" %}

```javascript
fetch('https://api-sandbox.edgetag.io/tag', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your-token',
    'Team-Id': '{your-team-id}'
  },
  body: JSON.stringify({
    name: 'Domain',
    rootDomain: 'domain.com',
    debug: false,
    sameSite: 'Lax',
    managed: true,
    hostId: '',
    teamId: '{your-team-id}',
    cookieMapKey: '_shopify_y',
    platform: "SHOPIFY"
  })
})
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl --request POST \
  --url https://api-sandbox.edgetag.io/tag \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {your-token}' \
  --header 'Content-Type: application/json' \
  --header 'Team-Id: {your-team-id}' \
  --data '{
	"name": "Domain",
	"rootDomain": "domain.com",
	"debug": false,
	"sameSite": "Lax",
	"managed": true,
	"hostId": "",
	"teamId": "{your-team-id}",
	"cookieMapKey": "_shopify_y",
	"platform": "SHOPIFY"
}'
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.edgetag.io/api/getting-started/implementation/website.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
