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

# Rotate API key

> Generates a new API key for the specified workspace, invalidating the previous key to enhance security and maintain authorized access.



## OpenAPI

````yaml /api-reference/openapi.json post /api/workspaces/{id}/api-key/rotate
openapi: 3.0.0
info:
  title: Open Attack Surface Management
  description: Open-source platform for cybersecurity Attack Surface Management (ASM)
  version: '1.0'
  contact: {}
servers:
  - url: https://{baseUrl}/api/v1
    variables:
      baseUrl:
        default: localhost:3000
        description: API server hostname with port (e.g. localhost:3000, api.example.com)
security: []
tags: []
externalDocs:
  description: Authentication Docs
  url: auth/docs
paths:
  /api/workspaces/{id}/api-key/rotate:
    post:
      tags:
        - Workspaces
      summary: Rotate API key
      description: >-
        Generates a new API key for the specified workspace, invalidating the
        previous key to enhance security and maintain authorized access.
      operationId: WorkspacesController_rotateApiKey
      parameters:
        - name: id
          required: true
          in: path
          description: The id of the resource
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetApiKeyResponseDto'
                allOf:
                  - $ref: '#/components/schemas/AppResponseSerialization'
components:
  schemas:
    GetApiKeyResponseDto:
      type: object
      properties:
        apiKey:
          type: string
      required:
        - apiKey

````