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

# Create API Key

> Create a new API key. The full key is only returned once at creation time.



## OpenAPI

````yaml POST /user/api-keys
openapi: 3.1.0
info:
  title: FormBnB API
  version: 1.0.0
  description: API for FormBnB - Form backend as a service
servers:
  - url: https://api.formbnb.com
security: []
paths:
  /user/api-keys:
    post:
      tags:
        - User
        - API Keys
      summary: Create an API key
      description: >-
        Create a new API key. The full key is only returned once at creation
        time.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserApiKeyRequest'
      responses:
        '200':
          description: Created API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserApiKeyResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    CreateUserApiKeyRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 50
          description: API key name
      required:
        - name
    UserApiKeyResponse:
      type: object
      properties:
        apiKey:
          $ref: '#/components/schemas/UserApiKey'
      required:
        - apiKey
    UserErrorResponse:
      type: object
      properties:
        error:
          type: string
      required:
        - error
    UserApiKey:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        key:
          type: string
        created_at:
          type: string
        last_used:
          type: string
          nullable: true
      required:
        - id
        - name
        - key
        - created_at
        - last_used
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT or API Key
      description: >-
        Authentication using either a FormBnB session JWT (issued by /auth) or
        an API key (prefixed with sk_). Both token types are passed as Bearer
        tokens in the Authorization header.

````