---
title: Create Webhook
description: Creates a new webhook that listens for specific events. Supports optional association with a chat.
product: Platform API
type: reference
prerequisites:
  - /docs/api/platform/quickstart
---

# Create Webhook



<EndpointDisplay method="post" path="/hooks" versionPrefix="/v2" />

## Usage [#usage]

<CustomCodeBlock languages="['TypeScript', 'cURL']" defaultLanguage="TypeScript">
  <CodeVariant
    language="TypeScript"
    title="TypeScript Example"
    code="`import { v0 } from 'v0-sdk'

const result = await v0.webhooks.create({
  name: 'My Project',
  events: 'example',
  url: 'https://example.com',
  chatId: 'chat_abc123',
})

console.log(result)`"
  />

  <CodeVariant
    language="cURL"
    title="cURL Example"
    code="`curl -X POST &#x22;https://api.v0.dev/api/v2/hooks&#x22; \
  -H &#x22;Authorization: Bearer $V0_API_KEY&#x22; \
  -H &#x22;Content-Type: application/json&#x22; \
  -d '{&#x22;name&#x22;:&#x22;My Project&#x22;,&#x22;events&#x22;:&#x22;example&#x22;,&#x22;url&#x22;:&#x22;https://example.com&#x22;,&#x22;chatId&#x22;:&#x22;chat_abc123&#x22;}'`"
  />
</CustomCodeBlock>

## API Signature [#api-signature]

### Request [#request]

#### Request Body [#request-body]

<APISignature
  parameters="[
  {
    &#x22;name&#x22;: &#x22;name&#x22;,
    &#x22;type&#x22;: &#x22;string&#x22;,
    &#x22;required&#x22;: true,
    &#x22;description&#x22;: &#x22;A human-readable name for the webhook.&#x22;,
    &#x22;deprecated&#x22;: false
  },
  {
    &#x22;name&#x22;: &#x22;events&#x22;,
    &#x22;type&#x22;: &#x22;('chat.created' | 'chat.updated' | 'chat.deleted' | 'message.created' | 'message.updated' | 'message.deleted' | 'message.finished')[]&#x22;,
    &#x22;required&#x22;: true,
    &#x22;description&#x22;: &#x22;List of event types the webhook should subscribe to.&#x22;,
    &#x22;deprecated&#x22;: false
  },
  {
    &#x22;name&#x22;: &#x22;url&#x22;,
    &#x22;type&#x22;: &#x22;string&#x22;,
    &#x22;required&#x22;: true,
    &#x22;description&#x22;: &#x22;The target URL to receive the webhook payloads.&#x22;,
    &#x22;deprecated&#x22;: false
  },
  {
    &#x22;name&#x22;: &#x22;chatId&#x22;,
    &#x22;type&#x22;: &#x22;string | null&#x22;,
    &#x22;required&#x22;: true,
    &#x22;description&#x22;: &#x22;The ID of a chat to scope the webhook to.&#x22;,
    &#x22;deprecated&#x22;: false
  }
]"
/>

### Response [#response]

<APISignature
  parameters="[
  {
    &#x22;name&#x22;: &#x22;id&#x22;,
    &#x22;type&#x22;: &#x22;string&#x22;,
    &#x22;required&#x22;: true,
    &#x22;description&#x22;: &#x22;A unique identifier for the webhook.&#x22;,
    &#x22;deprecated&#x22;: false
  },
  {
    &#x22;name&#x22;: &#x22;createdAt&#x22;,
    &#x22;type&#x22;: &#x22;string&#x22;,
    &#x22;required&#x22;: true,
    &#x22;description&#x22;: &#x22;The ISO timestamp representing when the chat was created.&#x22;,
    &#x22;deprecated&#x22;: false
  },
  {
    &#x22;name&#x22;: &#x22;name&#x22;,
    &#x22;type&#x22;: &#x22;string&#x22;,
    &#x22;required&#x22;: true,
    &#x22;description&#x22;: &#x22;A user-defined name to label the webhook.&#x22;,
    &#x22;deprecated&#x22;: false
  },
  {
    &#x22;name&#x22;: &#x22;events&#x22;,
    &#x22;type&#x22;: &#x22;('chat.created' | 'chat.updated' | 'chat.deleted' | 'message.created' | 'message.updated' | 'message.deleted' | 'message.finished')[]&#x22;,
    &#x22;required&#x22;: true,
    &#x22;description&#x22;: &#x22;List of event types this webhook is subscribed to.&#x22;,
    &#x22;deprecated&#x22;: false
  },
  {
    &#x22;name&#x22;: &#x22;url&#x22;,
    &#x22;type&#x22;: &#x22;string&#x22;,
    &#x22;required&#x22;: true,
    &#x22;description&#x22;: &#x22;Target URL that receives event payloads for this webhook.&#x22;,
    &#x22;deprecated&#x22;: false
  },
  {
    &#x22;name&#x22;: &#x22;chatId&#x22;,
    &#x22;type&#x22;: &#x22;string | null&#x22;,
    &#x22;required&#x22;: true,
    &#x22;description&#x22;: &#x22;Optional ID of the chat that this webhook is scoped to.&#x22;,
    &#x22;deprecated&#x22;: false
  }
]"
/>
