Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

Test Webhook Endpoint

webhooks.test_(webhook_endpoint_id, **kwargs) -> WebhookEndpointTestResult { event_type, object, status_code, 2 more }
POST
/webhook_endpoints/{webhook_endpoint_id}/test

Sends a sample event to a webhook endpoint for the authenticated project.

Parameters
webhook_endpoint_id: String
event_type: :"batch.completed" | :"batch.failed" | :"batch.expired" | 24 more

The event type to send as a sample delivery.

Returns
class WebhookEndpointTestResult { event_type, object, status_code, 2 more }
event_type: String

The event type sent in the test.

object: :"webhook_endpoint.test"

The object type, which is always webhook_endpoint.test.

status_code: Integer

The HTTP status code returned by the endpoint.

success: true

Whether the test request completed. Always true for returned results; use status_code to determine the endpoint response.

webhook_endpoint_id: String

The ID of the webhook endpoint that received the test.

Test Webhook Endpoint

require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

webhook_endpoint_test_result = openai.webhooks.test_("whe_123", event_type: :"batch.completed")

puts(webhook_endpoint_test_result)
200 — Example
{
  "event_type": "event_type",
  "object": "webhook_endpoint.test",
  "status_code": 0,
  "success": true,
  "webhook_endpoint_id": "webhook_endpoint_id"
}
Returns Examples
200 — Example
{
  "event_type": "event_type",
  "object": "webhook_endpoint.test",
  "status_code": 0,
  "success": true,
  "webhook_endpoint_id": "webhook_endpoint_id"
}