---
title: "Create Webhook"
method: POST
path: "/api_v2/webhooks.json"
tags: ["Webhooks"]
---

# Create Webhook

`POST /api_v2/webhooks.json`

## Request

- Base URL: `https://www.bugherd.com`
- URL: `https://www.bugherd.com/api_v2/webhooks.json`
- Auth: HTTP basic

Creates a new webhook subscription. When the specified event occurs, BugHerd sends a POST request to your `target_url` with the relevant payload.

**Supported events:** `project_create`, `task_create`, `task_update`, `comment`, `task_destroy`. Create separate webhook entries for each event type you want to monitor.

**Project scope:** Omit `project_id` to receive events for all projects.

**Auto-removal:** A `410 Gone` response from your target URL will cause BugHerd to automatically remove the webhook.

## Request body

- object
  - `target_url` string, uri, required: The endpoint that will receive the webhook POST
  - `event` 'project_create' | 'task_create' | 'task_update' | 'comment' | 'task_destroy', required
  - `project_id` integer: Scope the webhook to a specific project. Omit for all projects.

## Response `201`

Created webhook

- object
  - `webhook` Webhook
    - `id` integer
    - `target_url` string, uri
    - `event` 'project_create' | 'task_create' | 'task_update' | 'comment' | 'task_destroy'
    - `project_id` integer, nullable: If null, the webhook fires for all projects
    - `project_name` string, nullable
    - `success_count` integer
    - `error_count` integer, nullable
    - `last_error_code` integer, nullable
    - `last_error_at` string, date-time, nullable
    - `first_error_at` string, date-time, nullable
    - `first_success_at` string, date-time, nullable
    - `last_success_at` string, date-time, nullable

---

[API](https://skmtc.dev/bugherd/apis/bugherd-api-v2.md) · [All operations](https://skmtc.dev/bugherd/apis/bugherd-api-v2/llms.txt) · [OpenAPI document](https://skmtc.dev/bugherd/apis/bugherd-api-v2/revisions/bf473cda70d4?raw)
