> ## Documentation Index
> Fetch the complete documentation index at: https://docs.daya.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Webhook

> Update a webhook's configuration

## Overview

Update a webhook's URL, events, status, or description. All fields are optional - only include the fields you want to update.

<Info>
  Pro webhook setup and configuration changes are support-managed. Contact [support@daya.co](mailto:support@daya.co) if you need to add or change webhook endpoints for your Pro account.
</Info>

## Authentication

<ParamField header="X-Api-Key" type="string" required>
  Your API key with Write scope

  ```
  X-Api-Key: daya_sk_YOUR_API_KEY
  ```
</ParamField>

## Path Parameters

<ParamField path="id" type="string" required>
  Webhook ID (UUID)

  **Example:** `770e8400-e29b-41d4-a716-446655440000`
</ParamField>

## Request Body

<ParamField body="url" type="string">
  New webhook endpoint URL (must be HTTPS)
</ParamField>

<ParamField body="events" type="array">
  New events to subscribe to

  **Allowed values:** `order.created`, `order.filled`, `order.partially_filled`, `order.cancelled`, `order.rejected`, `trade.executed`, `deposit.completed`, `crypto.deposit.completed`
</ParamField>

<ParamField body="status" type="string">
  Webhook status

  **Allowed values:** `active`, `paused`
</ParamField>

<ParamField body="description" type="string">
  New description for the webhook
</ParamField>

## Request Examples

### Update Events

<CodeGroup>
  ```bash cURL theme={null}
  curl --request PATCH \
    --url 'https://api.pro.daya.co/public/v1/webhooks/770e8400-e29b-41d4-a716-446655440000' \
    --header 'X-Api-Key: daya_sk_YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "events": ["order.filled", "trade.executed"]
    }'
  ```

  ```javascript JavaScript theme={null}
  const webhookId = '770e8400-e29b-41d4-a716-446655440000';

  const response = await fetch(
    `https://api.pro.daya.co/public/v1/webhooks/${webhookId}`,
    {
      method: 'PATCH',
      headers: {
        'X-Api-Key': 'daya_sk_YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        events: ['order.filled', 'trade.executed']
      })
    }
  );

  const data = await response.json();
  console.log('Updated webhook:', data.data);
  ```
</CodeGroup>

### Pause Webhook

<CodeGroup>
  ```bash cURL theme={null}
  curl --request PATCH \
    --url 'https://api.pro.daya.co/public/v1/webhooks/770e8400-e29b-41d4-a716-446655440000' \
    --header 'X-Api-Key: daya_sk_YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "status": "paused"
    }'
  ```

  ```javascript JavaScript theme={null}
  const webhookId = '770e8400-e29b-41d4-a716-446655440000';

  const response = await fetch(
    `https://api.pro.daya.co/public/v1/webhooks/${webhookId}`,
    {
      method: 'PATCH',
      headers: {
        'X-Api-Key': 'daya_sk_YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        status: 'paused'
      })
    }
  );
  ```
</CodeGroup>

### Resume Webhook

```bash theme={null}
curl --request PATCH \
  --url 'https://api.pro.daya.co/public/v1/webhooks/770e8400-e29b-41d4-a716-446655440000' \
  --header 'X-Api-Key: daya_sk_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{"status": "active"}'
```

## Response

<ResponseField name="success" type="boolean" required>
  Indicates if the request was successful
</ResponseField>

<ResponseField name="message" type="string" required>
  Human-readable response message
</ResponseField>

<ResponseField name="data" type="object" required>
  Updated webhook object

  <Expandable title="webhook properties">
    <ResponseField name="id" type="string">
      Unique webhook identifier (UUID)
    </ResponseField>

    <ResponseField name="url" type="string">
      Webhook endpoint URL
    </ResponseField>

    <ResponseField name="description" type="string">
      Webhook description
    </ResponseField>

    <ResponseField name="events" type="array">
      Events this webhook is subscribed to
    </ResponseField>

    <ResponseField name="status" type="string">
      Webhook status: `active`, `paused`, `disabled`
    </ResponseField>

    <ResponseField name="failure_count" type="integer">
      Number of consecutive delivery failures
    </ResponseField>

    <ResponseField name="created_at" type="string">
      ISO 8601 creation timestamp
    </ResponseField>

    <ResponseField name="updated_at" type="string">
      ISO 8601 last update timestamp
    </ResponseField>
  </Expandable>
</ResponseField>

### Success Response

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "success": true,
    "message": "Webhook updated successfully",
    "data": {
      "id": "770e8400-e29b-41d4-a716-446655440000",
      "url": "https://example.com/webhooks/daya",
      "description": "Order notifications",
      "events": ["order.filled", "trade.executed"],
      "status": "active",
      "failure_count": 0,
      "last_success_at": "2024-01-15T10:30:00Z",
      "last_failure_at": null,
      "last_failure_reason": null,
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-15T12:00:00Z"
    },
    "timestamp": "2024-01-15T12:00:00Z"
  }
  ```
</ResponseExample>

## Error Responses

<ResponseExample>
  ```json 400 Bad Request - Invalid status theme={null}
  {
    "success": false,
    "message": "Validation error",
    "error": {
      "code": "VALIDATION_ERROR",
      "message": "Invalid status. Allowed values: active, paused"
    }
  }
  ```

  ```json 400 Bad Request - Invalid URL theme={null}
  {
    "success": false,
    "message": "Validation error",
    "error": {
      "code": "VALIDATION_ERROR",
      "message": "URL must be a valid HTTPS URL"
    }
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "success": false,
    "message": "Webhook not found",
    "error": {
      "code": "WEBHOOK_NOT_FOUND",
      "message": "No webhook found with the specified ID"
    }
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "success": false,
    "message": "Unauthorized",
    "error": {
      "code": "API_KEY_INVALID",
      "message": "The provided API key is invalid"
    }
  }
  ```
</ResponseExample>

## Rate Limits

* **100 requests per minute** per API key

## Next Steps

<CardGroup cols={2}>
  <Card title="Delete Webhook" icon="trash" href="/pro/api-reference/delete-webhook">
    Delete a webhook
  </Card>

  <Card title="Rotate Secret" icon="rotate" href="/pro/api-reference/rotate-webhook-secret">
    Generate a new signing secret
  </Card>
</CardGroup>
