Management API

Endpoints

Create, update, and manage webhook endpoints programmatically

Endpoints are webhook destinations — each one has a URL and an optional authentication configuration. When a webhook event is triggered, Nahook delivers it to all active endpoints subscribed to that event type. See the Environments guide for how environments affect endpoint routing behavior.

API base path: /management/v1/workspaces/{workspaceId}/endpoints


List endpoints

curl https://api.nahook.com/management/v1/workspaces/ws_abc/endpoints \
  -H "Authorization: Bearer nhm_YOUR_TOKEN"
const result = await mgmt.endpoints.list("ws_abc");
// result.data -> Endpoint[]

for (const ep of result.data) {
  console.log(ep.url, ep.isActive);
}
result = mgmt.endpoints.list("ws_abc")
# result["data"] -> list of endpoints

for ep in result["data"]:
    print(ep["url"], ep["isActive"])
result, err := mgmt.Endpoints.List(ctx, "ws_abc")
if err != nil {
    log.Fatal(err)
}

for _, ep := range result.Data {
    fmt.Println(ep.URL, ep.IsActive)
}
var result = mgmt.endpoints().list("ws_abc");

for (var ep : result.getData()) {
    System.out.println(ep.getUrl() + " " + ep.isActive());
}
var result = await mgmt.Endpoints.ListAsync("ws_abc");

foreach (var ep in result.Data)
{
    Console.WriteLine($"{ep.Url} {ep.IsActive}");
}
$result = $mgmt->endpoints->list("ws_abc");

foreach ($result["data"] as $ep) {
    echo $ep["url"] . " " . ($ep["isActive"] ? "true" : "false") . "\n";
}
result = mgmt.endpoints.list("ws_abc")

result["data"].each do |ep|
  puts "#{ep["url"]} #{ep["isActive"]}"
end
let result = mgmt.endpoints().list("ws_abc").await?;

for ep in &result.data {
    println!("{} {}", ep.url, ep.is_active);
}

Create an endpoint

curl -X POST https://api.nahook.com/management/v1/workspaces/ws_abc/endpoints \
  -H "Authorization: Bearer nhm_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/webhooks", "description": "Production webhook"}'
const ep = await mgmt.endpoints.create("ws_abc", {
  url: "https://example.com/webhooks",
  description: "Production webhook",
});

// ep.id -> "ep_..."
ep = mgmt.endpoints.create(
    "ws_abc",
    url="https://example.com/webhooks",
    description="Production webhook",
)

# ep["id"] -> "ep_..."
ep, err := mgmt.Endpoints.Create(ctx, "ws_abc", nahook.CreateEndpointOptions{
    URL:         "https://example.com/webhooks",
    Description: "Production webhook",
})
if err != nil {
    log.Fatal(err)
}

// ep.ID -> "ep_..."
var ep = mgmt.endpoints().create(
    "ws_abc",
    CreateEndpointOptions.builder("https://example.com/webhooks")
        .description("Production webhook")
        .build()
);

// ep.getId() -> "ep_..."
var ep = await mgmt.Endpoints.CreateAsync("ws_abc", new CreateEndpointOptions
{
    Url = "https://example.com/webhooks",
    Description = "Production webhook",
});

// ep.Id -> "ep_..."
$ep = $mgmt->endpoints->create("ws_abc", [
    "url" => "https://example.com/webhooks",
    "description" => "Production webhook",
]);

// $ep["id"] -> "ep_..."
ep = mgmt.endpoints.create(
  "ws_abc",
  url: "https://example.com/webhooks",
  description: "Production webhook",
)

# ep["id"] -> "ep_..."
let ep = mgmt.endpoints().create("ws_abc", CreateEndpointOptions {
    url: "https://example.com/webhooks".into(),
    endpoint_type: None,
    description: Some("Production webhook".into()),
    metadata: None,
    config: None,
    auth_username: None,
    auth_password: None,
}).await?;

// ep.id -> "ep_..."

Get an endpoint

curl https://api.nahook.com/management/v1/workspaces/ws_abc/endpoints/ep_123 \
  -H "Authorization: Bearer nhm_YOUR_TOKEN"
const ep = await mgmt.endpoints.get("ws_abc", "ep_123");
ep = mgmt.endpoints.get("ws_abc", "ep_123")
ep, err := mgmt.Endpoints.Get(ctx, "ws_abc", "ep_123")
if err != nil {
    log.Fatal(err)
}
var ep = mgmt.endpoints().get("ws_abc", "ep_123");
var ep = await mgmt.Endpoints.GetAsync("ws_abc", "ep_123");
$ep = $mgmt->endpoints->get("ws_abc", "ep_123");
ep = mgmt.endpoints.get("ws_abc", "ep_123")
let ep = mgmt.endpoints().get("ws_abc", "ep_123").await?;

Update an endpoint

curl -X PATCH https://api.nahook.com/management/v1/workspaces/ws_abc/endpoints/ep_123 \
  -H "Authorization: Bearer nhm_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"description": "Updated webhook", "isActive": false}'
const ep = await mgmt.endpoints.update("ws_abc", "ep_123", {
  description: "Updated webhook",
  isActive: false,
});
ep = mgmt.endpoints.update(
    "ws_abc",
    "ep_123",
    description="Updated webhook",
    is_active=False,
)
ep, err := mgmt.Endpoints.Update(ctx, "ws_abc", "ep_123", nahook.UpdateEndpointOptions{
    Description: stringPtr("Updated webhook"),
    IsActive:    boolPtr(false),
})
if err != nil {
    log.Fatal(err)
}
var ep = mgmt.endpoints().update(
    "ws_abc",
    "ep_123",
    UpdateEndpointOptions.builder()
        .description("Updated webhook")
        .isActive(false)
        .build()
);
var ep = await mgmt.Endpoints.UpdateAsync("ws_abc", "ep_123", new UpdateEndpointOptions
{
    Description = "Updated webhook",
    IsActive = false,
});
$ep = $mgmt->endpoints->update("ws_abc", "ep_123", [
    "description" => "Updated webhook",
    "isActive" => false,
]);
ep = mgmt.endpoints.update(
  "ws_abc",
  "ep_123",
  description: "Updated webhook",
  is_active: false,
)
let ep = mgmt.endpoints().update("ws_abc", "ep_123", UpdateEndpointOptions {
    url: None,
    description: Some("Updated webhook".into()),
    metadata: None,
    is_active: Some(false),
}).await?;

Delete an endpoint

Deleting an endpoint removes all its subscriptions and stops webhook delivery. This action is permanent.

curl -X DELETE https://api.nahook.com/management/v1/workspaces/ws_abc/endpoints/ep_123 \
  -H "Authorization: Bearer nhm_YOUR_TOKEN"
await mgmt.endpoints.delete("ws_abc", "ep_123");
mgmt.endpoints.delete("ws_abc", "ep_123")
err := mgmt.Endpoints.Delete(ctx, "ws_abc", "ep_123")
if err != nil {
    log.Fatal(err)
}
mgmt.endpoints().delete("ws_abc", "ep_123");
await mgmt.Endpoints.DeleteAsync("ws_abc", "ep_123");
$mgmt->endpoints->delete("ws_abc", "ep_123");
mgmt.endpoints.delete("ws_abc", "ep_123")
mgmt.endpoints().delete("ws_abc", "ep_123").await?;