Create a hook
const url = 'https://gitea.com/api/v1/admin/hooks';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"active":false,"authorization_header":"example","branch_filter":"example","config":{"additionalProperty":"example"},"events":["example"],"name":"example","type":"dingtalk"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://gitea.com/api/v1/admin/hooks \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "active": false, "authorization_header": "example", "branch_filter": "example", "config": { "additionalProperty": "example" }, "events": [ "example" ], "name": "example", "type": "dingtalk" }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”CreateHookOption options when create a hook
object
Authorization header to include in webhook requests
Branch filter pattern to determine which branches trigger the webhook
CreateHookOptionConfig has all config options in it required are “content_type” and “url” Required
object
List of events that will trigger this webhook
Optional human-readable name for the webhook
Responses
Section titled “Responses”Hook
Hook a hook is a web hook when one repository changed
object
Whether the webhook is active and will be triggered
Authorization header to include in webhook requests
Branch filter pattern to determine which branches trigger the webhook
Configuration settings for the webhook
object
List of events that trigger this webhook
The unique identifier of the webhook
Optional human-readable name for the webhook
The type of the webhook (e.g., gitea, slack, discord)
Examplegenerated
{ "active": true, "authorization_header": "example", "branch_filter": "example", "config": { "additionalProperty": "example" }, "created_at": "2026-04-15T12:00:00Z", "events": [ "example" ], "id": 1, "name": "example", "type": "example", "updated_at": "2026-04-15T12:00:00Z"}