---
title: "Create or replace a webhook"
url: https://hexelstudio.com/docs/api/harness/webhooks/create-or-replace-a-webhook
---

# Create or replace a webhook

**PUT** `/harness/webhooks/{id}`

`422 invalid_url`, `invalid_event_types`, `invalid_description`.

## Headers

- `Authorization: string`

  `Bearer <token>`. A Hexel Studio access token for your organization.

- `X-Workspace-Id: string`

  The workspace the request acts in (`ws_...`). It never grants access by itself.

- `X-Environment-Id: string`

  The environment the request acts in (`env_...`). It never grants access by itself.

## Body parameters

- `url: string`

  An https URL.

- `event_types: array of string`

  Event types or patterns such as `task.*`.

- `description: optional string`

## Returns

`200` Replaced. (`Webhook`)

- `audience: string`

- `created_at: string`

- `created_by: string`

- `description: string`

- `environment_id: string`

- `event_types: array of string`

- `failing_since: optional string`

- `id: string`

- `last_attempt_at: optional string`

- `last_error: optional string`

- `last_status: optional integer`

- `last_success_at: optional string`

- `pending_deliveries: integer`

- `state: string`

- `updated_at: string`

- `url: string`

- `workspace_id: string`

## Errors

- `default` 

## Example

```bash
curl --request PUT \
  --url 'https://api.hexelstudio.com/v1/harness/webhooks/{id}' \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --header 'X-Workspace-Id: X_WORKSPACE_ID' \
  --header 'X-Environment-Id: X_ENVIRONMENT_ID' \
  --header 'Content-Type: application/json' \
  --data '{
  "url": "string",
  "event_types": [
    "string"
  ],
  "description": "string"
}'
```

### Response (200)

```json
{
  "audience": "string",
  "created_at": "2026-01-01T00:00:00Z",
  "created_by": "string",
  "description": "string",
  "environment_id": "string",
  "event_types": [
    "string"
  ],
  "failing_since": "2026-01-01T00:00:00Z",
  "id": "string",
  "last_attempt_at": "2026-01-01T00:00:00Z",
  "last_error": "string",
  "last_status": 0,
  "last_success_at": "2026-01-01T00:00:00Z",
  "pending_deliveries": 0,
  "state": "string",
  "updated_at": "2026-01-01T00:00:00Z",
  "url": "string",
  "workspace_id": "string"
}
```

### Response (201)

```json
{
  "audience": "string",
  "created_at": "2026-01-01T00:00:00Z",
  "created_by": "string",
  "description": "string",
  "environment_id": "string",
  "event_types": [
    "string"
  ],
  "failing_since": "2026-01-01T00:00:00Z",
  "id": "string",
  "last_attempt_at": "2026-01-01T00:00:00Z",
  "last_error": "string",
  "last_status": 0,
  "last_success_at": "2026-01-01T00:00:00Z",
  "pending_deliveries": 0,
  "state": "string",
  "updated_at": "2026-01-01T00:00:00Z",
  "url": "string",
  "workspace_id": "string"
}
```
