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

# Rotate an LLM's resource signing key

> Generates a new secret for signing the LLM's native API resource IDs. IDs signed with the old key keep working for the grace period (default 720 hours; 0 revokes them at once). Edges receive the new key with the next configuration push.



## OpenAPI

````yaml /swagger/5.16/ai-studio-swagger.yml post /llms/{id}/resource-signing-key/rotate
openapi: 3.0.1
info:
  title: Midsommar API
  description: This is the API for the Midsommar user and group management system.
  termsOfService: http://swagger.io/terms/
  contact:
    name: API Support
    url: http://www.swagger.io/support
    email: support@swagger.io
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: '1.0'
servers:
  - url: //localhost:8080/api/v1
security: []
paths:
  /llms/{id}/resource-signing-key/rotate:
    post:
      tags:
        - llms
      summary: Rotate an LLM's resource signing key
      description: >-
        Generates a new secret for signing the LLM's native API resource IDs.
        IDs signed with the old key keep working for the grace period (default
        720 hours; 0 revokes them at once). Edges receive the new key with the
        next configuration push.
      parameters:
        - name: id
          in: path
          description: LLM ID
          required: true
          schema:
            type: integer
      requestBody:
        description: Grace period
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api.RotateResourceSigningKeyRequest'
        required: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.ResourceSigningStatusResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.ErrorResponse'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    api.RotateResourceSigningKeyRequest:
      type: object
      properties:
        grace_period_hours:
          type: integer
          description: |-
            GracePeriodHours keeps the old key verifiable after the rotation.
            Omitted: 720 (30 days). 0 revokes it at once. At most 8760.
    api.ResourceSigningStatusResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/api.ResourceSigningStatus'
    api.ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              detail:
                type: string
              title:
                type: string
      description: Error response model
    api.ResourceSigningStatus:
      type: object
      properties:
        kid:
          type: string
        llm_id:
          type: integer
        previous:
          $ref: '#/components/schemas/api.ResourceSigningPreviousKey'
        rotated_at:
          type: string
        source:
          type: string
          description: >-
            Source of the current key: "secret", or "vendor_credential" while
            the

            LLM has no secret (it gets one at the next Studio start or
            rotation),

            or "none" when it has neither.
    api.ResourceSigningPreviousKey:
      type: object
      properties:
        active:
          type: boolean
          description: |-
            Active is false once ExpiresAt has passed: IDs it signed no longer
            verify (except on the node whose ledger holds the resource).
        expires_at:
          type: string
        kid:
          type: string
        source:
          type: string
          description: |-
            Source is "secret" (hub-generated) or "vendor_credential" (derived
            from the LLM's API key, for IDs minted before the LLM had a secret).
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````