---
title: "Subscribe an https endpoint to events"
method: POST
path: "/api/v1/projects/{projectId}/webhooks"
tags: ["Webhooks"]
---

# Subscribe an https endpoint to events

`POST /api/v1/projects/{projectId}/webhooks`

## Request

- Base URL: `https://otprun.com`
- URL: `https://otprun.com/api/v1/projects/{projectId}/webhooks`
- Auth: HTTP bearer

## Path parameters

- `projectId` integer, required

## Request body

- CreateInputBody4
  - `enabled` boolean: Defaults to true
  - `events` string[], nullable, required
  - `url` string, required: https endpoint that receives POST requests

## Response `201`

Created

- WebhookBody
  - `created_at` string, date-time, required
  - `enabled` boolean, required
  - `events` string[], nullable, required
  - `id` string, uuid, required
  - `project_id` integer, required
  - `secret` string, required: HMAC key for X-OTPRun-Signature, empty for viewers
  - `updated_at` string, date-time, required
  - `url` string, required

## Other responses

- `403`: Forbidden
- `404`: Not Found
- `422`: Unprocessable Entity
- `500`: Internal Server Error

---

[API](https://skmtc.dev/otprun/apis/otp-run-api.md) · [All operations](https://skmtc.dev/otprun/apis/otp-run-api/llms.txt) · [OpenAPI document](https://skmtc.dev/otprun/apis/otp-run-api/revisions/43d40d5f4050?raw)
