Create, list, update, rotate, and delete webhook endpoints with the Browserbase SDK.
An endpoint is an HTTPS URL on your server that Browserbase POSTs events to. Endpoints belong to a project, and the API key you use determines which project owns the webhook.You can manage endpoints from Settings as well as through the SDK. Both act on the same webhooks.
import { Browserbase } from "@browserbasehq/sdk";const bb = new Browserbase({ apiKey: process.env.BROWSERBASE_API_KEY! });const webhook = await bb.webhooks.create({ endpoint: "https://example.com/browserbase/events", eventTypes: ["functions.invocations.completed"],});// Store this now. You can't retrieve it later.console.log(webhook.secret);
import osfrom browserbase import Browserbasebb = Browserbase(api_key=os.environ["BROWSERBASE_API_KEY"])webhook = bb.webhooks.create( endpoint="https://example.com/browserbase/events", event_types=["functions.invocations.completed"],)# Store this now. You can't retrieve it later.print(webhook.secret)
Browserbase returns the signing secret only when you create the webhook and when you rotate it. No endpoint reads it back, so store it before you discard the response.
Creating one from the dashboard shows the secret the same way, once.
Endpoint URLs must meet these requirements:
The endpoint must be https:// with a real host. Browserbase rejects http:// and a bare https://.
You can register each endpoint URL only once per project. Registering the same URL again returns a conflict instead of creating a duplicate.
Rotation issues a new secret and returns it once. The previous secret keeps verifying for 24 hours, so you can deploy the new one without dropping deliveries. Pass revokeImmediately to expire it at once, which is what you want if the old secret leaked.
The safe order is: rotate, deploy the new secret alongside the old one, verify traffic is arriving, then stop accepting the old secret.
Only a limited number of rotated secrets can sit inside their 24 hour windows at once. Rotating the same endpoint again before an earlier window closes fails, and nothing changes. Either wait for a window to close, or pass revokeImmediately so the previous secret expires instead of holding one open.