Quadrillion api-keys API

The api-keys API from Quadrillion — 3 operation(s) for api-keys.

OpenAPI Specification

quadrillion-api-keys-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Quadrillion Cloud account api-keys API
  description: Public cloud API service for cloud-safe backend endpoints
  version: 0.1.0
tags:
- name: api-keys
paths:
  /api/keys:
    get:
      tags:
      - api-keys
      summary: List Api Keys
      description: "List all API keys for the authenticated user.\n\nRequires: JWT token (session cookie or Authorization header)\n\nReturns:\n    [\n        {\n            \"id\": 123,\n            \"name\": \"Production Key\",\n            \"prefix\": \"qd_live_abc123\",\n            \"created_at\": \"2025-01-15T10:30:00Z\",\n            \"last_used\": \"2025-01-16T14:20:00Z\",\n            \"revoked\": false\n        }\n    ]\n\nNote: Full API keys are not returned for security."
      operationId: list_api_keys_api_keys_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ListKeyResponse'
                type: array
                title: Response List Api Keys Api Keys Get
    post:
      tags:
      - api-keys
      summary: Create Api Key
      description: "Create a new API key for the authenticated user.\n\nRequires: JWT token (session cookie or Authorization header)\n\nRequest body:\n    {\n        \"name\": \"Production Key\"\n    }\n\nReturns:\n    {\n        \"id\": 123,\n        \"key\": \"qd_live_abc123...\",\n        \"name\": \"Production Key\",\n        \"created_at\": \"2025-01-15T10:30:00Z\",\n        \"warning\": \"Save this key now. You won't be able to see it again!\"\n    }\n\nNote: The full API key is only shown once. Store it securely!"
      operationId: create_api_key_api_keys_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateKeyRequest'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateKeyResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/keys/validate:
    post:
      tags:
      - api-keys
      summary: Validate Api Key
      description: "Validate an API key and check if it belongs to an associated user.\n\nRequest body:\n    {\n        \"key\": \"qd_live_abc123...\"\n    }\n\nReturns:\n    {\n        \"valid\": true\n    }\n\nNote: Returns true if the key is valid and not revoked, false otherwise."
      operationId: validate_api_key_api_keys_validate_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidateKeyRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateKeyResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/keys/{key_id}:
    delete:
      tags:
      - api-keys
      summary: Delete Api Key
      description: "Delete (revoke) an API key.\n\nRequires: JWT token (session cookie or Authorization header)\n\nPath parameters:\n    key_id: The ID of the API key to delete\n\nReturns:\n    204 No Content on success\n\nRaises:\n    404: If key not found or not owned by user"
      operationId: delete_api_key_api_keys__key_id__delete
      parameters:
      - name: key_id
        in: path
        required: true
        schema:
          type: integer
          title: Key Id
      responses:
        '204':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ValidateKeyResponse:
      properties:
        valid:
          type: boolean
          title: Valid
      type: object
      required:
      - valid
      title: ValidateKeyResponse
      description: Response model for API key validation.
    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
    ListKeyResponse:
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        prefix:
          type: string
          title: Prefix
        created_at:
          type: string
          title: Created At
        last_used:
          anyOf:
          - type: string
          - type: 'null'
          title: Last Used
        revoked:
          type: boolean
          title: Revoked
      type: object
      required:
      - id
      - name
      - prefix
      - created_at
      - last_used
      - revoked
      title: ListKeyResponse
      description: Response model for listing API keys.
    CreateKeyRequest:
      properties:
        name:
          type: string
          title: Name
      type: object
      required:
      - name
      title: CreateKeyRequest
      description: Request model for creating an API key.
    CreateKeyResponse:
      properties:
        id:
          type: integer
          title: Id
        key:
          type: string
          title: Key
        name:
          type: string
          title: Name
        created_at:
          type: string
          title: Created At
        warning:
          type: string
          title: Warning
          default: Save this key now. You won't be able to see it again!
      type: object
      required:
      - id
      - key
      - name
      - created_at
      title: CreateKeyResponse
      description: Response model for created API key.
    ValidateKeyRequest:
      properties:
        key:
          type: string
          title: Key
      type: object
      required:
      - key
      title: ValidateKeyRequest
      description: Request model for validating an API key.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError