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

# Create API key

> Create a new API key for the authenticated user.

Returns the API key only once - it cannot be retrieved again for security reasons.



## OpenAPI

````yaml /api-reference/openapi.json post /api-keys
openapi: 3.1.0
info:
  title: Aspect API
  description: Manage and search media in Aspect.
  version: 1.0.0
servers:
  - url: https://api.aspect.inc
security:
  - ApiKeyAuth: []
tags:
  - name: Users
  - name: API Keys
  - name: Workspaces
  - name: Projects
  - name: Directories
  - name: Assets
  - name: Attachments
  - name: Filesystem Items
  - name: Jobs
  - name: Collections
  - name: Comments
  - name: Search
  - name: Transcription
  - name: Metadata
  - name: Shares
  - name: Share Templates
  - name: Watermarks
paths:
  /api-keys:
    post:
      tags:
        - API Keys
      summary: Create API key
      description: >-
        Create a new API key for the authenticated user.


        Returns the API key only once - it cannot be retrieved again for
        security reasons.
      operationId: create_api_key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyCreateRequest'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyCreateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ApiKeyCreateRequest:
      properties:
        name:
          type: string
          title: Name
          description: Human-readable name for the API key
      type: object
      required:
        - name
      title: ApiKeyCreateRequest
      description: API request schema for creating an API key
    ApiKeyCreateResponse:
      properties:
        api_key:
          type: string
          title: Api Key
          description: The actual API key - only shown once!
        key_info:
          $ref: '#/components/schemas/ApiKeyGetResponse'
          description: Key metadata
      type: object
      required:
        - api_key
        - key_info
      title: ApiKeyCreateResponse
      description: >-
        API response schema returned after creating a new API key (includes the
        raw key once).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ApiKeyGetResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        key_prefix:
          type: string
          title: Key Prefix
        created:
          type: string
          format: date-time
          title: Created
        updated:
          type: string
          format: date-time
          title: Updated
        user_id:
          type: string
          format: uuid
          title: User Id
        last_used:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Used
      type: object
      required:
        - id
        - name
        - key_prefix
        - created
        - updated
        - user_id
        - last_used
      title: ApiKeyGetResponse
      description: >-
        API response schema for getting API key metadata (no sensitive key
        value).
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Aspect API key (sk_...) in Authorization header. 'Bearer ' optional.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.