Create a hook
const url = 'https://gitea.com/api/v1/orgs/example/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/orgs/example/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”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Name of the organization
Request Body
Section titled “Request Body”CreateHookOption options when create a hook
object
Whether the webhook should be active upon creation
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
The type of the webhook to create
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
The date and time when the webhook was created
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)
The date and time when the webhook was last updated
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"}APINotFound is a not found empty response