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

Create Webhook Endpoint

WebhookEndpointWithSecret webhooks().create(WebhookCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/webhook_endpoints

Creates a webhook endpoint for the authenticated project.

ParametersExpand Collapse
WebhookCreateParams params
List<EventType> eventTypes

The event types that trigger deliveries to this endpoint.

String name

A human-readable name for the webhook endpoint.

minLength1
maxLength256
String url

The HTTPS URL that receives webhook deliveries.

maxLength2048
ReturnsExpand Collapse
class WebhookEndpointWithSecret:
String id

The unique ID of the webhook endpoint.

long createdAt

The Unix timestamp when the endpoint was created.

formatunixtime
List<String> eventTypes

The event types that trigger deliveries to this endpoint.

String name

The human-readable name of the endpoint.

JsonValue; object_ "webhook_endpoint"constant"webhook_endpoint"constant

The object type, which is always webhook_endpoint.

String signingSecret

The endpoint’s signing secret. This is returned only when the endpoint is created or the secret is rotated.

Optional<String> signingSecretHint

A masked hint for the endpoint’s signing secret.

String url

The HTTPS URL that receives webhook deliveries.

Optional<Long> updatedAt

The Unix timestamp of the last endpoint configuration or signing-secret change. Initialized at creation; tests and unchanged updates do not advance it.

formatunixtime

Create Webhook Endpoint

package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.webhooks.WebhookCreateParams;
import com.openai.models.webhooks.WebhookEndpointWithSecret;

public final class Main {
    private Main() {}

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

        WebhookCreateParams params = WebhookCreateParams.builder()
            .addEventType(WebhookCreateParams.EventType.BATCH_COMPLETED)
            .name("x")
            .url("https://")
            .build();
        WebhookEndpointWithSecret webhookEndpointWithSecret = client.webhooks().create(params);
    }
}
{
  "id": "id",
  "created_at": 0,
  "event_types": [
    "string"
  ],
  "name": "name",
  "object": "webhook_endpoint",
  "signing_secret": "signing_secret",
  "signing_secret_hint": "signing_secret_hint",
  "url": "url",
  "updated_at": 0
}
Returns Examples
{
  "id": "id",
  "created_at": 0,
  "event_types": [
    "string"
  ],
  "name": "name",
  "object": "webhook_endpoint",
  "signing_secret": "signing_secret",
  "signing_secret_hint": "signing_secret_hint",
  "url": "url",
  "updated_at": 0
}