Webhooks allow the Gemini API to push real-time notifications to your server when asynchronous or Long-Running Operations (LROs) complete. This replaces the need to poll the API for status updates, reducing latency and overhead.
CreateWebhook
Creates a new Webhook.
Request body
The request body contains data with the following structure:
Optional. The user-provided name of the webhook.
Required. The events that the webhook is subscribed to. Available events: - batch.succeeded - batch.expired - batch.failed - interaction.requires_action - interaction.completed - interaction.failed - video.generated
Possible values:
-
batch.succeededBatch processing finished successfully.
-
batch.expiredBatch has not been processed within the 48h timeframe.
-
batch.failedBatch job failed.
-
interaction.requires_actionInteraction requires action (e.g., function calling).
-
interaction.completedInteraction completed successfully.
-
interaction.failedInteraction failed.
-
video.generatedVideo generation completed.
Required. The URI to which webhook events will be sent.
Response
If successful, the response body contains data with the following structure:
Output only. The timestamp when the webhook was created.
Output only. The ID of the webhook.
Optional. The user-provided name of the webhook.
Output only. The new signing secret for the webhook. Only populated on create.
signing_secrets SigningSecret (optional)
Output only. The signing secrets associated with this webhook.
Fields
Output only. The expiration date of the signing secret.
Output only. The truncated version of the signing secret.
Output only. The state of the webhook.
Possible values:
-
enabledThe webhook is enabled.
-
disabledThe webhook is disabled by the user.
-
disabled_due_to_failed_deliveriesThe webhook is disabled due to failed deliveries.
Required. The events that the webhook is subscribed to. Available events: - batch.succeeded - batch.expired - batch.failed - interaction.requires_action - interaction.completed - interaction.failed - video.generated
Possible values:
-
batch.succeededBatch processing finished successfully.
-
batch.expiredBatch has not been processed within the 48h timeframe.
-
batch.failedBatch job failed.
-
interaction.requires_actionInteraction requires action (e.g., function calling).
-
interaction.completedInteraction completed successfully.
-
interaction.failedInteraction failed.
-
video.generatedVideo generation completed.
Output only. The timestamp when the webhook was last updated.
Required. The URI to which webhook events will be sent.
Example
Example Response
{ "create_time": "string", "id": "string", "name": "string", "new_signing_secret": "string", "signing_secrets": [ { "expire_time": "string", "truncated_secret": "string" } ], "state": "enabled", "subscribed_events": [ "batch.succeeded" ], "update_time": "string", "uri": "string" }
PingWebhook
Sends a ping event to a Webhook.
Path / Query Parameters
Required. The ID of the webhook to ping. Format: `{webhook_id}`
Request body
The request body contains data with the following structure:
Response
If successful, the response is empty.
Example
RotateSigningSecret
Generates a new signing secret for a Webhook.
Path / Query Parameters
Required. The ID of the webhook for which to generate a signing secret. Format: `{webhook_id}`
Request body
The request body contains data with the following structure:
Optional. The revocation behavior for previous signing secrets.
Possible values:
-
revoke_previous_secrets_after_h24Generate a new signing secret and revoke all previous secrets after 24 hours. Default and safest option for migrations.
-
revoke_previous_secrets_immediatelyRevoke all previous secrets immediately. Use with caution as this can interrupt ongoing notifications.
Response
If successful, the response body contains data with the following structure:
Output only. The newly generated signing secret.
Example
Example Response
{ "secret": "string" }
ListWebhooks
Lists all Webhooks.
Path / Query Parameters
Optional. The maximum number of webhooks to return. The service may return fewer than this value. If unspecified, at most 50 webhooks will be returned. The maximum value is 1000.
Optional. A page token, received from a previous `ListWebhooks` call. Provide this to retrieve the subsequent page.
Response
If successful, the response body contains data with the following structure:
A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
The webhooks.
Example
Example Response
{ "next_page_token": "string", "webhooks": [ { "create_time": "string", "id": "string", "name": "string", "new_signing_secret": "string", "signing_secrets": [ { "expire_time": "string", "truncated_secret": "string" } ], "state": "enabled", "subscribed_events": [ "batch.succeeded" ], "update_time": "string", "uri": "string" } ] }
GetWebhook
Gets a specific Webhook.
Path / Query Parameters
Required. The ID of the webhook to retrieve.
Response
If successful, the response body contains data with the following structure:
Output only. The timestamp when the webhook was created.
Output only. The ID of the webhook.
Optional. The user-provided name of the webhook.
Output only. The new signing secret for the webhook. Only populated on create.
signing_secrets SigningSecret (optional)
Output only. The signing secrets associated with this webhook.
Fields
Output only. The expiration date of the signing secret.
Output only. The truncated version of the signing secret.
Output only. The state of the webhook.
Possible values:
-
enabledThe webhook is enabled.
-
disabledThe webhook is disabled by the user.
-
disabled_due_to_failed_deliveriesThe webhook is disabled due to failed deliveries.
Required. The events that the webhook is subscribed to. Available events: - batch.succeeded - batch.expired - batch.failed - interaction.requires_action - interaction.completed - interaction.failed - video.generated
Possible values:
-
batch.succeededBatch processing finished successfully.
-
batch.expiredBatch has not been processed within the 48h timeframe.
-
batch.failedBatch job failed.
-
interaction.requires_actionInteraction requires action (e.g., function calling).
-
interaction.completedInteraction completed successfully.
-
interaction.failedInteraction failed.
-
video.generatedVideo generation completed.
Output only. The timestamp when the webhook was last updated.
Required. The URI to which webhook events will be sent.
Example
Example Response
{ "create_time": "string", "id": "string", "name": "string", "new_signing_secret": "string", "signing_secrets": [ { "expire_time": "string", "truncated_secret": "string" } ], "state": "enabled", "subscribed_events": [ "batch.succeeded" ], "update_time": "string", "uri": "string" }
UpdateWebhook
Updates an existing Webhook.
Path / Query Parameters
Required. The ID of the webhook to update.
Optional. The list of fields to update.
Request body
The request body contains data with the following structure:
Optional. The user-provided name of the webhook.
Optional. The state of the webhook.
Possible values:
-
enabledThe webhook is enabled.
-
disabledThe webhook is disabled by the user.
-
disabled_due_to_failed_deliveriesThe webhook is disabled due to failed deliveries.
Optional. The events that the webhook is subscribed to. Available events: - batch.succeeded - batch.expired - batch.failed - interaction.requires_action - interaction.completed - interaction.failed - video.generated
Possible values:
-
batch.succeededBatch processing finished successfully.
-
batch.expiredBatch has not been processed within the 48h timeframe.
-
batch.failedBatch job failed.
-
interaction.requires_actionInteraction requires action (e.g., function calling).
-
interaction.completedInteraction completed successfully.
-
interaction.failedInteraction failed.
-
video.generatedVideo generation completed.
Optional. The URI to which webhook events will be sent.
Response
If successful, the response body contains data with the following structure:
Output only. The timestamp when the webhook was created.
Output only. The ID of the webhook.
Optional. The user-provided name of the webhook.
Output only. The new signing secret for the webhook. Only populated on create.
signing_secrets SigningSecret (optional)
Output only. The signing secrets associated with this webhook.
Fields
Output only. The expiration date of the signing secret.
Output only. The truncated version of the signing secret.
Output only. The state of the webhook.
Possible values:
-
enabledThe webhook is enabled.
-
disabledThe webhook is disabled by the user.
-
disabled_due_to_failed_deliveriesThe webhook is disabled due to failed deliveries.
Required. The events that the webhook is subscribed to. Available events: - batch.succeeded - batch.expired - batch.failed - interaction.requires_action - interaction.completed - interaction.failed - video.generated
Possible values:
-
batch.succeededBatch processing finished successfully.
-
batch.expiredBatch has not been processed within the 48h timeframe.
-
batch.failedBatch job failed.
-
interaction.requires_actionInteraction requires action (e.g., function calling).
-
interaction.completedInteraction completed successfully.
-
interaction.failedInteraction failed.
-
video.generatedVideo generation completed.
Output only. The timestamp when the webhook was last updated.
Required. The URI to which webhook events will be sent.
Example
Example Response
{ "create_time": "string", "id": "string", "name": "string", "new_signing_secret": "string", "signing_secrets": [ { "expire_time": "string", "truncated_secret": "string" } ], "state": "enabled", "subscribed_events": [ "batch.succeeded" ], "update_time": "string", "uri": "string" }
DeleteWebhook
Deletes a Webhook.
Path / Query Parameters
Required. The ID of the webhook to delete. Format: `{webhook_id}`
Response
If successful, the response is empty.
Example
Resources
Webhook
A Webhook resource.
Fields
Output only. The timestamp when the webhook was created.
Output only. The ID of the webhook.
Optional. The user-provided name of the webhook.
Output only. The new signing secret for the webhook. Only populated on create.
signing_secrets SigningSecret (optional)
Output only. The signing secrets associated with this webhook.
Fields
Output only. The expiration date of the signing secret.
Output only. The truncated version of the signing secret.
Output only. The state of the webhook.
Possible values:
-
enabledThe webhook is enabled.
-
disabledThe webhook is disabled by the user.
-
disabled_due_to_failed_deliveriesThe webhook is disabled due to failed deliveries.
Required. The events that the webhook is subscribed to. Available events: - batch.succeeded - batch.expired - batch.failed - interaction.requires_action - interaction.completed - interaction.failed - video.generated
Possible values:
-
batch.succeededBatch processing finished successfully.
-
batch.expiredBatch has not been processed within the 48h timeframe.
-
batch.failedBatch job failed.
-
interaction.requires_actionInteraction requires action (e.g., function calling).
-
interaction.completedInteraction completed successfully.
-
interaction.failedInteraction failed.
-
video.generatedVideo generation completed.
Output only. The timestamp when the webhook was last updated.
Required. The URI to which webhook events will be sent.