---
title: "Rotate an account webhook secret"
method: POST
path: "/accounts/{account}/webhooks/{webhook}/secret"
tags: ["Account"]
---

# Rotate an account webhook secret

`POST /accounts/{account}/webhooks/{webhook}/secret`

## Request

- Base URL: `https://api.factuarea.com/v1`
- URL: `https://api.factuarea.com/v1/accounts/{account}/webhooks/{webhook}/secret`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Rotate the signing secret of an account webhook endpoint; the new secret is returned once. Irreversible.
- The previous secret keeps signing for 24 hours.
- Rotating again within five minutes returns 422 subcode `webhook_secret_recently_rotated`.
- Requires a live key and an `Idempotency-Key`; 404 `webhook_endpoint_not_found`.

## Path parameters

- `account` string, uuid, required
- `webhook` string, uuid, required

## Headers

- `Idempotency-Key` string, required
- `Factuarea-Version` string, date

## Response `200`

- object
  - `data` AccountWebhookWithSecret, required: An `AccountWebhook` returned once at creation or after secret rotation: the same fields PLUS the plaintext signing secret.
    - `id` string, uuid, required: Opaque identifier (UUID v7) of the account webhook endpoint. It is the `{webhook}` of the endpoint routes.
    - `object` 'account_webhook', required: Always `account_webhook`.
    - `environment` 'live' | 'test', required: Environment of the endpoint: always the one of the credential that created it, and it never changes. A `live` credential never sees a `test` endpoint and the other way round. A `test` endpoint never reaches the network: its deliveries are recorded with their envelope and stay `pending`.
    - `url` string, uri, required: HTTPS callback URL that receives the signed events.
    - `enabled_events` string[], required: Event types this endpoint subscribes to: the company events of the public catalog (`GET /v1/event-catalog`) and the account-level events of `AccountEventType`. Duplicates are collapsed.
    - `account_relationship` 'own' | 'managed' | 'all', required: Whose tax IDs the endpoint hears about: `own` (the tax IDs of your account), `managed` (the accounts your account manages) or `all` (the default).
    - `status` 'active' | 'disabled', required: `active` while the endpoint receives events; `disabled` once it stopped receiving them (the reason is in `disabled_reason`).
    - `disabled_reason` 'creator_lost_capability' | 'null', nullable, required: Why the endpoint was disabled, or `null` while it is active. `creator_lost_capability`: the person or key that created it stopped being an owner or admin of the account, or no longer reaches every tax ID of the account.
    - `api_version` string, nullable, required: Payload version (date-based, `YYYY-MM-DD`) pinned for this endpoint. A new endpoint is pinned to the latest version when created; `null` makes it follow the version in force on every emission.
    - `description` string, nullable, required: Free text you give the endpoint, or `null`.
    - `created_at` string, date-time, required: When the endpoint was created (ISO 8601).
    - `updated_at` string, date-time, required: When the endpoint was last changed (ISO 8601).
    - `secret` string, nullable, required: Signing secret, returned only at creation or after rotation. `null` only in an idempotent replay of that creation or rotation, because the secret is never stored.

## Other responses

- `400`: `parameter_unknown` with `subcode` `retired_active_profile_header`: the retired `X-Active-Profile` header was sent; the company goes in the path. `parameter_invalid_format` on `Factuarea-Version`: the header is not a `YYYY-MM-DD` date. `unsupported_api_version`: the `Factuarea-Version` date is not a supported version.
- `401`: Missing or invalid API key.
- `403`: The request is authenticated but not allowed: the API key lacks the required scope (`insufficient_scope`), the plan does not include the public API or this feature (`addon_not_active`, `feature_not_available_in_plan`), or the module is not available with a test key (`module_not_available_in_sandbox`).
- `404`: The requested resource does not exist or belongs to another company.
- `422`: Validation failed — e.g. the API key plan limit was reached, or an invoice language outside the allowed catalog (`es`, `en`, `ca`). The `error.param` field identifies which input is invalid, if any.
- `429`: Rate limit exceeded. Retry after the duration in `Retry-After`.
- `500`: Unexpected server error.

---

[API](https://skmtc.dev/factuarea/apis/factuarea-public-api.md) · [All operations](https://skmtc.dev/factuarea/apis/factuarea-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/factuarea/apis/factuarea-public-api/revisions/718e77934422?raw)
