> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dataraven.io/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 returned ONCE in the response.

**Required Role:** ADMIN or OWNER

**Security Note:** The `full_key` field is shown only in this response.
Store it securely -- it cannot be retrieved again.



## OpenAPI

````yaml POST /v1/teams/{team_id}/api-keys
openapi: 3.1.0
info:
  title: Data Raven API
  description: Cloud-to-cloud data transfer platform powered by RClone
  version: 0.5.0
servers: []
security: []
paths:
  /v1/teams/{team_id}/api-keys:
    post:
      tags:
        - API Keys
      summary: Create Api Key
      description: |-
        Create a new API key. The full key is returned ONCE in the response.

        **Required Role:** ADMIN or OWNER

        **Security Note:** The `full_key` field is shown only in this response.
        Store it securely -- it cannot be retrieved again.
      operationId: create_api_key_v1_teams__team_id__api_keys_post
      parameters:
        - name: team_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Team Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyCreateResponse'
        '400':
          description: Invalid API key data
        '402':
          description: Tier limit exceeded
        '409':
          description: API key with this name already exists
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ApiKeyCreate:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
          description: Human-readable name for the key
        scopes:
          items:
            type: string
          type: array
          title: Scopes
          description: Permission scopes, e.g. ['tasks:read', 'tasks:create']
          default: []
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
          description: Optional expiration timestamp (UTC). NULL = never expires.
      type: object
      required:
        - name
      title: ApiKeyCreate
      description: Schema for creating a new API key.
    ApiKeyCreateResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        key_id:
          type: string
          title: Key Id
        name:
          type: string
          title: Name
        full_key:
          type: string
          title: Full Key
          description: Full API key (dr_<key_id>_<secret>). Shown ONCE, save it now!
        scopes:
          items:
            type: string
          type: array
          title: Scopes
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
        created_at:
          type: string
          format: date-time
          title: Created At
        created_by:
          type: string
          format: uuid
          title: Created By
      type: object
      required:
        - id
        - key_id
        - name
        - full_key
        - scopes
        - expires_at
        - created_at
        - created_by
      title: ApiKeyCreateResponse
      description: |-
        Schema returned only at creation time -- includes the full key.

        The `full_key` field is shown ONCE and never stored or returned again.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````