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

# API key für Service-Benutzer rotieren

> Rotiert einen API-Schlüssel für einen Service-Benutzer.

Erstellt einen neuen API-Schlüssel. Widerruft standardmäßig den alten API-Schlüssel; setzen Sie revoke_current=false
für einen nahtlosen Übergang, bei dem beide API-Schlüssel vorübergehend aktiv bleiben.
Gibt 404 zurück, wenn der API-Schlüssel nicht gefunden wird, und 400, wenn der API-Schlüssel nicht aktiv ist.

<div id="permissions">
  ## Berechtigungen
</div>

Erfordert einen Service-Benutzer mit der Berechtigung `ManageAccountServiceUsers` auf Enterprise-Ebene.


## OpenAPI

````yaml de/v3-openapi.yaml POST /v3beta1/enterprise/service-users/{service_user_id}/api-keys/{api_key_id}/rotate
openapi: 3.1.0
info:
  description: Devin v3 API mit Service-User-Authentifizierung und RBAC
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3beta1/enterprise/service-users/{service_user_id}/api-keys/{api_key_id}/rotate:
    post:
      tags:
        - service_user_api_keys
      summary: API key für Service-Benutzer rotieren
      description: >-
        Rotiert einen API-Schlüssel für einen Service-Benutzer.


        Erstellt einen neuen API-Schlüssel. Widerruft standardmäßig den alten
        API-Schlüssel; setzen Sie revoke_current=false

        für einen nahtlosen Übergang, bei dem beide API-Schlüssel vorübergehend
        aktiv bleiben.

        Gibt 404 zurück, wenn der API-Schlüssel nicht gefunden wird, und 400,
        wenn der API-Schlüssel nicht aktiv ist.
      operationId: >-
        handle_rotate_service_user_api_key_v3beta1_enterprise_service_users__service_user_id__api_keys__api_key_id__rotate_post
      parameters:
        - description: 'Service-Benutzer-ID (Präfix: service-user-)'
          in: path
          name: service_user_id
          required: true
          schema:
            example: service-user-abc123def456
            title: Service User Id
            type: string
        - in: path
          name: api_key_id
          required: true
          schema:
            title: Api Key Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RotateApiKeyRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyWithTokenResponse'
          description: Erfolgreiche Antwort
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Nicht autorisiert
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Verboten
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Nicht gefunden
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Konflikt
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Nicht verarbeitbarer Inhalt
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Zu viele Anfragen
components:
  schemas:
    RotateApiKeyRequest:
      properties:
        new_key_expires_at:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            Optionales Ablaufdatum für den neuen key als UNIX-Zeitstempel in
            Sekunden. Null für kein Ablaufdatum.
          title: New Key Expires At
        revoke_current:
          default: true
          description: >-
            Gibt an, ob der aktuelle key widerrufen werden soll. Für eine
            unterbrechungsfreie Umstellung auf False setzen.
          title: Revoke Current
          type: boolean
      title: RotateApiKeyRequest
      type: object
    ApiKeyWithTokenResponse:
      description: >-
        Gemeinsames Antwortmodell für die Erstellung/Rotation von API keys
        (einschließlich Einmal-Token).
      properties:
        api_key_id:
          title: Api Key Id
          type: string
        api_key_name:
          title: Api Key Name
          type: string
        token:
          description: >-
            Das rohe API-Token. Es wird nur einmal bei der Erstellung/Rotation
            angezeigt.
          title: Token
          type: string
      required:
        - api_key_id
        - api_key_name
        - token
      title: ApiKeyWithTokenResponse
      type: object
    ProblemDetail:
      description: >-
        RFC 9457 application/problem+json-Fehlertext für die v3-API.


        detail wird aus dem Legacy-Body {"detail": ...} aus Gründen der
        Abwärtskompatibilität beibehalten; die

        anderen Member sind additiv. errors enthält Validierungsfehler auf
        Feldebene

        (nur 422).
      properties:
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: Eine menschenlesbare Erklärung, die speziell für diesen Fall gilt.
          title: Detail
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: Validierungsfehler auf Feldebene (nur bei 422-Antworten).
          title: Errors
        instance:
          anyOf:
            - type: string
            - type: 'null'
          description: Eine URI-Referenz (der Anfragepfad) für diesen Fall.
          title: Instance
        status:
          description: Der HTTP-Statuscode.
          title: Status
          type: integer
        title:
          description: Eine kurze, menschenlesbare Zusammenfassung des Problemtyps.
          title: Title
          type: string
        type:
          default: about:blank
          description: Eine URI-Referenz, die den Problemtyp identifiziert.
          title: Type
          type: string
      required:
        - title
        - status
      title: ProblemDetail
      type: object
  securitySchemes:
    bearerAuth:
      description: 'Servicebenutzer-Anmeldedaten (Präfix: cog_)'
      scheme: bearer
      type: http

````