---
title: "Create project webhook"
method: POST
path: "/v2/projects/{project_id}/webhooks"
tags: ["webhooks"]
---

# Create project webhook

`POST /v2/projects/{project_id}/webhooks`

## Request

- Base URL: `https://api.hubstaff.com`
- URL: `https://api.hubstaff.com/v2/projects/{project_id}/webhooks`
- Auth: OAuth 2
  - Authorization code: `https://account.hubstaff.com/authorizations/new`
  - Token URL: `https://account.hubstaff.com/access_tokens` scopes: `hubstaff:read`, `hubstaff:write`
- TypeScript: <https://skmtc.dev/hubstaff/apis/hubstaff-v2-api/docs/v2/projects/:project_id/webhooks/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a new webhook subscription for the project. After creation, Hubstaff will send a POST request to your `target_url` with an empty body and an `X-Hook-Secret` header.

Your endpoint must respond with HTTP 200 and echo the same `X-Hook-Secret` header to verify ownership.

Store the secret value - you'll need it to activate the webhook.

## Path parameters

- `project_id` integer, required

## Request body

- PostV2ProjectsProjectIdWebhooks: Create project webhook
  - `events` string[], required: Array of event types to subscribe to. Use ["*"] for all events.
  - `target_url` string, required: The URL that will receive webhook POST requests

## Response `201`

The created webhook

- Webhook: Webhook model
  - `id` string, required: Webhook ID (UUID)
  - `events` string[], required: Subscribed event types, ["*"] for all
  - `target_url` string, required: The URL that receives webhook POST requests
  - `status` 'inactive' | 'pending' | 'active' | 'disabled', required: inactive: verification request not sent yet. pending: the endpoint did not echo X-Hook-Secret; call activate with the secret. active: events are delivered. disabled: verification or delivery failed; delete and recreate the webhook.
  - `created_at` string, required: Creation time in UTC, ISO 8601 without an offset
  - `updated_at` string, required: Last update time in UTC, ISO 8601 without an offset

## Other responses

- `400`: Invalid parameters
- `401`: Unauthorized
- `403`: API access is only for organizations on an active plan
- `404`: Could not find record
- `429`: Rate limit exceeded
- `503`: Webhook service unavailable

---

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