> ## 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.

# Create team API key

> Owner or admin only. The new key has only the campaigns:trigger scope. Save the raw key from this response because it is shown once.



## OpenAPI

````yaml /openapi.json post /api/v1/settings/team-api-keys
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:
    post:
      tags:
        - Team API keys
      summary: Create team API key
      description: >-
        Owner or admin only. The new key has only the campaigns:trigger scope.
        Save the raw key from this response because it is shown once.
      operationId: createTeamApiKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              additionalProperties: false
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 80
                expiresInDays:
                  type:
                    - integer
                    - 'null'
                  minimum: 1
                  maximum: 365
                  default: 90
                  description: Null creates a key without an expiry.
      responses:
        '201':
          description: Key created
          content:
            application/json:
              schema:
                type: object
                properties:
                  apiKey:
                    $ref: '#/components/schemas/TeamApiKey'
                  key:
                    type: string
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: Active key name already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  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:
    BadRequest:
      description: Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    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'
    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.

````