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

Test Webhook Endpoint

WebhookEndpointTestResult webhooks().test(WebhookTestParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/webhook_endpoints/{webhook_endpoint_id}/test

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

ParametersExpand Collapse
WebhookTestParams params
Optional<String> webhookEndpointId
EventType eventType

The event type to send as a sample delivery.

ReturnsExpand Collapse
class WebhookEndpointTestResult:
String eventType

The event type sent in the test.

JsonValue; object_ "webhook_endpoint.test"constant"webhook_endpoint.test"constant

The object type, which is always webhook_endpoint.test.

long statusCode

The HTTP status code returned by the endpoint.

JsonValue; success trueconstanttrueconstant

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

String webhookEndpointId

The ID of the webhook endpoint that received the test.

Test Webhook Endpoint

package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.webhooks.WebhookEndpointTestResult;
import com.openai.models.webhooks.WebhookTestParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        WebhookTestParams params = WebhookTestParams.builder()
            .webhookEndpointId("whe_123")
            .eventType(WebhookTestParams.EventType.BATCH_COMPLETED)
            .build();
        WebhookEndpointTestResult webhookEndpointTestResult = client.webhooks().test(params);
    }
}
{
  "event_type": "event_type",
  "object": "webhook_endpoint.test",
  "status_code": 0,
  "success": true,
  "webhook_endpoint_id": "webhook_endpoint_id"
}
Returns Examples
{
  "event_type": "event_type",
  "object": "webhook_endpoint.test",
  "status_code": 0,
  "success": true,
  "webhook_endpoint_id": "webhook_endpoint_id"
}