Use this API to manage the hooks that GitLab uses to notify external services about events:

You can also test a hook, inspect its event log, resend an event, and manage its custom headers and URL variables.

Managing project webhooks requires administrator access or the Maintainer or Owner role for the project. Managing group webhooks requires administrator access or the Owner role for the group. Managing system hooks requires administrator access.

List all system hooks

GET /api/v4/hooks

Lists all system hooks for the instance.

Parameters

NameTypeDescription
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesHook
400Bad Request—

Create a system hook

POST /api/v4/hooks

Creates a system hook. This endpoint has a rate limit of five requests per minute for each authenticated user. On GitLab Self-Managed and GitLab Dedicated, an administrator can change this limit in the application settings.

Request body (application/json)

PropertyTypeDescription
branch_filter_strategyStringFilter push events by branch. Defaults to wildcard
Allowed values: wildcard, regex, all_branches
custom_headersArray of objectsCustom headers for the hook
custom_headers[].key
Required
StringName of the header
Example: X-Custom-Header
custom_headers[].value
Required
StringValue of the header
Example: value
custom_webhook_templateStringCustom template for the system hook request payload
descriptionStringDescription of the hook. Introduced in GitLab 17.1
enable_ssl_verificationBooleanIf true, verifies the SSL certificate when the hook is triggered
merge_requests_eventsBooleanIf true, triggers the system hook on merge request events
nameStringName of the hook. Introduced in GitLab 17.1
push_eventsBooleanIf true, triggers the system hook on push events
push_events_branch_filterStringFilter push events by branch name
repository_update_eventsBooleanIf true, triggers the system hook on repository update events
signing_tokenStringHMAC signing token used to compute the webhook-signature header. Must be in whsec_<base64> format encoding a 32-byte key, and is not returned in the response. Introduced in GitLab 19.0
tag_push_eventsBooleanIf true, triggers the system hook on tag push events
tokenStringSecret token used to validate received payloads. Not returned in the response, and changing the hook URL resets it
url
Required
StringWebhook URL
Example: http://example.com/hook
url_variablesArray of objectsURL variables for interpolation
url_variables[].key
Required
StringName of the variable
Example: token
url_variables[].value
Required
StringValue of the variable
Example: 123

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesHook
400Validation error—
404Not found—
422Unprocessable entity—
429Too many requests—

Retrieve a system hook

GET /api/v4/hooks/{hook_id}

Retrieves a specified system hook.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the system hook

Responses

CodeDescriptionSchema
200OKAPIEntitiesHook
400Bad Request—
404Not found—

Create a test run

POST /api/v4/hooks/{hook_id}

Creates a test run for a webhook. Executes the webhook with mock data.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the system hook

Responses

CodeDescriptionSchema
201Created—
400Bad Request—
404Not Found—

Update a system hook

PUT /api/v4/hooks/{hook_id}

Updates a specified system hook.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the system hook

Request body (application/json)

PropertyTypeDescription
branch_filter_strategyStringFilter push events by branch. Defaults to wildcard
Allowed values: wildcard, regex, all_branches
custom_headersArray of objectsCustom headers for the hook
custom_headers[].key
Required
StringName of the header
Example: X-Custom-Header
custom_headers[].value
Required
StringValue of the header
Example: value
custom_webhook_templateStringCustom template for the system hook request payload
descriptionStringDescription of the hook. Introduced in GitLab 17.1
enable_ssl_verificationBooleanIf true, verifies the SSL certificate when the hook is triggered
merge_requests_eventsBooleanIf true, triggers the system hook on merge request events
nameStringName of the hook. Introduced in GitLab 17.1
push_eventsBooleanIf true, triggers the system hook on push events
push_events_branch_filterStringFilter push events by branch name
repository_update_eventsBooleanIf true, triggers the system hook on repository update events
signing_tokenStringHMAC signing token used to compute the webhook-signature header. Must be in whsec_<base64> format encoding a 32-byte key, and is not returned in the response. Introduced in GitLab 19.0
tag_push_eventsBooleanIf true, triggers the system hook on tag push events
tokenStringSecret token used to validate received payloads. Not returned in the response, and changing the hook URL resets it
urlStringWebhook URL
url_variablesArray of objectsURL variables for interpolation
url_variables[].key
Required
StringName of the variable
Example: token
url_variables[].value
Required
StringValue of the variable
Example: 123

Responses

CodeDescriptionSchema
200OKAPIEntitiesHook
400Validation error—
404Not found—
422Unprocessable entity—

Delete a system hook

DELETE /api/v4/hooks/{hook_id}

Deletes a specified system hook. Administrators only.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the system hook

Responses

CodeDescriptionSchema
200OKAPIEntitiesHook
400Bad Request—
404Not found—

Update a custom header

PUT /api/v4/hooks/{hook_id}/custom_headers/{key}

Updates a custom header for a specified webhook. This feature was introduced in GitLab 17.1.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the hook
key
Path, required
StringName of the custom header

Request body (application/json)

PropertyTypeDescription
value
Required
StringValue of the custom header

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
404Not Found—

Delete a custom header

DELETE /api/v4/hooks/{hook_id}/custom_headers/{key}

Deletes a custom header from a specified webhook. This feature was introduced in GitLab 17.1.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the hook
key
Path, required
StringName of the custom header

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
404Not Found—

Update a URL variable

PUT /api/v4/hooks/{hook_id}/url_variables/{key}

Updates a URL variable for a specified webhook. Setting the value does not replace a literal value in the existing webhook URL with the placeholder. To use the variable, also update the webhook URL to include the {key} placeholder.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the hook
key
Path, required
StringKey of the URL variable

Request body (application/json)

PropertyTypeDescription
value
Required
StringValue of the URL variable

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
404Not Found—

Delete a URL variable

DELETE /api/v4/hooks/{hook_id}/url_variables/{key}

Deletes a URL variable from a specified webhook.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the hook
key
Path, required
StringKey of the URL variable

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
404Not Found—

List all webhooks for a project

GET /api/v4/projects/{id}/hooks

Lists all webhooks for a specified project.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesProjectHook
400Bad Request—
404Not Found—

Add a webhook to a project

POST /api/v4/projects/{id}/hooks

Adds a webhook to a specified project. This endpoint has a rate limit of five requests per minute for each authenticated user for a given project. On GitLab Self-Managed and GitLab Dedicated, an administrator can change this limit in the application settings. Setting duo_flow_callback_enabled to false is always accepted.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project

Request body (application/json)

PropertyTypeDescription
branch_filter_strategyStringFilter push events by branch. Defaults to wildcard
Allowed values: wildcard, regex, all_branches
confidential_issues_eventsBooleanIf true, triggers the project webhook on confidential issue events
confidential_note_eventsBooleanIf true, triggers the project webhook on confidential note events
custom_headersArray of objectsCustom headers for the hook
custom_headers[].key
Required
StringName of the header
Example: X-Custom-Header
custom_headers[].value
Required
StringValue of the header
Example: value
custom_webhook_templateStringCustom template for the webhook request payload
deployment_eventsBooleanIf true, triggers the project webhook on deployment events
descriptionStringDescription of the project webhook. Introduced in GitLab 17.1
duo_flow_callback_enabledBooleanIf true, allows Duo Agent Platform flows to send lifecycle and progress events to this project webhook. A flow must reference the webhook’s ID as callback_hook_id when it starts. Introduced in GitLab 19.4 with a feature flag named duo_flow_callback_hooks. Disabled by default
emoji_eventsBooleanIf true, triggers the project webhook on emoji events
enable_ssl_verificationBooleanIf true, verifies the SSL certificate when the webhook is triggered
feature_flag_eventsBooleanIf true, triggers the project webhook on feature flag events
issues_eventsBooleanIf true, triggers the project webhook on issue events
job_eventsBooleanIf true, triggers the project webhook on job events
merge_requests_eventsBooleanIf true, triggers the project webhook on merge request events
milestone_eventsBooleanIf true, triggers the project webhook on milestone events
nameStringName of the project webhook. Introduced in GitLab 17.1
note_eventsBooleanIf true, triggers the project webhook on note events
pipeline_eventsBooleanIf true, triggers the project webhook on pipeline events
push_eventsBooleanIf true, triggers the project webhook on push events
push_events_branch_filterStringFilter push events by branch name
releases_eventsBooleanIf true, triggers the project webhook on release events
resource_access_token_eventsBooleanIf true, triggers the project webhook on project access token expiry events
resource_deploy_token_eventsBooleanIf true, triggers the project webhook on project deploy token expiry events
signing_tokenStringHMAC signing token used to compute the webhook-signature header. Must be in whsec_<base64> format encoding a 32-byte key, and is not returned in the response. Introduced in GitLab 19.0
tag_push_eventsBooleanIf true, triggers the project webhook on tag push events
tokenStringSecret token used to validate received payloads. Not returned in the response, and changing the webhook URL resets it
url
Required
StringWebhook URL
Example: http://example.com/hook
url_variablesArray of objectsURL variables for interpolation
url_variables[].key
Required
StringName of the variable
Example: token
url_variables[].value
Required
StringValue of the variable
Example: 123
vulnerability_eventsBooleanIf true, triggers the project webhook on vulnerability events
wiki_page_eventsBooleanIf true, triggers the project webhook on wiki page events

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesProjectHook
400Validation error—
404Not found—
422Unprocessable entity—
429Too many requests—

Retrieve a project webhook

GET /api/v4/projects/{id}/hooks/{hook_id}

Retrieves a specified webhook for a project.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
hook_id
Path, required
IntegerID of the project webhook

Responses

CodeDescriptionSchema
200OKAPIEntitiesProjectHook
400Bad Request—
404Not found—

Update a project webhook

PUT /api/v4/projects/{id}/hooks/{hook_id}

Updates a specified webhook for a project. Setting duo_flow_callback_enabled to false is always accepted.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
hook_id
Path, required
IntegerID of the project webhook

Request body (application/json)

PropertyTypeDescription
branch_filter_strategyStringFilter push events by branch. Defaults to wildcard
Allowed values: wildcard, regex, all_branches
confidential_issues_eventsBooleanIf true, triggers the project webhook on confidential issue events
confidential_note_eventsBooleanIf true, triggers the project webhook on confidential note events
custom_headersArray of objectsCustom headers for the hook
custom_headers[].key
Required
StringName of the header
Example: X-Custom-Header
custom_headers[].value
Required
StringValue of the header
Example: value
custom_webhook_templateStringCustom template for the webhook request payload
deployment_eventsBooleanIf true, triggers the project webhook on deployment events
descriptionStringDescription of the project webhook. Introduced in GitLab 17.1
duo_flow_callback_enabledBooleanIf true, allows Duo Agent Platform flows to send lifecycle and progress events to this project webhook. A flow must reference the webhook’s ID as callback_hook_id when it starts. Introduced in GitLab 19.4 with a feature flag named duo_flow_callback_hooks. Disabled by default
emoji_eventsBooleanIf true, triggers the project webhook on emoji events
enable_ssl_verificationBooleanIf true, verifies the SSL certificate when the webhook is triggered
feature_flag_eventsBooleanIf true, triggers the project webhook on feature flag events
issues_eventsBooleanIf true, triggers the project webhook on issue events
job_eventsBooleanIf true, triggers the project webhook on job events
merge_requests_eventsBooleanIf true, triggers the project webhook on merge request events
milestone_eventsBooleanIf true, triggers the project webhook on milestone events
nameStringName of the project webhook. Introduced in GitLab 17.1
note_eventsBooleanIf true, triggers the project webhook on note events
pipeline_eventsBooleanIf true, triggers the project webhook on pipeline events
push_eventsBooleanIf true, triggers the project webhook on push events
push_events_branch_filterStringFilter push events by branch name
releases_eventsBooleanIf true, triggers the project webhook on release events
resource_access_token_eventsBooleanIf true, triggers the project webhook on project access token expiry events
resource_deploy_token_eventsBooleanIf true, triggers the project webhook on project deploy token expiry events
signing_tokenStringHMAC signing token used to compute the webhook-signature header. Must be in whsec_<base64> format encoding a 32-byte key, and is not returned in the response. Introduced in GitLab 19.0
tag_push_eventsBooleanIf true, triggers the project webhook on tag push events
tokenStringSecret token used to validate received payloads. Not returned in the response, and changing the webhook URL resets it
urlStringWebhook URL
url_variablesArray of objectsURL variables for interpolation
url_variables[].key
Required
StringName of the variable
Example: token
url_variables[].value
Required
StringValue of the variable
Example: 123
vulnerability_eventsBooleanIf true, triggers the project webhook on vulnerability events
wiki_page_eventsBooleanIf true, triggers the project webhook on wiki page events

Responses

CodeDescriptionSchema
200OKAPIEntitiesProjectHook
400Validation error—
404Not found—
422Unprocessable entity—

Delete a project webhook

DELETE /api/v4/projects/{id}/hooks/{hook_id}

Deletes a specified webhook for a project. If the webhook was already deleted, returns 404 Not found.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
hook_id
Path, required
IntegerID of the project webhook

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
404Not found—

Update a custom header

PUT /api/v4/projects/{id}/hooks/{hook_id}/custom_headers/{key}

Updates a custom header for a specified webhook. This feature was introduced in GitLab 17.1.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the hook
key
Path, required
StringName of the custom header
id
Path, required
String or integerID or URL-encoded path of the project

Request body (application/json)

PropertyTypeDescription
value
Required
StringValue of the custom header

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
404Not Found—

Delete a custom header

DELETE /api/v4/projects/{id}/hooks/{hook_id}/custom_headers/{key}

Deletes a custom header from a specified webhook. This feature was introduced in GitLab 17.1.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the hook
key
Path, required
StringName of the custom header
id
Path, required
String or integerID or URL-encoded path of the project

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
404Not Found—

List all events

GET /api/v4/projects/{id}/hooks/{hook_id}/events

Lists all events from the past seven days for a specified webhook. This feature was introduced in GitLab 17.3.

Parameters

NameTypeDescription
status
Query
Array of stringsResponse status code of the events, for example 200 or 500. You can search by status category: successful (200-299), client_failure (400-499), and server_failure (500-599)
per_page
Query
IntegerNumber of items to list per page
Default: 20
Maximum: 20
Minimum: 1
Example: 20
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
id
Path, required
String or integerID or URL-encoded path of the project
hook_id
Path, required
IntegerID of the hook

Responses

CodeDescriptionSchema
200OK—
400Bad request—
403Forbidden—
404Not found—

Resend a webhook event

POST /api/v4/projects/{id}/hooks/{hook_id}/events/{hook_log_id}/resend

Resends a webhook event. This endpoint has a rate limit of five requests per minute for each authenticated user for a given project or group. All webhooks in the same project or group share the limit. On GitLab Self-Managed and GitLab Dedicated, an administrator can change this limit in the application settings. This feature was introduced in GitLab 17.4.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the hook
hook_log_id
Path, required
IntegerID of the hook log entry
id
Path, required
String or integerID or URL-encoded path of the project

Responses

CodeDescriptionSchema
201Created—
400Bad Request—
404Not found—
422Unprocessable entity—
429Too many requests—

Trigger a test webhook

POST /api/v4/projects/{id}/hooks/{hook_id}/test/{trigger}

Triggers a test webhook. This endpoint has a rate limit of five requests per minute for each authenticated user for a given project or group. On GitLab Self-Managed and GitLab Dedicated, an administrator can change this limit in the application settings. This feature was introduced in GitLab 16.11 for project hooks and GitLab 17.1 for group hooks.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the hook
trigger
Path, required
StringType of webhook event to test
Allowed values: confidential_issues_events, confidential_note_events, deployment_events, emoji_events, feature_flag_events, issues_events, job_events, merge_requests_events, milestone_events, note_events, pipeline_events, push_events, releases_events, resource_access_token_events, resource_deploy_token_events, tag_push_events, wiki_page_events
Minimum length: 1
id
Path, required
String or integerID or URL-encoded path of the project

Responses

CodeDescriptionSchema
201Created—
400Bad request—
403Forbidden—
404Not found—
422Unprocessable entity—
429Too many requests—

Update a URL variable

PUT /api/v4/projects/{id}/hooks/{hook_id}/url_variables/{key}

Updates a URL variable for a specified webhook. Setting the value does not replace a literal value in the existing webhook URL with the placeholder. To use the variable, also update the webhook URL to include the {key} placeholder.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the hook
key
Path, required
StringKey of the URL variable
id
Path, required
String or integerID or URL-encoded path of the project

Request body (application/json)

PropertyTypeDescription
value
Required
StringValue of the URL variable

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
404Not Found—

Delete a URL variable

DELETE /api/v4/projects/{id}/hooks/{hook_id}/url_variables/{key}

Deletes a URL variable from a specified webhook.

Parameters

NameTypeDescription
hook_id
Path, required
IntegerID of the hook
key
Path, required
StringKey of the URL variable
id
Path, required
String or integerID or URL-encoded path of the project

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
404Not Found—

Schemas

Objects returned by the operations above and objects nested in their request bodies.

APIEntitiesHook

PropertyTypeDescription
alert_statusStringExample: executable
branch_filter_strategyStringExample: wildcard
created_atString (date-time)Example: 2012-05-28T04:42:42-07:00
custom_headersArray of objectsExample: [{"X-Custom-Header":"value"}]
custom_webhook_templateStringExample: {"event":"{{object_kind}}"}
descriptionStringDescription of the hook. Introduced in GitLab 17.1
Example: Hook description
disabled_untilString (date-time)Example: 2012-05-28T04:42:42-07:00
enable_ssl_verificationBoolean—
idInteger (int64)Example: 1
merge_requests_eventsBoolean—
nameStringName of the hook. Introduced in GitLab 17.1
Example: Hook name
organization_idIntegerExample: 1
push_eventsBoolean—
push_events_branch_filterStringExample: my-branch-*
repository_update_eventsBoolean—
signing_token_presentBooleanWhether an HMAC signing token is configured. Introduced in GitLab 19.0
Example: false
tag_push_eventsBoolean—
token_presentBooleanWhether a secret token is configured. Introduced in GitLab 19.0
Example: false
urlStringExample: https://webhook.site
url_variablesArray of objectsExample: [{"token":"secr3t"}]

APIEntitiesProjectHook

PropertyTypeDescription
alert_statusStringExample: executable
branch_filter_strategyStringExample: wildcard
confidential_issues_eventsBoolean—
confidential_note_eventsBoolean—
created_atString (date-time)Example: 2012-05-28T04:42:42-07:00
custom_headersArray of objectsExample: [{"X-Custom-Header":"value"}]
custom_webhook_templateStringExample: {"event":"{{object_kind}}"}
deployment_eventsBoolean—
descriptionStringDescription of the hook. Introduced in GitLab 17.1
Example: Hook description
disabled_untilString (date-time)Example: 2012-05-28T04:42:42-07:00
duo_flow_callback_enabledBoolean—
emoji_eventsBoolean—
enable_ssl_verificationBoolean—
feature_flag_eventsBoolean—
idInteger (int64)Example: 1
issues_eventsBoolean—
job_eventsBoolean—
merge_requests_eventsBoolean—
milestone_eventsBoolean—
nameStringName of the hook. Introduced in GitLab 17.1
Example: Hook name
note_eventsBoolean—
organization_idIntegerExample: 1
pipeline_eventsBoolean—
project_idInteger (int64)Example: 1
push_eventsBoolean—
push_events_branch_filterStringExample: my-branch-*
releases_eventsBoolean—
repository_update_eventsBoolean—
resource_access_token_eventsBoolean—
resource_deploy_token_eventsBoolean—
signing_token_presentBooleanWhether an HMAC signing token is configured. Introduced in GitLab 19.0
Example: false
tag_push_eventsBoolean—
token_presentBooleanWhether a secret token is configured. Introduced in GitLab 19.0
Example: false
urlStringExample: https://webhook.site
url_variablesArray of objectsExample: [{"token":"secr3t"}]
vulnerability_eventsBoolean—
wiki_page_eventsBoolean—