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

# Rotate a database credential

> Generates a new credential and schedules existing credentials for deletion after the provided delay.




## OpenAPI

````yaml https://global.thenile.dev/openapi.yaml post /workspaces/{workspaceSlug}/databases/{databaseName}/credentials/rotate
openapi: 3.0.1
info:
  title: Nile ReST API
  description: Making SaaS chill.
  contact:
    email: support@thenile.dev
  version: 0.1.0-1133318
servers:
  - url: https://global.thenile.dev
security: []
paths:
  /workspaces/{workspaceSlug}/databases/{databaseName}/credentials/rotate:
    post:
      tags:
        - databases
        - authentication
        - credentials
      summary: Rotate a database credential
      description: >
        Generates a new credential and schedules existing credentials for
        deletion after the provided delay.
      operationId: rotateCredential
      parameters:
        - name: workspaceSlug
          in: path
          required: true
          schema:
            type: string
        - name: databaseName
          in: path
          required: true
          schema:
            type: string
        - name: tenantId
          in: query
          schema:
            type: string
        - name: internal
          in: query
          schema:
            type: boolean
            default: false
      requestBody:
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/RotateCredentialRequest'
      responses:
        default:
          description: default response
          content:
            application/json: {}
      security:
        - jwtBearerAuth: []
components:
  schemas:
    RotateCredentialRequest:
      type: object
      properties:
        delayOldSecretsExpirationHours:
          maximum: 720
          exclusiveMaximum: false
          minimum: 0
          exclusiveMinimum: false
          type: number
          format: double
        reason:
          type: string
  securitySchemes:
    jwtBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````