Create webhook destination
Create webhook destination: createWebhookDestination in the TypeScript, Python, Rust and Go clients.
POST /v1/projects/{projectId}/webhooks/destinations
Creates a webhook destination for the selected project using its URL, payload API version, event selection and other documented settings. The response includes the signing secret, which is returned only in this response and in idempotent replays of it, never by destination reads; store it securely for signature verification. The API version must be selectable and selected event types must belong to that version's catalog. Supply the required Idempotency-Key header.
photon.projects.createWebhookDestination(input: CreateWebhookDestinationInput, options?: RequestOptions): Promise<CreateWebhookDestinationOutput>photon.projects.create_webhook_destination(input: CreateWebhookDestinationInput, *, options: RequestOptions | None = None) -> models.CreateWebhookDestinationResponseclient.create_webhook_destination(idempotency_key: String, project_id: String, body: &types::CreateWebhookDestinationRequest).await -> Result<ResponseValue<types::CreateWebhookDestinationResponse>, Error<CreateWebhookDestinationError>>client.Projects.CreateWebhookDestination(ctx context.Context, params *CreateWebhookDestinationParams, opts ...RequestOption) (*CreateWebhookDestinationResponse, error)import { Photon } from "@photon-ai/api";
const photon = new Photon({
headers: { Authorization: `Bearer ${process.env.PHOTON_API_TOKEN}` },
});
const result = await photon.projects.createWebhookDestination({
path: {
projectId: "projectId",
},
headers: {
idempotencyKey: "idempotencyKey",
},
body: {
apiVersion: "2026-01-01",
enabledEvents: [],
name: "name",
url: "https://example.com",
},
});import os
from photon_api import Photon
from photon_api.rpc_generated import CreateWebhookDestinationInput
photon = Photon(headers={"Authorization": f"Bearer {os.environ['PHOTON_API_TOKEN']}"})
result = photon.projects.create_webhook_destination(
CreateWebhookDestinationInput.model_validate({
"path": {
"projectId": "projectId",
},
"headers": {
"Idempotency-Key": "idempotencyKey",
},
"body": {
"apiVersion": "2026-01-01",
"enabledEvents": [],
"name": "name",
"url": "https://example.com",
},
})
)use photon_ai_api::{Credential, PhotonClientBuilder, SecretString};
let token = std::env::var("PHOTON_API_TOKEN")?;
let client = PhotonClientBuilder::new()
.credential("accountServiceKey", Credential::Bearer(SecretString::from(token)))
.build()?;
let result = client
.create_webhook_destination(
"idempotencyKey".to_owned(),
"projectId".to_owned(),
&serde_json::from_value(serde_json::json!({
"apiVersion": "2026-01-01",
"enabledEvents": [],
"name": "name",
"url": "https://example.com",
}))?,
)
.await
.map_err(|error| format!("{error:?}"))?
.into_inner();import (
"context"
"encoding/json"
"os"
photonapi "github.com/photon-hq/api/packages/go"
)
ctx := context.Background()
client := photonapi.NewClient(photonapi.WithAPIKey(os.Getenv("PHOTON_API_TOKEN")))
var body photonapi.CreateWebhookDestinationRequest
if err := json.Unmarshal([]byte(`{
"apiVersion": "2026-01-01",
"enabledEvents": [],
"name": "name",
"url": "https://example.com"
}`), &body); err != nil {
return err
}
result, err := client.Projects.CreateWebhookDestination(ctx, &photonapi.CreateWebhookDestinationParams{
IdempotencyKey: "idempotencyKey",
ProjectID: "projectId",
Body: body,
})
if err != nil {
return err
}
_ = result{
"destination": {
"apiVersion": "2026-01-01",
"createdAt": "2026-01-01T00:00:00.000Z",
"deletedAt": null,
"description": null,
"destinationId": "string",
"enabledEvents": [
null
],
"name": "string",
"projectId": "string",
"status": "enabled",
"updatedAt": "2026-01-01T00:00:00.000Z",
"url": "https://example.com"
},
"signingSecret": "string"
}Parameters
Selects the API contract date. Without it, the request is served as 2026-07-01.
Identifies one logical mutation across retries.
Body
HTTPS URL without credentials or a fragment.
Returns
201 The created destination and its signing secret. CreateWebhookDestinationResponse
Headers: Photon-Version. The raw response carries these headers; see Raw responses.