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

# Create API key

> Creates a new API key. The secret is only returned once and cannot be retrieved later.



## OpenAPI

````yaml api-reference/v1/openapi.yaml post /v1/admin/api-keys
openapi: 3.1.0
info:
  title: Goods API
  version: 1.0.0
  description: >-
    API for Goods grocery operations - scanner app, admin dashboard, and
    customer features
  contact:
    name: Goods Team
    url: https://goods.app
servers:
  - url: http://localhost:3000
    description: Local development
  - url: https://dev.api.switchyard.run
    description: Development
  - url: https://api.switchyard.run
    description: Production
security: []
tags:
  - name: v1
    description: API v1 - unified domain-based endpoints
  - name: Scanner
    description: Scanner app endpoints for drivers and pickers
  - name: Sweeps
    description: Sweep management - retail store pickup operations
  - name: RFC Picks
    description: Ready-for-checkout picking operations
  - name: Inventory
    description: Inventory management and barcode lookup
  - name: Admin
    description: Admin dashboard endpoints
  - name: Orders
    description: Order management
  - name: Products
    description: Product catalog management
  - name: Notifications
    description: Push, email, SMS, and Slack notification management
paths:
  /v1/admin/api-keys:
    post:
      tags:
        - API Keys
      summary: Create API key
      description: >-
        Creates a new API key. The secret is only returned once and cannot be
        retrieved later.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 100
                description:
                  type: string
                  maxLength: 500
                scopes:
                  type: array
                  items:
                    type: string
                  default: []
                expires_at:
                  type: string
                  format: date-time
                staff_id:
                  type: string
                  format: uuid
              required:
                - name
      responses:
        '201':
          description: Created API key with secret
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  api_key:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      name:
                        type: string
                      key_prefix:
                        type: string
                      key_last_four:
                        type: string
                      staff_id:
                        type: string
                        format: uuid
                      description:
                        type: string
                        nullable: true
                      scopes:
                        type: array
                        items:
                          type: string
                      is_active:
                        type: boolean
                      expires_at:
                        type: string
                        nullable: true
                      last_used_at:
                        type: string
                        nullable: true
                      usage_count:
                        type: number
                      created_at:
                        type: string
                      updated_at:
                        type: string
                      revoked_at:
                        type: string
                        nullable: true
                      staff:
                        type: object
                        nullable: true
                        properties:
                          id:
                            type: string
                            format: uuid
                          email:
                            type: string
                          first_name:
                            type: string
                            nullable: true
                          last_name:
                            type: string
                            nullable: true
                        required:
                          - id
                          - email
                          - first_name
                          - last_name
                    required:
                      - id
                      - name
                      - key_prefix
                      - key_last_four
                      - staff_id
                      - description
                      - scopes
                      - is_active
                      - expires_at
                      - last_used_at
                      - usage_count
                      - created_at
                      - updated_at
                      - revoked_at
                      - staff
                  secret:
                    type: string
                required:
                  - success
                  - api_key
                  - secret

````