# Set an hmac webhook secret

> Source: https://elaichi.ai/docs/api-reference/workflows/automation/setautomationwebhooksecret/

`PUT /automation/{id}/webhook/{triggerKey}/secret`

Resource: **Workflow** · API: **Workflows**

## Path parameters

- **`id`** _(string, required)_
  Resource id
- **`triggerKey`** _(string, required)_
  Webhook trigger key within the workflow

## Request body

- **`secret`** _(string)_
- **`grace_seconds`** _(integer)_

## Response body

- **`trigger_key`** _(string)_
- **`endpoint_id`** _(string)_
- **`url`** _(string)_
- **`scheme`** _(string)_
  Allowed: `standard`, `hmac`, `token`
- **`preset`** _(string,null)_
- **`status`** _(string)_
  Allowed: `active`, `needs_secret`, `draft_only`
- **`secret_state`** _(string)_
  Allowed: `unrevealed`, `revealed`, `provided`, `missing`
- **`previous_secret_expires_at`** _(string,null)_
- **`created_at`** _(string)_
- **`rotated_at`** _(string,null)_
- **`can_manage`** _(boolean)_

## Code examples

### curl

```bash
curl -X PUT 'https://api.elaichi.ai/automation/<id>/webhook/<triggerKey>/secret' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"secret":"your_secret","grace_seconds":0}'
```

### JavaScript

```javascript
const body = {
  "secret": "your_secret",
  "grace_seconds": 0
};

const response = await fetch('https://api.elaichi.ai/automation/<id>/webhook/<triggerKey>/secret', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/automation/<id>/webhook/<triggerKey>/secret"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "secret": "your_secret",
    "grace_seconds": 0
}

response = requests.put(url, headers=headers, json=payload)
print(response.json())
```
