Compresr Admin API

The Admin API from Compresr — 18 operation(s) for admin.

OpenAPI Specification

compresr-admin-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Compresr Platform Admin API
  version: 1.0.0
tags:
- name: Admin
paths:
  /api/admin/users:
    get:
      tags:
      - Admin
      summary: Get Users
      description: 'Get all users with filtering and sorting.


        Uses UserListRequest schema for query parameters.

        Set skip_emails=true (default) for faster response in list views.'
      operationId: get_users_api_admin_users_get
      security:
      - HTTPBearer: []
      parameters:
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            maxLength: 100
            pattern: ^[a-zA-Z0-9\s\-@._]+$
          - type: 'null'
          title: Search
      - name: tier
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Tier
      - name: plan
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Plan
      - name: has_enterprise_key
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Has Enterprise Key
      - name: balance_min
        in: query
        required: false
        schema:
          anyOf:
          - type: number
          - type: 'null'
          title: Balance Min
      - name: balance_max
        in: query
        required: false
        schema:
          anyOf:
          - type: number
          - type: 'null'
          title: Balance Max
      - name: date_from
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Date From
      - name: date_to
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Date To
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 500
          minimum: 1
          default: 50
          title: Limit
      - name: sort_by
        in: query
        required: false
        schema:
          enum:
          - created_at
          - full_name
          - company_name
          - last_login
          - last_request_at
          - total_used_money
          - total_uploaded_money
          - lifetime_charges
          - current_remaining_credits
          - total_api_calls
          - tier
          - plan
          - prepaid_added
          - prepaid_balance
          - prepaid_spent
          - postpaid_paid
          - postpaid_unpaid
          - postpaid_current_month
          - total_requests
          - total_tokens
          type: string
          default: created_at
          title: Sort By
      - name: sort_order
        in: query
        required: false
        schema:
          enum:
          - asc
          - desc
          type: string
          default: desc
          title: Sort Order
      - name: skip_emails
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Skip Emails
      - name: include_admins
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Include Admins
      - name: include_pilots
        in: query
        required: false
        schema:
          type: boolean
          default: false
          title: Include Pilots
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserListResponse'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/users/sync:
    post:
      tags:
      - Admin
      summary: Sync Users
      description: 'Force sync users data from database.


        Clears all backend caches (email cache), flushes Redis usage stream to DB,

        and fetches fresh user data.

        Use this when you need to see the latest data that may be stale due to caching.'
      operationId: sync_users_api_admin_users_sync_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserListResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
      - HTTPBearer: []
  /api/admin/users/by-email/{email}:
    get:
      tags:
      - Admin
      summary: Get User By Email
      description: Get user details by email address.
      operationId: get_user_by_email_api_admin_users_by_email__email__get
      security:
      - HTTPBearer: []
      parameters:
      - name: email
        in: path
        required: true
        schema:
          type: string
          maxLength: 254
          pattern: ^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$
          title: Email
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserDetailsResponse'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/users/{user_id}:
    get:
      tags:
      - Admin
      summary: Get User Details
      description: Get detailed user information.
      operationId: get_user_details_api_admin_users__user_id__get
      security:
      - HTTPBearer: []
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          title: User Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserDetailsResponse'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Admin
      summary: Delete User
      description: 'Delete a user account with data retention.


        For enterprise accounts with unpaid invoices, returns 409 with billing details.

        A final invoice is auto-generated for unbilled current-month usage.

        Deletion proceeds only after all invoices are paid.'
      operationId: delete_user_api_admin_users__user_id__delete
      security:
      - HTTPBearer: []
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          title: User Id
      - name: reason
        in: query
        required: false
        schema:
          type: string
          maxLength: 500
          title: Reason
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    patch:
      tags:
      - Admin
      summary: Update User
      description: Update user profile information.
      operationId: update_user_api_admin_users__user_id__patch
      security:
      - HTTPBearer: []
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          title: User Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/users/{user_id}/analytics:
    get:
      tags:
      - Admin
      summary: Get User Analytics
      description: 'Get comprehensive analytics for a specific user.


        Includes:

        - Profile information

        - Financial summary (spending, credits, budget)

        - API usage statistics (calls, tokens, compression)

        - API keys list

        - Usage breakdown by model and request type'
      operationId: get_user_analytics_api_admin_users__user_id__analytics_get
      security:
      - HTTPBearer: []
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          title: User Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAnalyticsResponse'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/audit:
    get:
      tags:
      - Admin
      summary: Get Audit Logs
      description: 'Get audit logs.


        Uses AuditLogsRequest schema for query parameters.'
      operationId: get_audit_logs_api_admin_audit_get
      security:
      - HTTPBearer: []
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          title: Page
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 50
          title: Limit
      - name: action
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Action
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuditLogsResponse'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/stats:
    get:
      tags:
      - Admin
      summary: Get Admin Stats
      description: 'Get platform statistics for admin dashboard.


        - **period**: Time period (last_day, last_week, last_month, last_90_days, last_year, custom)

        - **start_date**: Start date for custom period (YYYY-MM-DD)

        - **end_date**: End date for custom period (YYYY-MM-DD)

        - **api_key_types**: Filter by API key types (comma-separated: demo, completion, compress)

        - **compression_models**: Filter by compression models (comma-separated)

        - **tiers**: Filter by customer tiers (comma-separated: tier1, tier2, tier3, tier4, tier5)'
      operationId: get_admin_stats_api_admin_stats_get
      security:
      - HTTPBearer: []
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: last_day, last_week, last_month, last_90_days, last_year, custom'
          default: last_day
          title: Period
        description: 'Time period: last_day, last_week, last_month, last_90_days, last_year, custom'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          - type: 'null'
          description: 'Start date for custom period (ISO format: YYYY-MM-DD)'
          title: Start Date
        description: 'Start date for custom period (ISO format: YYYY-MM-DD)'
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          - type: 'null'
          description: 'End date for custom period (ISO format: YYYY-MM-DD)'
          title: End Date
        description: 'End date for custom period (ISO format: YYYY-MM-DD)'
      - name: api_key_types
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Filter by API key types (comma-separated): demo, completion, compress, or None for all'
          title: Api Key Types
        description: 'Filter by API key types (comma-separated): demo, completion, compress, or None for all'
      - name: compression_models
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by compression models (comma-separated, e.g., americano, latte) or None for all
          title: Compression Models
        description: Filter by compression models (comma-separated, e.g., americano, latte) or None for all
      - name: tiers
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by customer tiers (comma-separated, e.g., tier1, tier2, tier3) or None for all
          title: Tiers
        description: Filter by customer tiers (comma-separated, e.g., tier1, tier2, tier3) or None for all
      - name: skip_cache
        in: query
        required: false
        schema:
          type: boolean
          description: 'Invalidate cache and fetch fresh from DB. (Legacy alias: refresh)'
          default: false
          title: Skip Cache
        description: 'Invalidate cache and fetch fresh from DB. (Legacy alias: refresh)'
      - name: refresh
        in: query
        required: false
        schema:
          type: boolean
          description: DEPRECATED — use skip_cache. Kept for backward compatibility.
          default: false
          title: Refresh
        description: DEPRECATED — use skip_cache. Kept for backward compatibility.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminStatsResponse'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/active-users:
    get:
      tags:
      - Admin
      summary: Get Daily Active Users
      description: 'Get the list of users who were active on a specific date.


        Returns user names, emails, and request counts for the given day.'
      operationId: get_daily_active_users_api_admin_active_users_get
      security:
      - HTTPBearer: []
      parameters:
      - name: date
        in: query
        required: true
        schema:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
          description: Date to get active users for (YYYY-MM-DD)
          title: Date
        description: Date to get active users for (YYYY-MM-DD)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DailyActiveUsersResponse'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/active-users-count:
    get:
      tags:
      - Admin
      summary: Get Active Users Count
      description: 'Distinct active users over the selected period (deduplicated across days).


        Lightweight companion to /admin/stats for the Daily Active Users card, whose

        headline must show true distinct users in the period rather than a sum of

        per-day counts (which double-counts users active on multiple days).'
      operationId: get_active_users_count_api_admin_active_users_count_get
      security:
      - HTTPBearer: []
      parameters:
      - name: period
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Time period: last_day, last_week, last_month, last_90_days, last_year, custom'
          default: last_month
          title: Period
        description: 'Time period: last_day, last_week, last_month, last_90_days, last_year, custom'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          - type: 'null'
          description: 'Start date for custom period (ISO format: YYYY-MM-DD)'
          title: Start Date
        description: 'Start date for custom period (ISO format: YYYY-MM-DD)'
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          - type: 'null'
          description: 'End date for custom period (ISO format: YYYY-MM-DD)'
          title: End Date
        description: 'End date for custom period (ISO format: YYYY-MM-DD)'
      - name: tiers
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by customer tiers (comma-separated, e.g., tier1, tier2, tier3) or None for all
          title: Tiers
        description: Filter by customer tiers (comma-separated, e.g., tier1, tier2, tier3) or None for all
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Active Users Count Api Admin Active Users Count Get
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/newsletter/subscribers:
    get:
      tags:
      - Admin
      summary: Get Newsletter Subscribers
      description: 'Get all newsletter subscribers (admin only).


        - **status**: Filter by subscription status (active/unsubscribed)'
      operationId: get_newsletter_subscribers_api_admin_newsletter_subscribers_get
      security:
      - HTTPBearer: []
      parameters:
      - name: status
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Filter by status: active, unsubscribed'
          title: Status
        description: 'Filter by status: active, unsubscribed'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NewsletterListResponse'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/newsletter/subscribers/{subscriber_id}:
    delete:
      tags:
      - Admin
      summary: Delete Newsletter Subscriber
      description: Delete a newsletter subscriber permanently.
      operationId: delete_newsletter_subscriber_api_admin_newsletter_subscribers__subscriber_id__delete
      security:
      - HTTPBearer: []
      parameters:
      - name: subscriber_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          title: Subscriber Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/downloads/stats:
    get:
      tags:
      - Admin
      summary: Get Download Stats
      description: 'Get product download statistics for admin dashboard.


        Tracks downloads of all Compresr products:

        - **gateway**: Context-Gateway CLI installs

        - **sdk_pypi**: Python SDK downloads (PyPI)

        - **extension_vscode**: VS Code extension installs


        Filters:

        - **period**: Time period (last_day, last_week, etc.)

        - **source**: Filter by specific product source'
      operationId: get_download_stats_api_admin_downloads_stats_get
      security:
      - HTTPBearer: []
      parameters:
      - name: period
        in: query
        required: false
        schema:
          type: string
          description: 'Time period: last_day, last_week, last_month, last_90_days, last_year, custom'
          default: last_week
          title: Period
        description: 'Time period: last_day, last_week, last_month, last_90_days, last_year, custom'
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Start date for custom period (ISO format: YYYY-MM-DD)'
          title: Start Date
        description: 'Start date for custom period (ISO format: YYYY-MM-DD)'
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'End date for custom period (ISO format: YYYY-MM-DD)'
          title: End Date
        description: 'End date for custom period (ISO format: YYYY-MM-DD)'
      - name: source
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Filter by source: gateway, sdk_pypi, extension_vscode (or None for all)'
          title: Source
        description: 'Filter by source: gateway, sdk_pypi, extension_vscode (or None for all)'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DownloadStatsResponse'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/enterprise/billing:
    get:
      tags:
      - Admin
      summary: Get Enterprise Billing
      description: 'Get enterprise billing dashboard data.


        Returns all enterprise keys with their billing details:

        - Summary cards: total paid, unpaid, current month usage

        - List of enterprise keys with invoices


        Admin/pilot accounts are excluded by default (same rule as the admin users

        list); flip include_admins / include_pilots to bring them back in.'
      operationId: get_enterprise_billing_api_admin_enterprise_billing_get
      security:
      - HTTPBearer: []
      parameters:
      - name: include_admins
        in: query
        required: false
        schema:
          type: boolean
          description: Include internal/admin-owned enterprise keys
          default: false
          title: Include Admins
        description: Include internal/admin-owned enterprise keys
      - name: include_pilots
        in: query
        required: false
        schema:
          type: boolean
          description: Include pilot accounts (e.g. Thomson Reuters, Character)
          default: false
          title: Include Pilots
        description: Include pilot accounts (e.g. Thomson Reuters, Character)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnterpriseBillingResponse'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/enterprise/pending:
    get:
      tags:
      - Admin
      summary: List Pending Enterprise Keys
      description: 'List all pending enterprise keys awaiting admin approval.


        Returns enterprise keys with status=''pending'' that need admin review.

        Includes user info, company name, request message, and expected usage.'
      operationId: list_pending_enterprise_keys_api_admin_enterprise_pending_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PendingEnterpriseKeysResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
      - HTTPBearer: []
  /api/admin/enterprise/{key_id}/approve:
    put:
      tags:
      - Admin
      summary: Approve Enterprise Key
      description: 'Approve a pending enterprise key (Admin only).


        Once approved:

        - Key status changes to ''active''

        - User can start using the key with postpaid billing

        - Credit limit is set (default or custom)


        Optionally override the credit limit.'
      operationId: approve_enterprise_key_api_admin_enterprise__key_id__approve_put
      security:
      - HTTPBearer: []
      parameters:
      - name: key_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          title: Key Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnterpriseKeyApprovalRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnterpriseKeyApprovalResponse'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/admin/enterprise/{key_id}/decline:
    put:
      tags:
      - Admin
      summary: Decline Enterprise Key
      description: 'Decline a pending enterprise key (Admin only).


        Once declined:

        - Key status changes to ''declined''

        - User is notified with the decline reason

        - Key cannot be used


        Provide a decline_reason to explain why.'
      operationId: decline_enterprise_key_api_admin_enterprise__key_id__decline_put
      security:
      - HTTPBearer: []
      parameters:
      - name: key_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          title: Key Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnterpriseKeyApprovalRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnterpriseKeyApprovalResponse'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorR

# --- truncated at 32 KB (79 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/compresr/refs/heads/main/openapi/compresr-admin-api-openapi.yml