Maia-analytics internal API
The internal API from Maia-analytics — 50 operation(s) for internal.
The internal API from Maia-analytics — 50 operation(s) for internal.
openapi: 3.1.0
info:
title: MAIA Ah internal API
description: API for MAIA application (migrated from Firebase)
version: 0.1.0
tags:
- name: internal
paths:
/api/v1/internal/audit-log/:
get:
tags:
- internal
summary: List Audit Log
description: 'List admin audit log entries with optional filters.
Both from_date and to_date are inclusive. Because the client sends bare dates
(parsed by FastAPI as midnight UTC), to_date is shifted to end-of-day so that
entries logged any time on the selected date are included.'
operationId: list_audit_log_api_v1_internal_audit_log__get
security:
- FirebaseAuthMiddleware: []
parameters:
- name: target_type
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Target Type
- name: admin_user_id
in: query
required: false
schema:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Admin User Id
- name: target_id
in: query
required: false
schema:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Target Id
- name: action
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Action
- name: from_date
in: query
required: false
schema:
anyOf:
- type: string
format: date-time
- type: 'null'
title: From Date
- name: to_date
in: query
required: false
schema:
anyOf:
- type: string
format: date-time
- type: 'null'
title: To Date
- name: limit
in: query
required: false
schema:
type: integer
maximum: 100
minimum: 1
default: 50
title: Limit
- name: offset
in: query
required: false
schema:
type: integer
minimum: 0
default: 0
title: Offset
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminAuditLogListResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/example-projects/:
get:
tags:
- internal
summary: List Example Projects
description: List all example projects ordered by created_at.
operationId: list_example_projects_api_v1_internal_example_projects__get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminExampleProjectListResponse'
security:
- FirebaseAuthMiddleware: []
/api/v1/internal/example-projects/search:
get:
tags:
- internal
summary: Search Projects
description: List created projects in the admin's workspace for mark-as-example picker.
operationId: search_projects_api_v1_internal_example_projects_search_get
security:
- FirebaseAuthMiddleware: []
parameters:
- name: q
in: query
required: false
schema:
anyOf:
- type: string
maxLength: 200
- type: 'null'
title: Q
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProjectSearchResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/example-projects/search-all:
get:
tags:
- internal
summary: Search All Projects
description: List created projects across all workspaces for the admin duplicate-any picker.
operationId: search_all_projects_api_v1_internal_example_projects_search_all_get
security:
- FirebaseAuthMiddleware: []
parameters:
- name: q
in: query
required: false
schema:
anyOf:
- type: string
maxLength: 200
- type: 'null'
title: Q
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProjectSearchResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/example-projects/{project_id}/mark-example:
post:
tags:
- internal
summary: Mark As Example
description: Mark a project as an example project.
operationId: mark_as_example_api_v1_internal_example_projects__project_id__mark_example_post
security:
- FirebaseAuthMiddleware: []
parameters:
- name: project_id
in: path
required: true
schema:
type: string
format: uuid
title: Project Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminExampleProjectListItem'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/example-projects/{project_id}/unmark-example:
post:
tags:
- internal
summary: Unmark As Example
description: Unmark a project as an example (sets visibility to private).
operationId: unmark_as_example_api_v1_internal_example_projects__project_id__unmark_example_post
security:
- FirebaseAuthMiddleware: []
parameters:
- name: project_id
in: path
required: true
schema:
type: string
format: uuid
title: Project Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminExampleProjectListItem'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/example-projects/{project_id}/duplicate:
post:
tags:
- internal
summary: Duplicate Example Project
description: 'Deliver a curated project to a workspace.
Delivery is a durable cross-Neon-branch workflow: the response carries a
``workflow_id`` and the client tracks progress via the Recent duplications
panel (which polls the per-row status).'
operationId: duplicate_example_project_api_v1_internal_example_projects__project_id__duplicate_post
security:
- FirebaseAuthMiddleware: []
parameters:
- name: project_id
in: path
required: true
schema:
type: string
format: uuid
title: Project Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDuplicateProjectRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDuplicateProjectResponse'
'409':
description: The project covers counties the target workspace hasn't loaded; re-submit with acknowledge_missing_counties=true to deliver anyway.
content:
application/json:
schema:
$ref: '#/components/schemas/MissingCountyCoverageResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/example-projects/duplicate/{workflow_id}/status:
get:
tags:
- internal
summary: Get Duplicate Status
description: Poll a cross-branch delivery workflow's terminal state.
operationId: get_duplicate_status_api_v1_internal_example_projects_duplicate__workflow_id__status_get
security:
- FirebaseAuthMiddleware: []
parameters:
- name: workflow_id
in: path
required: true
schema:
type: string
title: Workflow Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDeliveryStatusResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/example-projects/duplications/recent:
get:
tags:
- internal
summary: List Recent Duplications
description: Recent duplications (newest first) for the admin tracker panel.
operationId: list_recent_duplications_api_v1_internal_example_projects_duplications_recent_get
security:
- FirebaseAuthMiddleware: []
parameters:
- name: limit
in: query
required: false
schema:
type: integer
maximum: 100
minimum: 1
default: 20
title: Limit
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDuplicationLogResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/example-projects/{project_id}/preview:
get:
tags:
- internal
summary: Get Project Preview
description: Get project preview with metadata and layer summary.
operationId: get_project_preview_api_v1_internal_example_projects__project_id__preview_get
security:
- FirebaseAuthMiddleware: []
parameters:
- name: project_id
in: path
required: true
schema:
type: string
format: uuid
title: Project Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProjectPreviewResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/feature-flags/:
get:
tags:
- internal
summary: List Feature Flags
description: List every registered feature toggle with its global default + override count.
operationId: list_feature_flags_api_v1_internal_feature_flags__get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/GlobalFeatureFlagsResponse'
security:
- FirebaseAuthMiddleware: []
/api/v1/internal/feature-flags/{key}/overrides:
get:
tags:
- internal
summary: List Feature Overrides
description: 'List the workspaces that override one feature (deviate from the global
default), with each workspace''s current value. Internal admin only.'
operationId: list_feature_overrides_api_v1_internal_feature_flags__key__overrides_get
security:
- FirebaseAuthMiddleware: []
parameters:
- name: key
in: path
required: true
schema:
type: string
title: Key
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureOverridesResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
tags:
- internal
summary: Reset Feature Overrides
description: Clear every per-workspace override for one feature. Internal admin only.
operationId: reset_feature_overrides_api_v1_internal_feature_flags__key__overrides_delete
security:
- FirebaseAuthMiddleware: []
parameters:
- name: key
in: path
required: true
schema:
type: string
title: Key
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ResetFeatureOverridesResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/feature-flags/{key}/default:
patch:
tags:
- internal
summary: Set Global Feature Default
description: 'Set the platform-wide default for one feature. Internal admin only.
Returns the refreshed flag list so the client reflects the new default
without a second round-trip.'
operationId: set_global_feature_default_api_v1_internal_feature_flags__key__default_patch
security:
- FirebaseAuthMiddleware: []
parameters:
- name: key
in: path
required: true
schema:
type: string
title: Key
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SetGlobalFlagDefaultRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/GlobalFeatureFlagsResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/geographies/:
get:
tags:
- internal
summary: List Available Geographies
description: Return US states with parcel coverage.
operationId: list_available_geographies_api_v1_internal_geographies__get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/GeographyOptionsResponse'
security:
- FirebaseAuthMiddleware: []
/api/v1/internal/knowledge:
get:
tags:
- internal
summary: List Knowledge Entries
description: 'List a target owner''s entries for a scope (user or workspace).
The ``require_internal`` injection is redundant with the router-level gate
today, but kept for symmetry with the mutating handlers so the read path
stays admin-gated even if this router is ever re-mounted standalone.'
operationId: list_knowledge_entries_api_v1_internal_knowledge_get
security:
- FirebaseAuthMiddleware: []
parameters:
- name: scope
in: query
required: true
schema:
$ref: '#/components/schemas/KnowledgeScope'
- name: owner_id
in: query
required: true
schema:
type: string
format: uuid
title: Owner Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/KnowledgeEntryResponse'
title: Response List Knowledge Entries Api V1 Internal Knowledge Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
post:
tags:
- internal
summary: Create Knowledge Entry
description: Create an entry at the requested scope for the target owner.
operationId: create_knowledge_entry_api_v1_internal_knowledge_post
security:
- FirebaseAuthMiddleware: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminKnowledgeCreateRequest'
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/KnowledgeEntryResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/knowledge/apply-run:
post:
tags:
- internal
summary: Apply Knowledge Run
description: 'Apply one populate-knowledge run atomically (all-or-nothing).
Writes are confined to the request''s workspace; every mutation carries the
run''s provenance in its audit metadata, and a run-marker audit row advances
the refresh cursor. Any invalid item rolls back the whole run.'
operationId: apply_knowledge_run_api_v1_internal_knowledge_apply_run_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminKnowledgeApplyRunRequest'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminKnowledgeApplyRunResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- FirebaseAuthMiddleware: []
/api/v1/internal/knowledge/run-cursor:
get:
tags:
- internal
summary: Get Knowledge Run Cursor
description: Read a workspace's populate-knowledge refresh cursor (newest run marker).
operationId: get_knowledge_run_cursor_api_v1_internal_knowledge_run_cursor_get
security:
- FirebaseAuthMiddleware: []
parameters:
- name: workspace_id
in: query
required: true
schema:
type: string
format: uuid
title: Workspace Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminKnowledgeRunCursorResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/knowledge/{entry_id}:
patch:
tags:
- internal
summary: Update Knowledge Entry
description: Replace any entry's title + content (admin override).
operationId: update_knowledge_entry_api_v1_internal_knowledge__entry_id__patch
security:
- FirebaseAuthMiddleware: []
parameters:
- name: entry_id
in: path
required: true
schema:
type: string
format: uuid
title: Entry Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminKnowledgeUpdateRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/KnowledgeEntryResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
tags:
- internal
summary: Delete Knowledge Entry
description: Delete any entry (admin override).
operationId: delete_knowledge_entry_api_v1_internal_knowledge__entry_id__delete
security:
- FirebaseAuthMiddleware: []
parameters:
- name: entry_id
in: path
required: true
schema:
type: string
format: uuid
title: Entry Id
responses:
'204':
description: Successful Response
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/projects/{project_id}/edit-session:
post:
tags:
- internal
summary: Start Edit Session
description: 'Begin an admin write-mode editing session on a user''s project.
Acquires the project editing lock for the admin (409 if another user holds
it) and records one EDIT_PROJECT_AS_ADMIN audit row. With ``force=true``
the holder is evicted instead of 409ing and the audit metadata records the
takeover. The client then navigates into the project with
``?admin_mode=write``.'
operationId: start_edit_session_api_v1_internal_projects__project_id__edit_session_post
security:
- FirebaseAuthMiddleware: []
parameters:
- name: project_id
in: path
required: true
schema:
type: string
format: uuid
title: Project Id
- name: force
in: query
required: false
schema:
type: boolean
default: false
title: Force
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ProjectLockStatus'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/skills/draft:
post:
tags:
- internal
summary: Draft System Skill
description: 'Draft a system skill from a plain-language prompt (LLM; no persistence).
Powers the admin "Build with MAIA" mode: the draft pre-fills the create form,
which staff review and save through the audited create path. ``current_*``
let ``prompt`` act as revision feedback on an existing draft.'
operationId: draft_system_skill_api_v1_internal_skills_draft_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSkillDraftRequest'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSkillDraftResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- FirebaseAuthMiddleware: []
/api/v1/internal/skills:
get:
tags:
- internal
summary: List System Skills
description: List every MAIA-curated (system) skill with its workspace-availability set.
operationId: list_system_skills_api_v1_internal_skills_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
items:
$ref: '#/components/schemas/AdminSkillResponse'
type: array
title: Response List System Skills Api V1 Internal Skills Get
security:
- FirebaseAuthMiddleware: []
post:
tags:
- internal
summary: Create System Skill
description: 'Create a curated (system) skill, available globally or to specific
workspaces, optionally flagged as a new-project starter.'
operationId: create_system_skill_api_v1_internal_skills_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSkillWriteRequest'
required: true
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSkillResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- FirebaseAuthMiddleware: []
/api/v1/internal/skills/for-owner:
get:
tags:
- internal
summary: List Owner Skills
description: 'List a specific user''s or workspace''s own skills (admin read-only view).
``scope`` must be ``user`` or ``workspace`` (system skills have no owner → 422).'
operationId: list_owner_skills_api_v1_internal_skills_for_owner_get
security:
- FirebaseAuthMiddleware: []
parameters:
- name: scope
in: query
required: true
schema:
$ref: '#/components/schemas/SkillScope'
- name: owner_id
in: query
required: true
schema:
type: string
format: uuid
title: Owner Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/SkillResponse'
title: Response List Owner Skills Api V1 Internal Skills For Owner Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/skills/{skill_id}:
patch:
tags:
- internal
summary: Update System Skill
description: 'Replace a curated skill''s content, starter flag, and availability.
``workspace_ids`` sets availability: empty makes it global, a set restricts
it to those workspaces.'
operationId: update_system_skill_api_v1_internal_skills__skill_id__patch
security:
- FirebaseAuthMiddleware: []
parameters:
- name: skill_id
in: path
required: true
schema:
type: string
format: uuid
title: Skill Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSkillWriteRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSkillResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
tags:
- internal
summary: Delete System Skill
description: Delete a system skill.
operationId: delete_system_skill_api_v1_internal_skills__skill_id__delete
security:
- FirebaseAuthMiddleware: []
parameters:
- name: skill_id
in: path
required: true
schema:
type: string
format: uuid
title: Skill Id
responses:
'204':
description: Successful Response
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/stats/:
get:
tags:
- internal
summary: Get Stats
description: Return summary statistics for the admin dashboard.
operationId: get_stats_api_v1_internal_stats__get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminStatsResponse'
security:
- FirebaseAuthMiddleware: []
/api/v1/internal/users/:
get:
tags:
- internal
summary: List Users
description: List all users with optional search by name or email.
operationId: list_users_api_v1_internal_users__get
security:
- FirebaseAuthMiddleware: []
parameters:
- name: search
in: query
required: false
schema:
anyOf:
- type: string
minLength: 1
maxLength: 200
- type: 'null'
title: Search
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUserListResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
post:
tags:
- internal
summary: Create User
description: Create a new user account with Firebase Auth and DB record.
operationId: create_user_api_v1_internal_users__post
security:
- FirebaseAuthMiddleware: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCreateUserRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUserDetailResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/internal/users/{user_id}:
get:
tags:
- internal
summary: Get User Detail
description: Get detailed user information.
operationId: get_user_detail_api_v1_internal_users__user_id__get
security:
- FirebaseAuthMiddleware: []
parameters:
- name: user_id
in: path
required: true
schema:
type: string
format: uuid
title: User Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUserDetailResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
patch:
tags:
- internal
summary: Update User
description: Update user profile fields.
operationId: update_user_api_v1_internal_users__user_id__patch
security:
- FirebaseAuthMiddleware: []
parameters:
- name: user_id
in: path
required: true
schema:
type: string
format: uuid
title: User Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUserUpdateRequest'
responses:
'200':
description: Succe
# --- truncated at 32 KB (118 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/maia-analytics/refs/heads/main/openapi/maia-analytics-internal-api-openapi.yml