> 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/mcp/tools/domain-id-graph.md).

# domainIDGraph

Query the per-domain user database (ID Graph) using SQL. The ID Graph stores user information collected from your websites or shops, including PII, cookies, custom data, and channel-specific data.

### Parameters

| Parameter  | Type          | Required | Description                                                                                  |
| ---------- | ------------- | -------- | -------------------------------------------------------------------------------------------- |
| `domainId` | string (UUID) | Yes      | The domain ID (tagId). Get this from the `domains` tool.                                     |
| `teamId`   | string (UUID) | Yes      | The team ID the domain belongs to.                                                           |
| `query`    | string        | Yes      | SQL SELECT query. Must include a timestamp range filter. Limit of 500 rows without GROUP BY. |

### Database schema

The ID Graph has 4 tables:

#### main

Primary user table with PII and consent data.

| Column              | Description                          |
| ------------------- | ------------------------------------ |
| `user_id`           | Primary key - unique user identifier |
| `email`             | User email address                   |
| `phone`             | User phone number                    |
| `firstName`         | First name                           |
| `lastName`          | Last name                            |
| `gender`            | Gender                               |
| `dateOfBirth`       | Date of birth                        |
| `city`              | City                                 |
| `state`             | State/region                         |
| `zip`               | Postal code                          |
| `country`           | Country                              |
| `consent`           | JSON object with consent data        |
| `consentCategories` | JSON object with consent categories  |
| `created_at`        | Record creation timestamp            |
| `updated_at`        | Last update timestamp                |

#### cookie

Browser cookie data linked to users.

| Column         | Description               |
| -------------- | ------------------------- |
| `user_id`      | Foreign key to main table |
| `cookie_key`   | Cookie name               |
| `cookie_value` | Cookie value              |
| `created_at`   | Record creation timestamp |

#### custom

Developer-set custom data.

| Column        | Description               |
| ------------- | ------------------------- |
| `user_id`     | Foreign key to main table |
| `store_key`   | Custom data key           |
| `store_value` | Custom data value         |
| `created_at`  | Record creation timestamp |
| `updated_at`  | Last update timestamp     |

#### provider

Channel-specific data such as UTM parameters.

| Column        | Description                 |
| ------------- | --------------------------- |
| `user_id`     | Foreign key to main table   |
| `provider_id` | Channel/provider identifier |
| `store_key`   | Data key                    |
| `store_value` | Data value                  |
| `created_at`  | Record creation timestamp   |
| `updated_at`  | Last update timestamp       |

### Examples

> "Look up the user with email <john@example.com>"

```sql
SELECT * FROM main WHERE email = 'john@example.com' LIMIT 1
```

> "How many users were created today?"

```sql
SELECT COUNT(*) FROM main WHERE created_at >= strftime('%s', '2026-01-01T00:00:00Z')
```

> "Show me all cookies for a specific user"

```sql
SELECT * FROM cookie WHERE user_id = 'user-id-here'
```

{% hint style="info" %}
ID Graph Querying must be enabled for your domain. Contact <support@blotout.io> if you get an "Action not permitted!" error.
{% endhint %}


---

# 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/mcp/tools/domain-id-graph.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.
