---
id: guides-send-clerk-webhooks-to-tinybird
title: Send Clerk webhooks to Tinybird
meta:
    description: In this guide you'll learn how to send data from Clerk to Tinybird.
---

# Send Clerk webhooks to Tinybird

[Clerk](https://clerk.com/) is a developer-focused user management platform to handle user authentication with many prebuilt UI components. By integrating Clerk with Tinybird, you can analyze your user authentication data in real time and enrich it with other data sources.

Some common use cases for sending Clerk webhooks to Tinybird include:

1. Tracking net user and organization growth.
2. Monitoring user churn.
3. Identifying common auth errors.
4. Creating custom dashboards for auth analysis.
5. Enriching other data sources with real-time auth metrics.

Read on to learn how to send data from Clerk to Tinybird.

## Before you start

Before you connect Clerk to Tinybird, ensure:

* You have a Clerk account.
* You have a Tinybird workspace.

## Connect Clerk to Tinybird

1. From the Clerk UI, select **Configure** > **Webhooks**.
   
2. Select **Add Endpoint**.

3. In your Tinybird project, create a data source called `clerk`. You can follow this [schema](https://github.com/tinybirdco/tinynest/blob/main/tinybird/datasources/clerk.datasource):

```tb {% title = 'Data Source schema for Clerk events %}
SCHEMA >
    `event_time` DateTime64(3) `json:$.tinybirdIngestTime` DEFAULT now(),
    `event_type` String `json:$.type` DEFAULT 'unknown',
    `event` JSON `json:$` DEFAULT '{}'

ENGINE "MergeTree"
ENGINE_PARTITION_KEY "toYYYYMM(event_time)"
ENGINE_SORTING_KEY "event_time"
```

Using the [JSON Data Type](/sql-reference/data-types/json) you can store the semi-structured data you receive from Clerk in a single column. You can later retrieve various events and their metadata as needed in your pipes.

{% callout type="caution" %}
The `JSON` data type is in private beta. If you are interested in using this type, contact Tinybird at <support@tinybird.co> or in the [Community Slack](/community).
{% /callout %}

4. Back in Clerk, paste the Events API URL in your Webhook Endpoint URL. Use the query parameter `name` to match the name of the data source you created in Tinybird, for example: 

```
{% user("apiHost") %}/v0/events?name=clerk
```

{% snippet title="api-region-reminder" /%}

5. From Tinybird Cloud, copy a token with privileges to write to the data source you created. You can use the admin token or create one with the required scope.

6. Return to the Clerk Webhooks page, and update the URL to add a new search parameter `token` with the token you copied. The final URL looks like the following:

```
{% user("apiHost") %}/v0/events?name=clerk&token=p.eyXXXXX
```

7. Select the checkboxes for the Clerk events you want to send to Tinybird, and select **Create**.

8. You're done. Any of the Clerk events you selected is automatically sent to Tinybird through the [Events API](../events-api). You can test the integration from the **Testing** tab in the Clerk Webhooks UI. 
