---
title: Sanity
description: Gain insights into content and project-related activities from Sanity.
breadcrumbs: Docs > Integrations > Sanity
---

# Sanity
Integration version1.0.0   Sanity - Activity Overview 1Sanity - Activity Overview 2Sanity - Activity Overview 3
## Overview{% #overview %}

[Sanity](https://www.sanity.io/) is a headless content management system (CMS) designed for building flexible, real-time websites and applications. It enables developers and content teams to efficiently manage structured content across multiple platforms.

Integrate Sanity with Datadog to gain insights into content and project-related activity logs through the Sanity API and GROQ-powered Webhook. Pre-built dashboard visualizations provide immediate insights into Sanity activity logs.

## Setup{% #setup %}

### Generate API Token in Sanity{% #generate-api-token-in-sanity %}

1. Log in to your [Sanity account](https://www.sanity.io/login) as an Administrator. You are automatically redirected to the [manage page](https://www.sanity.io/manage).
1. Select your project.
1. In the navigation panel, click **API**.
1. In the left sidebar, select **Tokens**.
1. Click **Add API Token**.
1. Enter a name and set the permission to **Viewer**.
1. Click **Save** to copy a newly generated token.

### Connect your Sanity account to Datadog{% #connect-your-sanity-account-to-datadog %}

1. Add your Sanity API Token\

| Parameters | Description                       |
| ---------- | --------------------------------- |
| API Token  | API Token of your Sanity project. |

1. Click the **Save** button to save your settings.

**Note**: These steps enable collection of project activity logs.

### Retrieve the Datadog Webhook URL{% #retrieve-the-datadog-webhook-url %}

1. Select an existing API key or create a new one by clicking one of the buttons below:

**Note**: To set up the webhook, please follow the instructions provided in the Manual Webhook Configuration. Alternatively, you can use the Share Webhook Configurations option to apply a pre-configured setup.

### Manual Webhook Configuration{% #manual-webhook-configuration %}

1. Log in to your [Sanity account](https://www.sanity.io/login) as an Administrator. You are automatically redirected to the [manage page](https://www.sanity.io/manage).
1. Select your project.
1. In the navigation panel, click **API**.
1. Click **Create Webhook**.
1. Add the name and use the Datadog webhook URL.
1. Select Dataset as `* (all datasets)`.
1. Under the **Trigger on** section, select the types of Document events you want to send to Datadog.
1. Under the **Projection** section, paste the below JSON:
   ```
     { 
       "documentId": _id, 
       "documentType": _type, 
       "projectId": sanity::projectId(),
       "datasetName": sanity::dataset(),
       "action": "document." + delta::operation(),
       "beforeValues": before(),
       "afterValues": after(),
       "timestamp": now()
     }
   ```
**Note**: It is recommended to ***uncheck*** the **Trigger webhook when drafts are modified** checkbox in the Drafts section.
1. Ensure **POST** is selected under **HTTP method** in the **Advanced settings section**.
1. Click **Save**.

### Share Webhook Configuration{% #share-webhook-configuration %}

**Note**: These are alternative steps for **Manual Webhook Configuration**. Follow only one set of instructions.

1. Log in to your [Sanity account](https://www.sanity.io/login) as an Administrator.
1. To configure the webhook automatically, please follow the [Sanity webhook configuration](https://www.sanity.io/manage/webhooks/share?name=sanity-datadog&description=&url=https%3A%2F%2Fhttp-intake.logs.datadoghq.com%2Fapi%2Fv2%2Flogs%3Fdd-api-key%3D%3CYourDatadogAPIKey%3E%26ddsource%3Dsanity%26service%3Dactivity-logs&on=create&on=update&on=delete&filter=&projection=%7B%0A%20%20%20%20%22documentId%22%3A%20_id%2C%20%0A%20%20%20%20%22documentType%22%3A%20_type%2C%20%0A%20%20%20%20%22projectId%22%3A%20sanity%3A%3AprojectId%28%29%2C%0A%20%20%20%20%22datasetName%22%3A%20sanity%3A%3Adataset%28%29%2C%0A%20%20%20%20%22action%22%3A%20%22document.%22%20%2B%20delta%3A%3Aoperation%28%29%2C%0A%20%20%20%20%22beforeValues%22%3A%20before%28%29%2C%0A%20%20%20%20%22afterValues%22%3A%20after%28%29%2C%0A%20%20%20%20%22timestamp%22%3A%20now%28%29%0A%7D&httpMethod=POST&apiVersion=v2025-02-19&includeDrafts=&includeAllVersions=&headers=%7B%7D).
1. Update the existing URL with the Datadog webhook URL.
1. Click **Apply webhook**.
1. In the configuration dialog, set the following parameters:
   - **Organization**: Select the organization from the dropdown list.
   - **Project**: Select the relevant project from the dropdown list.
   - **Dataset**: Select `* (all datasets)`.
1. Click **Create webhook**.

**Note**: These steps enable collection of document changes along with task and comment activity logs.

## Data Collected{% #data-collected %}

### Logs{% #logs %}

The Sanity integration collects and forwards Sanity activity logs to Datadog.

### Metrics{% #metrics %}

The Sanity integration does not include any metrics.

### Events{% #events %}

The Sanity integration does not include any events.

## Support{% #support %}

For further assistance, contact [Datadog Support](https://docs.datadoghq.com/help/).
