---
title: "Create a hook"
method: POST
path: "/repos/{owner}/{repo}/hooks"
tags: ["Webhooks"]
---

# Create a hook

`POST /repos/{owner}/{repo}/hooks`

## Path parameters

- `owner` string, required
- `repo` string, required

## Request body

- object
  - `type` 'gogs' | 'slack' | 'discord' | 'dingtalk', required
  - `config` object, required
    - `url` string, required
    - `content_type` 'json' | 'form', required
    - `secret` string
  - `events` string[]
  - `active` boolean

## Response `201`

Created

- Hook
  - `id` integer
  - `type` 'gogs' | 'slack' | 'discord' | 'dingtalk'
  - `events` string[]
  - `active` boolean
  - `config` object
  - `created_at` string, date-time
  - `updated_at` string, date-time

## Other responses

- `404` — Resource not found.
- `422` — Validation error.

---

[API](https://skmtc.net/gogs/apis/gogs-api.md) · [All operations](https://skmtc.net/gogs/apis/gogs-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gogs/gogs-api/revisions/87e2da32266c/schema)
