Create Hook

Creates a new webhook that listens for specific events. Supports optional association with a chat or project.

POST /hooks
import { v0 } from 'v0-sdk'

const result = await v0.hooks.create({
  name: 'My Hook',
  events: ['chat.created', 'message.created'],
  url: 'https://example.com',
})

console.log(result)
POST /hooks
curl -X POST https://api.v0.dev/hooks \
  -H "Authorization: Bearer $V0_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Hook",
    "events": ["chat.created", "message.created"],
    "url": "https://example.com"
  }'

Parameters

Request Body

name string Required

A human-readable name for the hook.


events string[] Required

List of event types the hook should subscribe to.

Array items: enum


chatId string

The ID of a chat to scope the hook to.


projectId string

The ID of a project to scope the hook to.


url string Required

The target URL to receive the webhook payloads.


Response

Response Body

id string Required

A unique identifier for the webhook.


object string Required

Fixed value identifying this object as a webhook.


name string Required

A user-defined name to label the webhook.


events string[] Required

List of event types this webhook is subscribed to.

Array items: enum


chatId string

Optional ID of the chat that this webhook is scoped to.


projectId string

Optional ID of the project that this webhook is scoped to.


url string Required

Target URL that receives event payloads for this webhook.