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

# Post apiv1api keys



## OpenAPI

````yaml https://backend.aflux.ai/openapi post /api/v1/api-keys
openapi: 3.0.3
info:
  title: AdFlux Backend API
  version: v1
servers:
  - url: /
security: []
tags:
  - name: auth
  - name: users
  - name: uploads
  - name: projects
  - name: campaigns
  - name: placements
  - name: billing
  - name: payments
  - name: image-generations
paths:
  /api/v1/api-keys:
    post:
      tags:
        - api-keys
      operationId: apiKeysCreate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApiKeyRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedApiKey'
        default:
          $ref: '#/components/responses/DefaultError'
      security:
        - Bearer: []
components:
  schemas:
    CreateApiKeyRequest:
      type: object
      required:
        - name
        - resetPeriod
        - expiration
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        creditLimit:
          $ref: '#/components/schemas/MoneyAmount'
          nullable: true
        resetPeriod:
          $ref: '#/components/schemas/ApiKeyResetPeriod'
        expiration:
          $ref: '#/components/schemas/ApiKeyExpiration'
    CreatedApiKey:
      type: object
      required:
        - apiKey
        - plainKey
      properties:
        apiKey:
          $ref: '#/components/schemas/ApiKey'
        plainKey:
          type: string
          description: Full secret key shown only once at creation time.
    MoneyAmount:
      type: string
      pattern: ^-?\d+(\.\d{1,6})?$
      example: '125.500000'
    ApiKeyResetPeriod:
      type: string
      enum:
        - NO_LIMIT
        - DAILY
        - WEEKLY
        - MONTHLY
    ApiKeyExpiration:
      type: string
      enum:
        - NO_EXPIRATION
        - H_1
        - D_1
        - D_7
        - D_30
    ApiKey:
      type: object
      required:
        - id
        - name
        - prefix
        - status
        - resetPeriod
        - currentUsage
        - createdAt
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        prefix:
          type: string
        status:
          $ref: '#/components/schemas/ApiKeyStatus'
        creditLimit:
          $ref: '#/components/schemas/MoneyAmount'
          nullable: true
        resetPeriod:
          $ref: '#/components/schemas/ApiKeyResetPeriod'
        currentUsage:
          $ref: '#/components/schemas/MoneyAmount'
        expiresAt:
          type: string
          format: date-time
          nullable: true
        lastUsedAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
    ApiKeyStatus:
      type: string
      enum:
        - ACTIVE
        - DISABLED
        - EXPIRED
  responses:
    DefaultError:
      description: Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````