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

# Rotate team API key

> Owner or admin only. Rotating invalidates the previous key immediately and returns the new raw key once. Revoked or expired keys cannot be rotated.



## OpenAPI

````yaml /openapi.json post /api/v1/settings/team-api-keys/{id}
openapi: 3.1.0
info:
  title: Nudgen Developer API
  version: 1.0.0
  description: >-
    REST API for contacts, campaigns, Lifetime triggers, sending domains, brand
    settings, and AI drafts. Most endpoints use a Personal Access Token;
    Lifetime triggers require a scoped team API key.
servers:
  - url: https://app.nudgen.net
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Identity
  - name: Contacts
  - name: Campaigns
  - name: Brand settings
  - name: AI
  - name: Team API keys
  - name: Sending domains
paths:
  /api/v1/settings/team-api-keys/{id}:
    parameters:
      - $ref: '#/components/parameters/Id'
    post:
      tags:
        - Team API keys
      summary: Rotate team API key
      description: >-
        Owner or admin only. Rotating invalidates the previous key immediately
        and returns the new raw key once. Revoked or expired keys cannot be
        rotated.
      operationId: rotateTeamApiKey
      responses:
        '200':
          description: Key rotated
          content:
            application/json:
              schema:
                type: object
                properties:
                  apiKey:
                    $ref: '#/components/schemas/TeamApiKey'
                  key:
                    type: string
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Key revoked or expired
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    Id:
      name: id
      in: path
      required: true
      schema:
        type: string
  schemas:
    TeamApiKey:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        keyPrefix:
          type: string
        scopes:
          type: array
          items:
            type: string
            enum:
              - campaigns:trigger
        lastUsedAt:
          type:
            - string
            - 'null'
          format: date-time
        expiresAt:
          type:
            - string
            - 'null'
          format: date-time
        revokedAt:
          type:
            - string
            - 'null'
          format: date-time
        createdAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
  responses:
    Unauthorized:
      description: Missing, invalid, revoked, or expired token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: The workspace cannot perform this write action
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimited:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: PAT
      description: Personal Access Token created from Settings -> API Keys.

````