Skip to main content
Version: 1.25.5

Webhooks

Gitea can send outbound webhooks for repository activity. Repository webhooks are configured at /:username/:reponame/settings/hooks by a repository admin. Equivalent webhook pages also exist for organizations, users, and system administration.

Webhook configuration is available at four scopes:

  • Repository webhooks: Trigger only for activity in one repository.
  • Organization webhooks: Trigger for activity in repositories owned by that organization.
  • User webhooks: Trigger for activity in repositories owned by that user.
  • System webhooks: Trigger for all eligible activity on the instance.

Gitea also supports admin-defined default webhooks. These are not an extra delivery scope. Instead, they are copied into newly created repositories and then behave like ordinary repository webhooks.

Gitea supports these outgoing webhook integrations:

  • Gitea
  • Gogs
  • Slack
  • Discord
  • Dingtalk
  • Telegram
  • Microsoft Teams
  • Feishu
  • Matrix
  • Wechatwork
  • Packagist

The Gitea and Gogs webhook types send generic webhook payloads. The chat and service integrations listed above transform the same internal event into a service-specific request body.

Configuration

This section covers the webhook settings you choose when creating or editing a webhook.

Configuring a webhook

When creating a webhook, the main options are:

  • Target URL: The endpoint that receives the delivery.
  • HTTP Method: Usually POST for generic webhooks.
  • POST Content Type: application/json or application/x-www-form-urlencoded for generic webhooks.
  • Secret: Used to sign the raw request body with HMAC.
  • Authorization Header: Optional custom Authorization header to send with each request.
  • Branch Filter: Optional glob filter for branch and tag related events.
  • Trigger On: Push Events, All Events, or a custom event selection.
  • Active: Whether the webhook is enabled.
note

Older examples may still show a secret field inside the JSON payload. Current Gitea versions do not send the webhook secret in the payload body. Always verify the request by checking the signature headers instead.

Branch filters

The branch filter uses glob syntax compatible with github.com/gobwas/glob.

  • Empty, *, or ** matches everything.
  • A plain branch name such as main matches that branch.
  • Full refs such as refs/tags/v* are also supported.
  • Brace expressions such as {main,release/*} are supported.
  • The filter only applies to events that carry a git ref, such as create, delete, and push.
  • Events without a ref, such as issues or releases, ignore the branch filter.

Examples:

  • main
  • {main,feature/*}
  • {refs/heads/feature/*,refs/tags/release/*}

Authorization header

Gitea can be configured to send a custom Authorization header with each webhook delivery. This is independent from the webhook secret:

  • Use the secret to verify integrity with HMAC.
  • Use the Authorization header when the receiving endpoint requires application-level authentication.

Delivery

This section describes how Gitea sends webhook deliveries and how receivers can identify and verify them.

Delivery behavior

  • Webhooks are delivered asynchronously over HTTP.
  • Generic Gitea and Gogs webhooks support POST and GET; POST is the normal choice.
  • For POST requests, the payload can be sent either as JSON (application/json) or as a form field named payload (application/x-www-form-urlencoded).
  • Provider-specific integrations may use the HTTP method and body format required by that provider.

Delivery headers

Every delivery includes a unique delivery ID and event headers. For GitHub-compatible integrations, Gitea also sends the corresponding GitHub and Gogs header names.

HeaderDescription
X-Gitea-DeliveryUnique delivery UUID for this attempt.
X-Gitea-EventNormalized event name, such as push, issues, or pull_request.
X-Gitea-Event-TypeMore specific event type, such as issue_assign or pull_request_review_comment.
X-Gitea-SignatureHex-encoded HMAC-SHA256 of the raw request body, without a prefix.
X-Gitea-Hook-Installation-Target-TypeWhere the webhook is defined: typically repository, organization, user, or system. Default webhooks are copied into repositories before delivery, so they are typically delivered as repository.
X-Gogs-Delivery, X-Gogs-Event, X-Gogs-Event-Type, X-Gogs-SignatureCompatibility headers with the same values as the Gitea variants.
X-GitHub-Delivery, X-GitHub-Event, X-GitHub-Event-TypeGitHub-style compatibility headers.
X-GitHub-Hook-Installation-Target-TypeGitHub-style compatibility header for the webhook scope.
X-Hub-SignatureGitHub-compatible HMAC-SHA1 header in the form sha1=<digest>.
X-Hub-Signature-256GitHub-compatible HMAC-SHA256 header in the form sha256=<digest>.

If no secret is configured, the signature headers are still present, but their digest values are empty.

Event versus Event-Type

Some Gitea webhook subscriptions are grouped together under one normalized event name. For example, an issue assignment delivery uses the issue event group:

X-Gitea-Event: issues
X-Gitea-Event-Type: issue_assign
X-GitHub-Event: issues
X-GitHub-Event-Type: issue_assign

Use X-Gitea-Event-Type when you need the exact trigger that fired the webhook.

Validating deliveries

Gitea signs the raw request body with your webhook secret. To validate a delivery:

  1. Read the request body exactly as it was received.
  2. Compute the HMAC-SHA256 digest with your webhook secret.
  3. Compare the result with X-Gitea-Signature or with the GitHub-compatible X-Hub-Signature-256 header.
  4. Use a constant-time comparison when possible.

Important details:

  • X-Gitea-Signature contains only the lowercase hexadecimal SHA-256 digest.
  • X-Hub-Signature-256 contains the same digest with a sha256= prefix.
  • X-Hub-Signature is also sent for compatibility and uses SHA-1.
  • The body must be verified before JSON parsing or any other modification.
PHP example

The following example verifies a generic Gitea webhook sent as application/json.

<?php

$secret = '123';

if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
exit('Only POST is allowed');
}

$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_GITEA_SIGNATURE'] ?? '';

if ($payload === false || $signature === '') {
http_response_code(400);
exit('Missing payload or signature');
}

$expected = hash_hmac('sha256', $payload, $secret);

if (!hash_equals($expected, $signature)) {
http_response_code(401);
exit('Invalid signature');
}

$event = $_SERVER['HTTP_X_GITEA_EVENT'] ?? '';
$eventType = $_SERVER['HTTP_X_GITEA_EVENT_TYPE'] ?? '';
$data = json_decode($payload, true);

if (!is_array($data)) {
http_response_code(400);
exit('Invalid JSON payload');
}

http_response_code(204);

Events

This section follows the same event-by-event style used by GitHub's webhook documentation: each event describes when it occurs and what the top-level payload contains.

The event groups match the webhook settings UI: Repository Events, Issue Events, Pull Request Events, and Workflow Events.

Repository Events

  • create, delete, fork, push, wiki, repository, release, package, status

create

This event occurs when a branch or tag is created.

Payload parameters
NameTypeDescription
shastringRequired. The object ID of the created reference.
refstringRequired. The created branch or tag name.
ref_typestringRequired. The reference type, such as branch or tag.
repositoryobjectRequired. The repository where the reference was created.
senderobjectRequired. The user who created the reference.

delete

This event occurs when a branch or tag is deleted.

Payload parameters
NameTypeDescription
refstringRequired. The deleted branch or tag name.
ref_typestringRequired. The reference type, such as branch or tag.
pusher_typestringRequired. The actor type that deleted the ref. Current Gitea payloads use user.
repositoryobjectRequired. The repository where the reference was deleted.
senderobjectRequired. The user who deleted the reference.

fork

This event occurs when a repository is forked.

Payload parameters
NameTypeDescription
forkeeobjectRequired. The newly created fork repository.
repositoryobjectRequired. The original repository that was forked.
senderobjectRequired. The user who created the fork.

push

This event occurs when commits are pushed to a branch or tag.

Payload parameters
NameTypeDescription
refstringRequired. The full pushed ref, such as refs/heads/main.
beforestringRequired. The commit SHA before the push.
afterstringRequired. The commit SHA after the push.
compare_urlstringRequired. URL to compare before and after.
commitsarrayRequired. Commits included in the push.
total_commitsintegerRequired. Number of commits in the push.
head_commitobjectThe most recent commit in the push.
repositoryobjectRequired. The repository that received the push.
pusherobjectRequired. The user who performed the push.
senderobjectRequired. The user who triggered the webhook.

wiki

This event occurs when a wiki page is created, edited, or deleted.

Action type: created, edited, deleted

Payload parameters
NameTypeDescription
actionstringRequired. The wiki page action.
repositoryobjectRequired. The repository that owns the wiki.
senderobjectRequired. The user who changed the wiki page.
pagestringRequired. The wiki page name.
commentstringThe wiki commit message or comment.

repository

This event occurs when a repository is created or deleted.

Action type: created, deleted

Payload parameters
NameTypeDescription
actionstringRequired. The repository action.
repositoryobjectRequired. The repository that was created or deleted.
organizationobjectPresent when the repository belongs to an organization.
senderobjectRequired. The user who performed the action.

release

This event occurs when a release is published, updated, or deleted.

Action type: published, updated, deleted

Payload parameters
NameTypeDescription
actionstringRequired. The release action.
releaseobjectRequired. The release that was acted on.
repositoryobjectRequired. The repository containing the release.
senderobjectRequired. The user who performed the action.

package

This event occurs when a package is created or deleted.

Action type: created, deleted

Payload parameters
NameTypeDescription
actionstringRequired. The package action.
repositoryobjectThe repository associated with the package, when applicable.
packageobjectRequired. The package that was acted on.
organizationobjectPresent when the package owner is an organization.
senderobjectRequired. The user who performed the action.

status

This event occurs when a commit status is created or updated through the API.

Payload parameters
NameTypeDescription
commitobjectThe commit associated with the status.
contextstringRequired. The status context, such as ci/build.
created_atstringRequired. The time the status was created.
descriptionstringStatus description text.
idintegerRequired. The status identifier.
repositoryobjectRequired. The repository containing the commit.
senderobjectRequired. The user who created the status.
shastringRequired. The commit SHA.
statestringRequired. The state, such as pending, success, error, or failure.
target_urlstringTarget URL associated with the status.
updated_atstringThe time the status was last updated.

Unlike most other payloads, this event does not use an action field. The state transition is represented by state.

Issue Events

  • issues, issue_assign, issue_label, issue_milestone, issue_comment

issues

This event occurs when an issue is opened, closed, reopened, edited, or deleted.

Action type: opened, closed, reopened, edited, deleted

Payload parameters
NameTypeDescription
actionstringRequired. The issue action.
numberintegerRequired. The issue number.
changesobjectOptional. Previous values for edited fields or label deltas.
issueobjectRequired. The issue that was acted on.
repositoryobjectRequired. The repository containing the issue.
senderobjectRequired. The user who performed the action.
commit_idstringThe commit SHA associated with the issue action, if applicable.

issue_assign

This event occurs when an issue is assigned or unassigned.

Action type: assigned, unassigned

Payload parameters
NameTypeDescription
actionstringRequired. The assignment action.
numberintegerRequired. The issue number.
changesobjectOptional. Previous values for edited fields or label deltas.
issueobjectRequired. The issue that was acted on.
repositoryobjectRequired. The repository containing the issue.
senderobjectRequired. The user who performed the action.
commit_idstringThe commit SHA associated with the issue action, if applicable.

issue_label

This event occurs when issue labels are updated or cleared.

Action type: label_updated, label_cleared

Payload parameters
NameTypeDescription
actionstringRequired. The label update action.
numberintegerRequired. The issue number.
changesobjectOptional. Previous values for edited fields or label deltas.
issueobjectRequired. The issue that was acted on.
repositoryobjectRequired. The repository containing the issue.
senderobjectRequired. The user who performed the action.
commit_idstringThe commit SHA associated with the issue action, if applicable.

issue_milestone

This event occurs when an issue is milestoned or demilestoned.

Action type: milestoned, demilestoned

Payload parameters
NameTypeDescription
actionstringRequired. The milestone action.
numberintegerRequired. The issue number.
changesobjectOptional. Previous values for edited fields or label deltas.
issueobjectRequired. The issue that was acted on.
repositoryobjectRequired. The repository containing the issue.
senderobjectRequired. The user who performed the action.
commit_idstringThe commit SHA associated with the issue action, if applicable.

issue_comment

This event occurs when a comment on an issue is created, edited, or deleted.

Action type: created, edited, deleted

Payload parameters
NameTypeDescription
actionstringRequired. The comment action.
issueobjectRequired. The issue that the comment belongs to.
pull_requestobjectPresent only when the comment is on a pull request timeline.
commentobjectRequired. The comment that was created, edited, or deleted.
changesobjectOptional. Previous comment body when the action is edited.
repositoryobjectRequired. The repository containing the issue.
senderobjectRequired. The user who performed the action.
is_pullbooleanRequired. Whether the comment is on a pull request timeline.

Pull Request Events

  • pull_request, pull_request_assign, pull_request_label, pull_request_milestone, pull_request_comment, pull_request_review, pull_request_review_approved, pull_request_review_rejected, pull_request_review_comment, pull_request_sync, pull_request_review_request

pull_request

This event occurs when a pull request is opened, closed, reopened, edited, or deleted.

Action type: opened, closed, reopened, edited, deleted

Payload parameters
NameTypeDescription
actionstringRequired. The pull request action.
numberintegerRequired. The pull request number.
changesobjectOptional. Previous values for edited fields or label deltas.
pull_requestobjectRequired. The pull request that was acted on.
requested_reviewerobjectPresent for review request events.
repositoryobjectRequired. The repository containing the pull request.
senderobjectRequired. The user who performed the action.
commit_idstringThe commit SHA associated with the pull request action, if applicable.
reviewobjectPresent for pull request review events.

pull_request_assign

This event occurs when a pull request is assigned or unassigned.

Action type: assigned, unassigned

Payload parameters
NameTypeDescription
actionstringRequired. The assignment action.
numberintegerRequired. The pull request number.
changesobjectOptional. Previous values for edited fields or label deltas.
pull_requestobjectRequired. The pull request that was acted on.
requested_reviewerobjectPresent for review request events.
repositoryobjectRequired. The repository containing the pull request.
senderobjectRequired. The user who performed the action.
commit_idstringThe commit SHA associated with the pull request action, if applicable.
reviewobjectPresent for pull request review events.

pull_request_label

This event occurs when pull request labels are updated or cleared.

Action type: label_updated, label_cleared

Payload parameters
NameTypeDescription
actionstringRequired. The label update action.
numberintegerRequired. The pull request number.
changesobjectOptional. Previous values for edited fields or label deltas.
pull_requestobjectRequired. The pull request that was acted on.
requested_reviewerobjectPresent for review request events.
repositoryobjectRequired. The repository containing the pull request.
senderobjectRequired. The user who performed the action.
commit_idstringThe commit SHA associated with the pull request action, if applicable.
reviewobjectPresent for pull request review events.

pull_request_milestone

This event occurs when a pull request is milestoned or demilestoned.

Action type: milestoned, demilestoned

Payload parameters
NameTypeDescription
actionstringRequired. The milestone action.
numberintegerRequired. The pull request number.
changesobjectOptional. Previous values for edited fields or label deltas.
pull_requestobjectRequired. The pull request that was acted on.
requested_reviewerobjectPresent for review request events.
repositoryobjectRequired. The repository containing the pull request.
senderobjectRequired. The user who performed the action.
commit_idstringThe commit SHA associated with the pull request action, if applicable.
reviewobjectPresent for pull request review events.

pull_request_comment

This event occurs when a timeline comment on a pull request is created, edited, or deleted.

Action type: created, edited, deleted

Payload parameters
NameTypeDescription
actionstringRequired. The comment action.
issueobjectRequired. The related issue record for the pull request.
pull_requestobjectRequired. The pull request the timeline comment belongs to.
commentobjectRequired. The comment that was created, edited, or deleted.
changesobjectOptional. Previous comment body when the action is edited.
repositoryobjectRequired. The repository containing the pull request.
senderobjectRequired. The user who performed the action.
is_pullbooleanRequired. Always true for this event.

pull_request_review

This is a subscription-only umbrella event in the webhook settings UI.

It does not have its own delivery payload. When selected, Gitea delivers the more specific events pull_request_review_approved, pull_request_review_rejected, and pull_request_review_comment.

pull_request_review_approved

This event occurs when a pull request review is submitted with approval.

Action type: reviewed

Payload parameters
NameTypeDescription
actionstringRequired. Always reviewed.
numberintegerRequired. The pull request number.
changesobjectOptional. Previous values for edited fields or label deltas.
pull_requestobjectRequired. The pull request that was reviewed.
requested_reviewerobjectPresent for review request events.
repositoryobjectRequired. The repository containing the pull request.
senderobjectRequired. The user who submitted the review.
commit_idstringThe commit SHA associated with the review event, if applicable.
reviewobjectRequired. The review payload. For this event, review.type is approved.

pull_request_review_rejected

This event occurs when a pull request review is submitted with a rejection or a request for changes.

Action type: reviewed

Payload parameters
NameTypeDescription
actionstringRequired. Always reviewed.
numberintegerRequired. The pull request number.
changesobjectOptional. Previous values for edited fields or label deltas.
pull_requestobjectRequired. The pull request that was reviewed.
requested_reviewerobjectPresent for review request events.
repositoryobjectRequired. The repository containing the pull request.
senderobjectRequired. The user who submitted the review.
commit_idstringThe commit SHA associated with the review event, if applicable.
reviewobjectRequired. The review payload. For this event, review.type is rejected.

pull_request_review_comment

This event occurs when a pull request review is submitted as a comment.

Action type: reviewed

Payload parameters
NameTypeDescription
actionstringRequired. Always reviewed.
numberintegerRequired. The pull request number.
changesobjectOptional. Previous values for edited fields or label deltas.
pull_requestobjectRequired. The pull request that was reviewed.
requested_reviewerobjectPresent for review request events.
repositoryobjectRequired. The repository containing the pull request.
senderobjectRequired. The user who submitted the review.
commit_idstringThe commit SHA associated with the review event, if applicable.
reviewobjectRequired. The review payload. For this event, review.type is comment.

pull_request_sync

This event occurs when a pull request is synchronized after new commits are pushed.

Action type: synchronized

Payload parameters
NameTypeDescription
actionstringRequired. Always synchronized.
numberintegerRequired. The pull request number.
changesobjectOptional. Previous values for edited fields or label deltas.
pull_requestobjectRequired. The pull request that was synchronized.
requested_reviewerobjectPresent for review request events.
repositoryobjectRequired. The repository containing the pull request.
senderobjectRequired. The user who performed the synchronization.
commit_idstringThe commit SHA associated with the synchronization event, if applicable.
reviewobjectPresent for pull request review events.

pull_request_review_request

This event occurs when a reviewer is requested or a review request is removed.

Action type: review_requested, review_request_removed

Payload parameters
NameTypeDescription
actionstringRequired. The review request action.
numberintegerRequired. The pull request number.
changesobjectOptional. Previous values for edited fields or label deltas.
pull_requestobjectRequired. The pull request that was acted on.
requested_reviewerobjectThe reviewer that was requested or removed.
repositoryobjectRequired. The repository containing the pull request.
senderobjectRequired. The user who performed the action.
commit_idstringThe commit SHA associated with the pull request action, if applicable.
reviewobjectPresent for pull request review events.

Workflow Events

  • workflow_run, workflow_job

workflow_run

This event occurs when a Gitea Actions workflow run changes status.

Action type: queued, waiting, in_progress, completed

Payload parameters
NameTypeDescription
actionstringRequired. The workflow run status transition.
workflowobjectRequired. The workflow definition.
workflow_runobjectRequired. The workflow run that was acted on.
pull_requestobjectPresent when the workflow run is associated with a pull request.
organizationobjectPresent when the repository owner is an organization.
repositoryobjectRequired. The repository containing the workflow.
senderobjectRequired. The user who triggered the workflow run update.

workflow_job

This event occurs when a Gitea Actions workflow job changes status.

Action type: queued, waiting, in_progress, completed

Payload parameters
NameTypeDescription
actionstringRequired. The workflow job status transition.
workflow_jobobjectRequired. The workflow job that was acted on.
pull_requestobjectPresent when the workflow job is associated with a pull request.
organizationobjectPresent when the repository owner is an organization.
repositoryobjectRequired. The repository containing the workflow job.
senderobjectRequired. The user who triggered the workflow job update.

Testing, recent deliveries, and replay

Each webhook page includes:

  • Test Delivery, which sends a synthetic push event for the repository.
  • Recent Deliveries, which shows request and response details.
  • Redelivery, which replays an earlier webhook delivery.

If the repository has no commits yet, the test delivery uses a generated fake commit so the webhook can still be exercised.

Administration notes

Administrators can further control webhook delivery with instance settings such as host allow lists, delivery timeouts, and cleanup policies. See the Webhook section of the configuration cheat sheet.