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

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# On delegation credential secret rotation failed

> Subscribes when a delegation credential secret cannot rotate.

`calcom.onDelegationCredentialSecretRotationFailed` subscribes when a delegation credential secret cannot rotate.

```ts automations/on-delegation-credential-secret-rotation-failed.automation.ts theme={null}
import { automation, markSignificant } from "automate.ax"
import { calcom } from "automate.ax/calcom"

export default automation(
  "On delegation credential secret rotation failed",
  () => {
    const event = calcom.onDelegationCredentialSecretRotationFailed({
      scope: { organizationId: 7, type: "organization" },
    })
    markSignificant(event)
  },
)
```

## Scope

Pass `{ type: "organization", organizationId }`. The connected API key must belong to an organization admin with permission to create, update, and delete organization webhooks. Cal.com also applies the organization's plan requirements.

## Event

| Field                                            | Type                                                | Required |
| ------------------------------------------------ | --------------------------------------------------- | -------- |
| `createdAt`                                      | `string (date-time)`                                | Yes      |
| `payload`                                        | `object`                                            | Yes      |
| `payload.delegationCredential`                   | `object`                                            | Yes      |
| `payload.delegationCredential.domain`            | `string`                                            | Yes      |
| `payload.delegationCredential.id`                | `string`                                            | Yes      |
| `payload.delegationCredential.organizationId`    | `integer`                                           | Yes      |
| `payload.delegationCredential.secretExpiresAt`   | `string (date-time)`                                | Yes      |
| `payload.delegationCredential.workspacePlatform` | `string`                                            | Yes      |
| `payload.error`                                  | `object`                                            | Yes      |
| `payload.error.code`                             | `"SECRET_MINT_FAILED" \| "SECRET_PROMOTION_FAILED"` | Yes      |
| `payload.error.message`                          | `string`                                            | Yes      |
| `triggerEvent`                                   | `"DELEGATION_CREDENTIAL_SECRET_ROTATION_FAILED"`    | Yes      |

Additional provider fields are preserved.

Automate.ax creates and maintains the Cal.com webhook, verifies `x-cal-signature-256`, and deduplicates provider retries. Use `calcom.onEvent` when one automation should receive every supported Cal.com event.
