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

# Rotate the signing key of OAuth credentials

> Switches the OAuth credentials to their successor key and generates a new successor, for credentials using `private_key_jwt`. Takes no body. The new signing key is one your authorization server already holds, since the successor is published from the start, so the switch causes no outage.

The key replaced is no longer used to sign, but stays in the published set for 30 days and is then deleted. Rotating again within those 30 days is allowed: each key rotated out keeps its own 30 days, and any of them can be revoked by `kid`. The credentials can hold at most 5 keys in their signing algorithm at once, counting the active key, its successor and those rotated out; at that limit, revoke a rotated-out key (the error names the oldest) and rotate again. To stop trusting a key at once — after a leak — use `revoke_key` instead.

Returns the `kid` of the key rotated out. The public keys are at the `jwksUri` of the credentials: fetch them again, or register the new successor with your authorization server, before the next rotation.

**Endpoint Permissions:** Owner, Admin, Non-Signing Admin.




## OpenAPI

````yaml https://swagger.fireblocks.com/openapi.yaml post /webhooks_settings/oauth/{webhookOauthId}/rotate_key
openapi: 3.0.0
info:
  title: Fireblocks API
  description: >
    Fireblocks provides a suite of applications to manage digital asset
    operations and a complete development platform to build your business on the
    blockchain.


    - Visit our website for more information: [Fireblocks
    Website](https://fireblocks.com)

    - Visit our developer docs: [Fireblocks
    DevPortal](https://developers.fireblocks.com)
  version: 1.6.2
  contact:
    email: developers@fireblocks.com
servers:
  - url: https://api.fireblocks.io/v1
    description: Fireblocks Production Environment Base URL
  - url: https://sandbox-api.fireblocks.io/v1
    description: Fireblocks Sandbox Environment Base URL
security: []
paths:
  /webhooks_settings/oauth/{webhookOauthId}/rotate_key:
    post:
      tags:
        - Webhooks V2
      summary: Rotate the signing key of OAuth credentials
      description: >
        Switches the OAuth credentials to their successor key and generates a
        new successor, for credentials using `private_key_jwt`. Takes no body.
        The new signing key is one your authorization server already holds,
        since the successor is published from the start, so the switch causes no
        outage.


        The key replaced is no longer used to sign, but stays in the published
        set for 30 days and is then deleted. Rotating again within those 30 days
        is allowed: each key rotated out keeps its own 30 days, and any of them
        can be revoked by `kid`. The credentials can hold at most 5 keys in
        their signing algorithm at once, counting the active key, its successor
        and those rotated out; at that limit, revoke a rotated-out key (the
        error names the oldest) and rotate again. To stop trusting a key at once
        — after a leak — use `revoke_key` instead.


        Returns the `kid` of the key rotated out. The public keys are at the
        `jwksUri` of the credentials: fetch them again, or register the new
        successor with your authorization server, before the next rotation.


        **Endpoint Permissions:** Owner, Admin, Non-Signing Admin.
      operationId: rotateWebhookOauthKey
      parameters:
        - name: webhookOauthId
          required: true
          in: path
          description: The unique identifier of the OAuth credentials
          schema:
            type: string
            example: 44fcead0-7053-4831-a53a-df7fb90d440f
            format: uuid
        - $ref: '#/components/parameters/X-Idempotency-Key'
      responses:
        '200':
          description: The key was rotated; the `kid` of the key rotated out
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RotateWebhookOauthKeyResponse'
        '400':
          description: >-
            The credentials do not use `private_key_jwt`, so they have no
            signing key to rotate, or they already hold 5 keys in their signing
            algorithm and a rotated-out key must be revoked first.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '404':
          description: No such OAuth credentials in this workspace.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        default:
          $ref: '#/components/responses/Error'
      x-codeSamples:
        - lang: TypeScript
          source: >-
            const response:
            Promise<FireblocksResponse<RotateWebhookOauthKeyResponse>> =
            fireblocks.webhooksV2.rotateWebhookOauthKey(webhooksV2ApiRotateWebhookOauthKeyRequest);
        - lang: Java
          source: >-
            CompletableFuture<ApiResponse<RotateWebhookOauthKeyResponse>>
            response =
            fireblocks.webhooksV2().rotateWebhookOauthKey(webhookOauthId,
            idempotencyKey);
        - lang: Python
          source: >-
            response =
            fireblocks.webhooks_v2.rotate_webhook_oauth_key(webhook_oauth_id,
            idempotency_key);
components:
  parameters:
    X-Idempotency-Key:
      name: Idempotency-Key
      in: header
      description: >-
        A unique identifier for the request. If the request is sent multiple
        times with the same idempotency key, the server will return the same
        response as the first request. The idempotency key is valid for 24
        hours.
      required: false
      schema:
        type: string
  headers:
    X-Request-ID:
      schema:
        type: string
      description: >-
        Unique ID correlated to the API request. Please provide it in any
        support ticket you create or on Github issues related to Fireblocks SDKs
  schemas:
    RotateWebhookOauthKeyResponse:
      type: object
      description: >-
        The key that was rotated out. It stays published at the `jwksUri` of the
        credentials for 30 days. Fetch the JWKS from there for the current
        public keys.
      properties:
        kid:
          type: string
          description: >-
            The `kid` of the key rotated out, the one Fireblocks was signing
            with until now. It is the SHA-256 fingerprint of the public key's
            DER (SPKI) encoding, in lowercase hex.
          example: a1b2c3d4e5f60718...
      required:
        - kid
    ErrorSchema:
      type: object
      properties:
        message:
          type: string
        code:
          type: number
  responses:
    Error:
      description: Error Response
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorSchema'

````