{"openapi":"3.1.0","info":{"title":"Aigon REST API","description":"Auto-generated REST API for Aigon bot ecosystem","version":"0.35"},"paths":{"/":{"get":{"tags":["info"],"summary":"Root","description":"Get API information.","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health":{"get":{"tags":["info"],"summary":"Health","description":"Health check endpoint.","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/diag/db":{"get":{"tags":["info","diagnostic"],"summary":"Diag Db","description":"Diagnostic endpoint to test database access modes.\n\nModes:\n- async: True async via native AsyncSession (non-blocking)\n- fake: Fake async via thread pool (current default for most code)\n- block: True blocking sync (blocks event loop - bad!)\n\nDoes a trivial SELECT 1 query and returns timing info.\nProtected with hardcoded token to prevent abuse.","operationId":"diag_db_diag_db_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","description":"Diagnostic token","title":"Token"},"description":"Diagnostic token"},{"name":"mode","in":"query","required":false,"schema":{"type":"string","description":"Mode: async, fake, block","default":"async","title":"Mode"},"description":"Mode: async, fake, block"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/filedb/files":{"get":{"tags":["filedb"],"summary":"List Files","description":"List files for user.","operationId":"list_files_filedb_files_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"system","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"System"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/filedb/files/id/{unique_id}":{"get":{"tags":["filedb"],"summary":"Read File By Unique Id","description":"Read a file by unique_id with optional version.\n\nVersion syntax:\n- None or 0: latest version\n- +N (e.g., 1, 2): specific version number\n- -N (e.g., -1, -2): relative to latest (-1 = previous)","operationId":"read_file_by_unique_id_filedb_files_id__unique_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"unique_id","in":"path","required":true,"schema":{"type":"string","title":"Unique Id"}},{"name":"version","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Version: +N for specific, -N for relative to latest","title":"Version"},"description":"Version: +N for specific, -N for relative to latest"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/filedb/files/{basename}":{"get":{"tags":["filedb"],"summary":"Read File","description":"Read a file by basename.","operationId":"read_file_filedb_files__basename__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"basename","in":"path","required":true,"schema":{"type":"string","title":"Basename"}},{"name":"system","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"System"}},{"name":"version","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["filedb"],"summary":"Write File","description":"Write content to an existing file with intelligent hash-based deduplication.\n\nThis endpoint implements smart content deduplication to optimize file storage:\n- Calculates MD5 hash of new content and compares with existing file\n- Identical content: Updates only timestamp, preserves version number\n- Different content: Creates new version as expected\n- Manages metadata automatically (created_at in additional_fields)\n- Optionally handles sharing in the same transaction\n\nDeduplication Response Patterns:\n- Same content: \"content unchanged, updated timestamp\" + deduplicated: true\n- Different content: \"updated to version N\" + deduplicated: false\n- Backward compatible: Works with files created before hash feature\n\nArgs:\n    basename: Base filename without extension\n    request: JSON body with:\n        - content (str): New file content\n        - system (bool): Access system namespace (superuser only)\n        - reshare (bool): Copy sharing from previous version\n        - share_with (list[int]): User IDs to share with\n\nReturns:\n    JSON response with:\n        - success: Operation success status\n        - message: Human-readable status message\n        - file_info: Complete file metadata including:\n            - version: Current version number\n            - updated_at: Timestamp (always updated)\n            - hash_MD5: Content hash\n            - deduplicated: Boolean deduplication flag\n            - shared_with: List of user IDs shared with\n\nRaises:\n    400: Bad Request (file doesn't exist, validation error)\n    403: Forbidden (system namespace access denied)\n    500: Internal Server Error","operationId":"write_file_filedb_files__basename__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"basename","in":"path","required":true,"schema":{"type":"string","title":"Basename"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Request"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["filedb"],"summary":"Delete File","description":"Delete a file.","operationId":"delete_file_filedb_files__basename__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"basename","in":"path","required":true,"schema":{"type":"string","title":"Basename"}},{"name":"system","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"System"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/filedb/files/{basename}/create":{"post":{"tags":["filedb"],"summary":"Create File","description":"Create a new file.","operationId":"create_file_filedb_files__basename__create_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"basename","in":"path","required":true,"schema":{"type":"string","title":"Basename"}},{"name":"system","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"System"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/filedb/files/{basename}/archive":{"post":{"tags":["filedb"],"summary":"Archive File","description":"Archive a file (set status to 'archived').\n\nArchived files are hidden from normal listings but preserved and can be restored.","operationId":"archive_file_filedb_files__basename__archive_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"basename","in":"path","required":true,"schema":{"type":"string","title":"Basename"}},{"name":"system","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"System"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/filedb/files/{basename}/unarchive":{"post":{"tags":["filedb"],"summary":"Unarchive File","description":"Restore archived or deleted file to active status.","operationId":"unarchive_file_filedb_files__basename__unarchive_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"basename","in":"path","required":true,"schema":{"type":"string","title":"Basename"}},{"name":"system","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"System"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/filedb/files/{basename}/share":{"post":{"tags":["filedb"],"summary":"Share File","description":"Share file with other users (owner only).\n\nRequest body:\n    user_ids: List of user IDs to share with\n    version: Specific version to share (optional, default: latest)\n    system: Use system namespace (default: false)","operationId":"share_file_filedb_files__basename__share_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"basename","in":"path","required":true,"schema":{"type":"string","title":"Basename"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Request"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/filedb/files/{basename}/unshare":{"post":{"tags":["filedb"],"summary":"Unshare File","description":"Remove ALL sharing from ALL versions of file (owner only).\n\nRequest body:\n    system: Use system namespace (default: false)","operationId":"unshare_file_filedb_files__basename__unshare_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"basename","in":"path","required":true,"schema":{"type":"string","title":"Basename"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"default":{},"title":"Request"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/filedb/shared":{"get":{"tags":["filedb"],"summary":"List Shared Files","description":"List files shared WITH current user (by others).","operationId":"list_shared_files_filedb_shared_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/filedb/sharing":{"get":{"tags":["filedb"],"summary":"List Files I Shared","description":"List files that current user has shared with others.","operationId":"list_files_i_shared_filedb_sharing_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"system","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"System"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/filedb/search":{"get":{"tags":["filedb"],"summary":"Search Files","description":"Search through FileDB files by content and/or filename with flexible constraints.\n\nProvides comprehensive search across files with configurable filtering:\n- Content search: Search within file content using query string\n- Filename search: Optional filename pattern matching with wildcards\n- Status filtering: Include current/archived/deleted files\n- Version control: Latest versions only or all versions\n- Content truncation: Limit returned content length\n- Namespace access: User or system files (superuser only)\n\nArgs:\n    query: Search query string for content matching\n    filename: Optional filename pattern with wildcards (*, ?)\n    include_current: Include active files in results\n    include_archived: Include archived files in results\n    include_deleted: Include deleted files in results\n    include_all_versions: Include all versions, not just latest\n    limit: Maximum number of results to return\n    max_content_length: Maximum content length to return (-1 = no limit)\n    system: Access system namespace (superuser only)\n    user_id_pk_int: Authenticated user database primary key (integer)\n\nReturns:\n    JSON response with:\n        - success: Search success status\n        - search_query: Original query string\n        - filename_pattern: Filename pattern used (if provided)\n        - matches_found: Array of matching files with metadata\n        - total_matches: Total number of matches before limit\n        - showing: Number of results in response\n        - constraints: Applied search constraints\n\nRaises:\n    400: Bad Request (empty query)\n    403: Forbidden (system namespace access denied)\n    500: Internal Server Error","operationId":"search_files_filedb_search_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"query","in":"query","required":true,"schema":{"type":"string","description":"Search query string","title":"Query"},"description":"Search query string"},{"name":"filename","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filename pattern with wildcards (*, ?) - optional","title":"Filename"},"description":"Filename pattern with wildcards (*, ?) - optional"},{"name":"include_current","in":"query","required":false,"schema":{"type":"boolean","description":"Include active files","default":true,"title":"Include Current"},"description":"Include active files"},{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean","description":"Include archived files","default":false,"title":"Include Archived"},"description":"Include archived files"},{"name":"include_deleted","in":"query","required":false,"schema":{"type":"boolean","description":"Include deleted files","default":false,"title":"Include Deleted"},"description":"Include deleted files"},{"name":"include_all_versions","in":"query","required":false,"schema":{"type":"boolean","description":"Include all versions, not just latest","default":false,"title":"Include All Versions"},"description":"Include all versions, not just latest"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","description":"Maximum number of results","default":10,"title":"Limit"},"description":"Maximum number of results"},{"name":"max_content_length","in":"query","required":false,"schema":{"type":"integer","description":"Maximum content length, -1 for no limit","default":-1,"title":"Max Content Length"},"description":"Maximum content length, -1 for no limit"},{"name":"system","in":"query","required":false,"schema":{"type":"boolean","description":"Search in system namespace (superuser only)","default":false,"title":"System"},"description":"Search in system namespace (superuser only)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mailbox/send":{"post":{"tags":["mailbox"],"summary":"Send Email","description":"Send a new email from the user's mailbox.\n\nBody:\n    to: Recipient email address\n    subject: Email subject\n    text: Plain text body (or use markdown)\n    markdown: Markdown body (auto-generates text and html)\n    delay: Minutes to delay sending (default: 5). Use 0 for immediate.\n    cc: Optional CC recipients (string or list)\n    bcc: Optional BCC recipients (string or list)","operationId":"send_email_mailbox_send_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Send Email Mailbox Send Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/mailbox/reply":{"post":{"tags":["mailbox"],"summary":"Reply To Email","description":"Reply to a received email by note unique_id.\n\nBody:\n    unique_id: Unique ID (or prefix) of the note to reply to\n    text: Plain text reply body (or use markdown)\n    markdown: Markdown reply body (auto-generates text and html)\n    delay: Minutes to delay sending (default: 5). Use 0 for immediate.\n    bcc: Optional BCC recipients (string or list)","operationId":"reply_to_email_mailbox_reply_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Reply To Email Mailbox Reply Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/notetaker/search":{"get":{"tags":["notetaker"],"summary":"Search Notes","description":"Search across notes and attachments.\n\nUses PostgreSQL FTS, ILIKE, and pg_trgm similarity.\nResults are note-centric: primary ID is always the note,\nwith match locations showing where matches were found.\n\nStrategies: fts, ilike, similarity, vector, hybrid (default), all.\nResponse includes match_types (which methods matched) and scores (per-method scores).","operationId":"search_notes_notetaker_search_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"query","in":"query","required":true,"schema":{"type":"string","description":"Search terms (websearch syntax: 'phrase', OR, -exclude)","title":"Query"},"description":"Search terms (websearch syntax: 'phrase', OR, -exclude)"},{"name":"strategy","in":"query","required":false,"schema":{"type":"string","description":"Search strategy preset: fts, ilike, similarity, vector, hybrid, all","default":"hybrid","title":"Strategy"},"description":"Search strategy preset: fts, ilike, similarity, vector, hybrid, all"},{"name":"mode","in":"query","required":false,"schema":{"$ref":"#/components/schemas/SearchMode","description":"FTS query parsing: plain, phrase, websearch, raw","default":"websearch"},"description":"FTS query parsing: plain, phrase, websearch, raw"},{"name":"similarity_threshold","in":"query","required":false,"schema":{"type":"number","maximum":1.0,"minimum":0.0,"description":"Minimum pg_trgm similarity score","default":0.3,"title":"Similarity Threshold"},"description":"Minimum pg_trgm similarity score"},{"name":"format","in":"query","required":false,"schema":{"$ref":"#/components/schemas/SearchFormat","description":"Response format: 'short' (IDs + relevance) or 'full' (everything + snippets)","default":"short"},"description":"Response format: 'short' (IDs + relevance) or 'full' (everything + snippets)"},{"name":"scope","in":"query","required":false,"schema":{"$ref":"#/components/schemas/SearchScope","description":"Search scope: 'notes', 'attachments', or 'all'","default":"all"},"description":"Search scope: 'notes', 'attachments', or 'all'"},{"name":"time_window_start","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Days back from now (None = all time)","title":"Time Window Start"},"description":"Days back from now (None = all time)"},{"name":"time_window_end","in":"query","required":false,"schema":{"type":"number","description":"Days back to end (0 = now)","default":0.0,"title":"Time Window End"},"description":"Days back to end (0 = now)"},{"name":"start_ts","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Absolute start timestamp (overrides window)","title":"Start Ts"},"description":"Absolute start timestamp (overrides window)"},{"name":"end_ts","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Absolute end timestamp (overrides window)","title":"End Ts"},"description":"Absolute end timestamp (overrides window)"},{"name":"time_field","in":"query","required":false,"schema":{"enum":["created","updated"],"type":"string","description":"'created' or 'updated'","default":"created","title":"Time Field"},"description":"'created' or 'updated'"},{"name":"note_type","in":"query","required":false,"schema":{"enum":["user","system","ephemeral","all"],"type":"string","description":"'user', 'system', 'ephemeral', or 'all'","default":"all","title":"Note Type"},"description":"'user', 'system', 'ephemeral', or 'all'"},{"name":"content_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated content types: text,image,audio,video,document","title":"Content Type"},"description":"Comma-separated content types: text,image,audio,video,document"},{"name":"file_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated file types: audio,voice,image,document,video,archive","title":"File Type"},"description":"Comma-separated file types: audio,voice,image,document,video,archive"},{"name":"mime_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated MIME types: text/markdown,text/x-python","title":"Mime Type"},"description":"Comma-separated MIME types: text/markdown,text/x-python"},{"name":"export_status","in":"query","required":false,"schema":{"enum":["all","exported","unexported"],"type":"string","description":"'all', 'exported', 'unexported'","default":"all","title":"Export Status"},"description":"'all', 'exported', 'unexported'"},{"name":"processed_status","in":"query","required":false,"schema":{"enum":["all","processed","unprocessed"],"type":"string","description":"'all', 'processed', 'unprocessed'","default":"all","title":"Processed Status"},"description":"'all', 'processed', 'unprocessed'"},{"name":"deleted_status","in":"query","required":false,"schema":{"enum":["active","deleted","all"],"type":"string","description":"'active', 'deleted', 'all'","default":"active","title":"Deleted Status"},"description":"'active', 'deleted', 'all'"},{"name":"agent","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^[a-zA-Z0-9_-]+$"},{"type":"null"}],"description":"Filter by agent: notetaker, wellness, coach, etc.","title":"Agent"},"description":"Filter by agent: notetaker, wellness, coach, etc."},{"name":"include_delegated","in":"query","required":false,"schema":{"type":"boolean","description":"Include notes delegated to agent","default":true,"title":"Include Delegated"},"description":"Include notes delegated to agent"},{"name":"tags","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated tags to require (AND logic)","title":"Tags"},"description":"Comma-separated tags to require (AND logic)"},{"name":"exclude_tags","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated tags to exclude","title":"Exclude Tags"},"description":"Comma-separated tags to exclude"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"description":"Max results (1-500)","default":20,"title":"Limit"},"description":"Max results (1-500)"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Skip first N results","default":0,"title":"Offset"},"description":"Skip first N results"},{"name":"order_by","in":"query","required":false,"schema":{"$ref":"#/components/schemas/OrderBy","description":"'relevance', 'created', 'updated'","default":"relevance"},"description":"'relevance', 'created', 'updated'"},{"name":"order_dir","in":"query","required":false,"schema":{"$ref":"#/components/schemas/OrderDir","description":"'desc', 'asc'","default":"desc"},"description":"'desc', 'asc'"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/notetaker/notes/{unique_id}":{"get":{"tags":["notetaker"],"summary":"Get Note By Id","description":"Get note(s) by unique_id (supports prefix matching, minimum 2 characters).\n\nAuthorization: Returns notes if user owns them OR is event admin for note owner.\nEvent admin access is automatic - no explicit event parameter needed.","operationId":"get_note_by_id_notetaker_notes__unique_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"unique_id","in":"path","required":true,"schema":{"type":"string","title":"Unique Id"}},{"name":"context_before","in":"query","required":false,"schema":{"type":"integer","description":"Number of notes before to include","default":0,"title":"Context Before"},"description":"Number of notes before to include"},{"name":"context_after","in":"query","required":false,"schema":{"type":"integer","description":"Number of notes after to include","default":0,"title":"Context After"},"description":"Number of notes after to include"},{"name":"with_attachments","in":"query","required":false,"schema":{"type":"boolean","description":"Include attachment metadata","default":false,"title":"With Attachments"},"description":"Include attachment metadata"},{"name":"with_share_signature","in":"query","required":false,"schema":{"type":"boolean","description":"Include share_signature for public sharing URLs","default":false,"title":"With Share Signature"},"description":"Include share_signature for public sharing URLs"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/notetaker/notes":{"post":{"tags":["notetaker"],"summary":"Retrieve Notes","description":"Universal retrieval endpoint: get by unique_ids OR filtered retrieval.\n\nMode 1 - Get by unique_ids (with optional context):\n  {\n    \"unique_ids\": [\"aB1C2D\", \"cD3\"],\n    \"context_before\": 0,\n    \"context_after\": 0\n  }\n\nMode 2 - Filtered retrieval (when no unique_ids):\n  {\n    \"time_window_start\": 1.0,\n    \"time_window_end\": 0.0,\n    \"start_ts\": null,\n    \"end_ts\": null,\n    \"time_field\": null,\n    \"processed_status\": \"unprocessed\",\n    \"export_status\": \"all\",\n    \"note_type\": \"user\",\n    \"limit\": 10,\n    \"reverse\": false,\n    \"max_content_length\": -1,\n    \"max_bytes\": -1,\n    \"mark_as_exported\": false,\n    \"mark_as_processed\": false,\n    \"event\": null\n  }\n\nNotes:\n- unique_ids cannot be combined with filter parameters.\n- note_type: \"user\" (default), \"system\", or \"all\"\n- start_ts/end_ts (Unix timestamps) override time_window_start/end if provided\n- time_field: \"created\" or \"updated\". Default: \"created\" for absolute, \"updated\" for relative.\n- Marking parameters (mark_as_exported, mark_as_processed) only work in filtered retrieval mode.\n- max_bytes limits total response size; if exceeded, all content fields are replaced with \"(truncated)\"\n- max_bytes is for LLM context management (keeps metadata, removes content when response too large)\n- event: Event name to query participant notes (admin access only). Requesting user must be\n  event_admin. Empty results may indicate user is not authorized.","operationId":"retrieve_notes_notetaker_notes_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]},"patch":{"tags":["notetaker"],"summary":"Update Notes","description":"Bulk update note metadata: tags, summary, metadata, delegates.\n\nRequest body (Pydantic-validated):\n  {\n    \"unique_ids\": [\"aB1C2D\", \"cD3\"],          // Required, prefix-matched (min 2 chars)\n\n    // Tags (tags_set is mutually exclusive with tags_add/tags_remove)\n    \"tags_set\": [\"a\", \"b\"],                    // Replace all tags\n    \"tags_add\": [\"new_tag\"],                   // Append tags\n    \"tags_remove\": [\"old_tag\"],                // Remove tags\n\n    // Summary\n    \"summary\": \"new summary\",                  // Set summary (empty string = clear)\n\n    // Metadata (metadata_set is mutually exclusive with metadata_merge/metadata_remove_keys)\n    \"metadata_set\": {\"key\": \"value\"},          // Replace entire metadata\n    \"metadata_merge\": {\"key\": \"value\"},        // Upsert keys\n    \"metadata_remove_keys\": [\"key1\", \"key2\"],  // Delete specific keys\n\n    // Delegates\n    \"delegates_add\": [\"coach\", \"wellness\"],\n    \"delegates_remove\": [\"flat\"]\n  }\n\nAt least one update operation must be specified.","operationId":"update_notes_notetaker_notes_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteUpdateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/notetaker/notes/mark":{"post":{"tags":["notetaker"],"summary":"Mark Notes","description":"Mark or unmark notes as processed, exported, and/or deleted.\n\nRequest body:\n  {\n    \"unique_ids\": [\"aB1C2D\", \"cD3\"],     // Required\n    \"processed\": true/false/null,         // Optional - true=mark, false=unmark, null=no change\n    \"exported\": true/false/null,          // Optional - true=mark, false=unmark, null=no change\n    \"deleted\": true/false/null            // Optional - true=delete, false=undelete, null=no change\n  }\n\nThe flags are independent. Setting one does not affect the others.","operationId":"mark_notes_notetaker_notes_mark_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/notetaker/notes/{note_id}/save":{"post":{"tags":["notetaker"],"summary":"Save Ephemeral Note","description":"Convert ephemeral note to permanent system note (save it).\n\nTakes an ephemeral note (like a live report) and converts it to a\npermanent system note, removing the auto-cleanup expiry.\n\nPath parameter:\n  note_id: Note database ID\n\nRequest body (optional):\n  {\n    \"duplicate\": false  // If true, create new note and mark original deleted\n                        // If false (default), convert in-place\n  }\n\nOnly the note owner can save their ephemeral notes.","operationId":"save_ephemeral_note_notetaker_notes__note_id__save_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"note_id","in":"path","required":true,"schema":{"type":"integer","title":"Note Id"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Request"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/notetaker/reports":{"post":{"tags":["notetaker"],"summary":"Get Reports","description":"Get reports (system notes) with simplified interface.\n\nThis endpoint abstracts away the storage details of reports. Callers\ndon't need to know that reports are stored as system notes with metadata.\n\nRequest body (all optional):\n  {\n    \"agent\": \"notetaker\",           // Filter by agent: notetaker, diary, wellness, coach, agora\n    \"report_type\": \"daily\",         // Filter by report type: daily, weekly\n    \"time_window_start\": 365,       // Days back (default: 365)\n    \"limit\": 100,                   // Max results (default: 100)\n    \"with_attachments\": true,       // Include attachment metadata (default: true)\n    \"reverse\": true                 // Newest first (default: true)\n  }\n\nReturns reports with metadata fields:\n  - type: \"report\"\n  - generation: \"stored\" | \"live\" | \"ondemand\"\n  - agent: \"notetaker\" | \"diary\" | \"wellness\" | \"coach\" | \"agora\"\n  - report_type: \"daily\" | \"weekly\" | ...\n\nAgent values: notetaker, diary, wellness, coach, agora","operationId":"get_reports_notetaker_reports_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Request","default":{}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/notetaker/reports/summarize":{"post":{"tags":["notetaker"],"summary":"Post Summarize Notes","description":"Generate on-demand summary of specific notes.\n\nRequest body:\n  {\n    \"unique_ids\": [\"abc123\", \"def456\", ...],  // Required, 1-100 IDs\n    \"user_instructions\": \"...\"                 // Optional\n  }\n\nReturns stored note info (same schema as other reports).","operationId":"post_summarize_notes_notetaker_reports_summarize_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/notetaker/reports/generate":{"post":{"tags":["notetaker"],"summary":"Generate Report","description":"Generate a live report on-demand.\n\nRequest body:\n  {\n    \"agent\": \"notetaker\",       // Required: agent name\n    \"report_type\": \"today\"      // Required: report type (today, daily_summary)\n  }\n\nReturns report dict with content, attachment_content (markdown), metadata.","operationId":"generate_report_notetaker_reports_generate_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/notetaker/pagecapture/reports/verbatim":{"post":{"tags":["notetaker"],"summary":"Generate Pagecapture Verbatim","description":"Generate a pagecapture light or verbatim (pro) report.\n\nRequest body — two mutually exclusive modes:\n  Time-window mode (default):\n    {\"hours\": 24, \"report_type\": \"light\" | \"pro\"}\n  Explicit-id mode (used by the /capture results-mode buttons):\n    {\"unique_ids\": [\"...\", \"...\"], \"report_type\": \"light\" | \"pro\"}\n\nIf both `unique_ids` and `hours` are provided, `unique_ids` wins.\nReturns dict with unique_id, attachment_details, note_count.","operationId":"generate_pagecapture_verbatim_notetaker_pagecapture_reports_verbatim_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/notetaker/pagecapture/search/fts":{"post":{"tags":["notetaker"],"summary":"Pagecapture Fts Search","description":"FTS search over this user's pagecapture notes. Immediately starts a background report build.\n\nRequest body: {\"query\": \"...\", \"limit\": N}\nReturns {unique_ids, total_count, truncated, report_id, report_share_signature}.\nreport_id is null when the query returned no results.","operationId":"pagecapture_fts_search_notetaker_pagecapture_search_fts_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/notetaker/pagecapture/search/ai":{"post":{"tags":["notetaker"],"summary":"Pagecapture Ai Search","description":"Basic AI search over this user's pagecapture notes. Immediately starts a background report build.\n\nRequest body: {\"query\": \"...\"}\nReturns AISearchResult fields plus report_id and report_share_signature.","operationId":"pagecapture_ai_search_notetaker_pagecapture_search_ai_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/notetaker/pagecapture/search/ai/strategic":{"post":{"tags":["notetaker"],"summary":"Pagecapture Ai Strategic Search","description":"Strategic AI search over this user's pagecapture notes. Immediately starts a background report build.\n\nRequest body: {\"query\": \"...\"}\nReturns AISearchResult fields plus report_id and report_share_signature.","operationId":"pagecapture_ai_strategic_search_notetaker_pagecapture_search_ai_strategic_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/notetaker/reports/save":{"post":{"tags":["notetaker"],"summary":"Save Report","description":"Save a user-provided report as a system note.\n\nRequest body:\n  {\n    \"content\": \"markdown content...\",  // Required (may include YAML frontmatter)\n    \"agent\": \"notetaker\",              // Optional (from frontmatter if not provided)\n    \"report_type\": \"user\",             // Optional (default: user)\n    \"date\": \"2026-01-10\",              // Optional (ISO date, from frontmatter or now)\n    \"event\": \"hackathon\",              // Optional (event name for visibility)\n    \"visible_to_participants\": true    // Optional (if true, participants can see)\n  }\n\nPriority for metadata: flag > frontmatter > default\n\nReturns saved note info with unique_id.","operationId":"save_report_notetaker_reports_save_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/events/{event_id}/summary":{"get":{"tags":["events"],"summary":"Get Event Summary","description":"Get live event summary (event admins only).\n\nGenerates a summary aggregating notes from all participants in an event.\nOnly event administrators can access this endpoint.\n\nArgs:\n    event_id: Event identifier (must match user's event)\n    time_window_days: Number of days to look back for notes\n    current_user: Authenticated user (via JWT token)\n\nReturns:\n    JSON with markdown report, event_id, time_window_days, generated_at\n\nRaises:\n    404: User not found\n    403: Not an event administrator or wrong event\n    500: Report generation error","operationId":"get_event_summary_events__event_id__summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"event_id","in":"path","required":true,"schema":{"type":"string","title":"Event Id"}},{"name":"time_window_days","in":"query","required":false,"schema":{"type":"integer","description":"Number of days to look back","default":7,"title":"Time Window Days"},"description":"Number of days to look back"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/provision":{"post":{"tags":["users"],"summary":"Provision User","description":"Provision a new A1-only user in the auth.users table.\n\nThis endpoint creates or updates a user record mapping an A1 user ID\nto a shared database user ID. It's idempotent - returns existing user\nif already provisioned.\n\nRequires provision token: provision::{APP_FS_SERVER_SECRET}::{a1_user_int_id}\n\nArgs:\n    event: Optional event/campaign identifier to add to user's events list\n    first_name: Optional first name for the user\n    last_name: Optional last name for the user\n    tier_name: Optional user tier name (e.g., 'free', 'beta', 'event')\n    current_user: Authenticated user (requires provision token)\n\nReturns:\n    JSON with success, user_id_pk_int, user_id\n\nRaises:\n    403: Not a provision token\n    500: Database error during provisioning","operationId":"provision_user_users_provision_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"event","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Event name","title":"Event"},"description":"Event name"},{"name":"first_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User first name","title":"First Name"},"description":"User first name"},{"name":"last_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User last name","title":"Last Name"},"description":"User last name"},{"name":"tier_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tier name","title":"Tier Name"},"description":"Tier name"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/attachment/{attachment_id}:{sig}":{"get":{"tags":["public"],"summary":"Get Attachment Public","description":"Get attachment content via signature-based authentication.","operationId":"get_attachment_public_public_attachment__attachment_id___sig__get","parameters":[{"name":"attachment_id","in":"path","required":true,"schema":{"type":"string","title":"Attachment Id"}},{"name":"sig","in":"path","required":true,"schema":{"type":"string","title":"Sig"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/preview/{attachment_id}:{sig}":{"get":{"tags":["public"],"summary":"Get Preview Public","description":"Get attachment preview via signature-based authentication.","operationId":"get_preview_public_public_preview__attachment_id___sig__get","parameters":[{"name":"attachment_id","in":"path","required":true,"schema":{"type":"string","title":"Attachment Id"}},{"name":"sig","in":"path","required":true,"schema":{"type":"string","title":"Sig"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/thumbnail/{attachment_id}:{sig}":{"get":{"tags":["public"],"summary":"Get Thumbnail Public","description":"Get attachment thumbnail via signature-based authentication.","operationId":"get_thumbnail_public_public_thumbnail__attachment_id___sig__get","parameters":[{"name":"attachment_id","in":"path","required":true,"schema":{"type":"string","title":"Attachment Id"}},{"name":"sig","in":"path","required":true,"schema":{"type":"string","title":"Sig"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/note/{note_id}:{sig}":{"get":{"tags":["public"],"summary":"Get Note Public","description":"Get note as JSON via signature-based authentication.","operationId":"get_note_public_public_note__note_id___sig__get","parameters":[{"name":"note_id","in":"path","required":true,"schema":{"type":"string","title":"Note Id"}},{"name":"sig","in":"path","required":true,"schema":{"type":"string","title":"Sig"}},{"name":"with_attachments","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"With Attachments"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/report/{report_id}:{sig}":{"get":{"tags":["public"],"summary":"Get Report Public","description":"Get report as JSON via signature-based authentication.\n\nSame as /public/note/ but validates metadata.type == \"report\".","operationId":"get_report_public_public_report__report_id___sig__get","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","title":"Report Id"}},{"name":"sig","in":"path","required":true,"schema":{"type":"string","title":"Sig"}},{"name":"with_attachments","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"With Attachments"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/private/attachment/{unique_id}":{"get":{"tags":["private"],"summary":"Get Attachment Private","description":"Get attachment content by unique_id (supports prefix matching).","operationId":"get_attachment_private_private_attachment__unique_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"unique_id","in":"path","required":true,"schema":{"type":"string","title":"Unique Id"}},{"name":"agent","in":"query","required":false,"schema":{"type":"string","default":"*","title":"Agent"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/private/preview/{unique_id}":{"get":{"tags":["private"],"summary":"Get Preview Private","description":"Get attachment preview by unique_id.","operationId":"get_preview_private_private_preview__unique_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"unique_id","in":"path","required":true,"schema":{"type":"string","title":"Unique Id"}},{"name":"agent","in":"query","required":false,"schema":{"type":"string","default":"*","title":"Agent"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/private/thumbnail/{unique_id}":{"get":{"tags":["private"],"summary":"Get Thumbnail Private","description":"Get attachment thumbnail by unique_id.","operationId":"get_thumbnail_private_private_thumbnail__unique_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"unique_id","in":"path","required":true,"schema":{"type":"string","title":"Unique Id"}},{"name":"agent","in":"query","required":false,"schema":{"type":"string","default":"*","title":"Agent"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/private/note/{unique_id}":{"get":{"tags":["private"],"summary":"Get Note Private","description":"Get note as JSON by unique_id.","operationId":"get_note_private_private_note__unique_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"unique_id","in":"path","required":true,"schema":{"type":"string","title":"Unique Id"}},{"name":"with_attachments","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"With Attachments"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/private/report/{unique_id}":{"get":{"tags":["private"],"summary":"Get Report Private","description":"Get report as JSON by unique_id. Validates metadata.type == 'report'.","operationId":"get_report_private_private_report__unique_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"unique_id","in":"path","required":true,"schema":{"type":"string","title":"Unique Id"}},{"name":"with_attachments","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"With Attachments"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/download/{unique_id}":{"get":{"tags":["download"],"summary":"Download Resource","description":"Download note, attachment, or file by unique_id.\n\n**AUTHENTICATED**: Requires valid user token. Verifies user owns resource\nOR has event admin access (for notes/attachments).\n\nAuto-detects resource type from unique_id case pattern:\n- Note (lowercase): Returns JSON with metadata\n- Attachment (first lower, rest upper): Returns binary file\n- File (uppercase): Returns markdown text\n\nSupports version suffix for files: AB12345678+2, AB12345678-1","operationId":"download_resource_download__unique_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"unique_id","in":"path","required":true,"schema":{"type":"string","title":"Unique Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/raw/{uid}/{index}":{"get":{"tags":["raw"],"summary":"Get Raw","description":"Raw access to notes and attachments.\n\nWithout index: auto-detect by ID format.\n  - Note ID (lowercase) → note JSON with attachment metadata (no binary)\n  - Attachment ID (first lower, rest upper) → attachment binary\n\nWith index:\n  - /raw/{note_id}/0 → note JSON only (no attachments key)\n  - /raw/{note_id}/N → Nth attachment binary (1-indexed)","operationId":"get_raw_raw__uid___index__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","title":"Uid"}},{"name":"index","in":"path","required":true,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Index"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/raw/{uid}":{"get":{"tags":["raw"],"summary":"Get Raw","description":"Raw access to notes and attachments.\n\nWithout index: auto-detect by ID format.\n  - Note ID (lowercase) → note JSON with attachment metadata (no binary)\n  - Attachment ID (first lower, rest upper) → attachment binary\n\nWith index:\n  - /raw/{note_id}/0 → note JSON only (no attachments key)\n  - /raw/{note_id}/N → Nth attachment binary (1-indexed)","operationId":"get_raw_raw__uid__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","title":"Uid"}},{"name":"index","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Index"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/search":{"get":{"tags":["search"],"summary":"Global Search","description":"Global search across notes, attachments, and files.\n\nUses PostgreSQL FTS with websearch syntax (Google-style):\n- \"exact phrase\" for phrase matching\n- word1 OR word2 for alternatives\n- -word to exclude terms\n\nScopes control which resource types to search:\n- notes: User notes only\n- system: System notes only\n- attachments: Attachment content (OCR text)\n- files: FileDB files\n- all: Everything (default)\n\nResults can be returned in two groupings:\n- merged: Single list sorted by relevance (default)\n- grouped: Separate lists for notes, attachments, and files\n\nExamples:\n- /search?q=meeting - Search everything for \"meeting\"\n- /search?q=meeting&scope=notes - Notes only\n- /search?q=meeting&scope=notes,files - Notes and files\n- /search?q=\"team meeting\" OR standup - Phrase or word\n- /search?q=project -internal - Exclude \"internal\"\n- /search?q=meeting&grouping=grouped - Group by type","operationId":"global_search_search_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","description":"Search terms (websearch syntax: 'phrase', OR, -exclude)","title":"Q"},"description":"Search terms (websearch syntax: 'phrase', OR, -exclude)"},{"name":"scope","in":"query","required":false,"schema":{"type":"string","description":"Comma-separated: notes,system,attachments,files,all","default":"all","title":"Scope"},"description":"Comma-separated: notes,system,attachments,files,all"},{"name":"grouping","in":"query","required":false,"schema":{"$ref":"#/components/schemas/GlobalSearchGrouping","description":"'merged' (single list) or 'grouped' (by type)","default":"merged"},"description":"'merged' (single list) or 'grouped' (by type)"},{"name":"note_type","in":"query","required":false,"schema":{"enum":["user","system","ephemeral","all"],"type":"string","description":"'user', 'system', 'ephemeral', or 'all'","default":"all","title":"Note Type"},"description":"'user', 'system', 'ephemeral', or 'all'"},{"name":"file_versions","in":"query","required":false,"schema":{"enum":["latest","all"],"type":"string","description":"'latest' or 'all'","default":"latest","title":"File Versions"},"description":"'latest' or 'all'"},{"name":"time_window_start","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Days back from now (None = all time)","title":"Time Window Start"},"description":"Days back from now (None = all time)"},{"name":"time_window_end","in":"query","required":false,"schema":{"type":"number","description":"Days back to end (0 = now)","default":0.0,"title":"Time Window End"},"description":"Days back to end (0 = now)"},{"name":"start_ts","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Absolute start timestamp (overrides window)","title":"Start Ts"},"description":"Absolute start timestamp (overrides window)"},{"name":"end_ts","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Absolute end timestamp (overrides window)","title":"End Ts"},"description":"Absolute end timestamp (overrides window)"},{"name":"time_field","in":"query","required":false,"schema":{"enum":["created","updated"],"type":"string","description":"'created' or 'updated'","default":"created","title":"Time Field"},"description":"'created' or 'updated'"},{"name":"export_status","in":"query","required":false,"schema":{"enum":["all","exported","unexported"],"type":"string","description":"'all', 'exported', 'unexported'","default":"all","title":"Export Status"},"description":"'all', 'exported', 'unexported'"},{"name":"processed_status","in":"query","required":false,"schema":{"enum":["all","processed","unprocessed"],"type":"string","description":"'all', 'processed', 'unprocessed'","default":"all","title":"Processed Status"},"description":"'all', 'processed', 'unprocessed'"},{"name":"deleted_status","in":"query","required":false,"schema":{"enum":["active","deleted","all"],"type":"string","description":"'active', 'deleted', 'all'","default":"active","title":"Deleted Status"},"description":"'active', 'deleted', 'all'"},{"name":"agent","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^[a-zA-Z0-9_-]+$"},{"type":"null"}],"description":"Filter notes by agent: notetaker, wellness, coach, etc.","title":"Agent"},"description":"Filter notes by agent: notetaker, wellness, coach, etc."},{"name":"include_delegated","in":"query","required":false,"schema":{"type":"boolean","description":"Include notes delegated to agent","default":true,"title":"Include Delegated"},"description":"Include notes delegated to agent"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Max results (1-100)","default":50,"title":"Limit"},"description":"Max results (1-100)"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Skip first N results","default":0,"title":"Offset"},"description":"Skip first N results"},{"name":"order_by","in":"query","required":false,"schema":{"$ref":"#/components/schemas/GlobalSearchOrderBy","description":"'relevance', 'created', 'updated'","default":"relevance"},"description":"'relevance', 'created', 'updated'"},{"name":"order_dir","in":"query","required":false,"schema":{"$ref":"#/components/schemas/GlobalSearchOrderDir","description":"'desc', 'asc'","default":"desc"},"description":"'desc', 'asc'"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tokens/current":{"get":{"tags":["tokens"],"summary":"Get Current Token","description":"Get current API token info for authenticated user.\n\nReturns:\n    Dict with has_token, token, and last_changed fields","operationId":"get_current_token_tokens_current_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]},"delete":{"tags":["tokens"],"summary":"Delete Token","description":"Delete current API token for authenticated user.\n\nReturns:\n    Dict with success message","operationId":"delete_token_tokens_current_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/tokens/generate":{"post":{"tags":["tokens"],"summary":"Generate Token","description":"Generate or regenerate API token for authenticated user.\n\nReturns:\n    Dict with token and message","operationId":"generate_token_tokens_generate_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/transcribe":{"post":{"tags":["transcribe"],"summary":"Transcribe","description":"Transcribe an uploaded audio file and return the transcript.\n\nRequest: `multipart/form-data` with a single `audio` file field.\nResponse: `{\"text\": \"<transcript>\"}` on success.\n\nAuth: standard Bearer token (user or service token — same dependency\nnotetaker routes use). No provider keys travel in the request.","operationId":"transcribe_transcribe_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_transcribe_transcribe_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Transcribe Transcribe Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/oauth/register":{"post":{"tags":["oauth"],"summary":"Register Client","description":"RFC 7591 dynamic client registration.\n\nRate-limited: max OAUTH_RATE_LIMIT_REGISTRATIONS per IP per hour.\nAccepts localhost (any port) and HTTPS redirect URIs only.","operationId":"register_client_oauth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/validate-authorize":{"post":{"tags":["oauth"],"summary":"Validate Authorize","description":"Validate OAuth authorize parameters and return consent-screen data.\n\nCalled by A1 before rendering the consent page. Service token required.\nNo state change — purely validation + info retrieval.","operationId":"validate_authorize_oauth_validate_authorize_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateAuthorizeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Validate Authorize Oauth Validate Authorize Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/oauth/complete-authorize":{"post":{"tags":["oauth"],"summary":"Complete Authorize","description":"Issue an authorization code after user approves.\n\nCalled by A1 after consent. aigon_id comes from the provision token.","operationId":"complete_authorize_oauth_complete_authorize_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteAuthorizeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Complete Authorize Oauth Complete Authorize Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/oauth/token":{"post":{"tags":["oauth"],"summary":"Token Endpoint","description":"RFC 6749 token endpoint. Accepts application/x-www-form-urlencoded.","operationId":"token_endpoint_oauth_token_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/oauth/revoke":{"post":{"tags":["oauth"],"summary":"Revoke Token","description":"RFC 7009 token revocation. Always returns 200 regardless of token validity.","operationId":"revoke_token_oauth_revoke_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_transcribe_transcribe_post":{"properties":{"audio":{"type":"string","contentMediaType":"application/octet-stream","title":"Audio"}},"type":"object","required":["audio"],"title":"Body_transcribe_transcribe_post"},"CompleteAuthorizeRequest":{"properties":{"client_id":{"type":"string","title":"Client Id"},"redirect_uri":{"type":"string","title":"Redirect Uri"},"scope":{"type":"string","title":"Scope"},"resource":{"type":"string","title":"Resource"},"code_challenge":{"type":"string","title":"Code Challenge"},"code_challenge_method":{"type":"string","title":"Code Challenge Method"},"state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"}},"type":"object","required":["client_id","redirect_uri","scope","resource","code_challenge","code_challenge_method"],"title":"CompleteAuthorizeRequest"},"GlobalSearchGrouping":{"type":"string","enum":["merged","grouped"],"title":"GlobalSearchGrouping","description":"Result grouping mode."},"GlobalSearchOrderBy":{"type":"string","enum":["relevance","created","updated"],"title":"GlobalSearchOrderBy","description":"Result ordering."},"GlobalSearchOrderDir":{"type":"string","enum":["desc","asc"],"title":"GlobalSearchOrderDir","description":"Order direction."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"NoteUpdateRequest":{"properties":{"unique_ids":{"items":{"type":"string"},"type":"array","title":"Unique Ids"},"tags_set":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags Set"},"tags_add":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags Add"},"tags_remove":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags Remove"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"metadata_set":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata Set"},"metadata_merge":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata Merge"},"metadata_remove_keys":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Metadata Remove Keys"},"delegates_add":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Delegates Add"},"delegates_remove":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Delegates Remove"}},"type":"object","required":["unique_ids"],"title":"NoteUpdateRequest","description":"Request model for PATCH /notetaker/notes — bulk note update."},"OrderBy":{"type":"string","enum":["relevance","created","updated"],"title":"OrderBy","description":"Result ordering."},"OrderDir":{"type":"string","enum":["desc","asc"],"title":"OrderDir","description":"Order direction."},"RegisterRequest":{"properties":{"redirect_uris":{"items":{"type":"string"},"type":"array","title":"Redirect Uris"},"client_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Name"},"software_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Software Id"},"software_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Software Version"},"token_endpoint_auth_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token Endpoint Auth Method","default":"none"},"grant_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Grant Types"},"response_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Response Types"}},"type":"object","required":["redirect_uris"],"title":"RegisterRequest"},"RevokeRequest":{"properties":{"token":{"type":"string","title":"Token"},"token_type_hint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token Type Hint"}},"type":"object","required":["token"],"title":"RevokeRequest"},"SearchFormat":{"type":"string","enum":["short","full"],"title":"SearchFormat","description":"Response format."},"SearchMode":{"type":"string","enum":["plain","phrase","websearch","raw","prefix"],"title":"SearchMode","description":"Search mode - determines how query is parsed for FTS."},"SearchScope":{"type":"string","enum":["notes","attachments","all"],"title":"SearchScope","description":"What to search."},"ValidateAuthorizeRequest":{"properties":{"client_id":{"type":"string","title":"Client Id"},"redirect_uri":{"type":"string","title":"Redirect Uri"},"scope":{"type":"string","title":"Scope"},"resource":{"type":"string","title":"Resource"},"code_challenge":{"type":"string","title":"Code Challenge"},"code_challenge_method":{"type":"string","title":"Code Challenge Method"},"state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"}},"type":"object","required":["client_id","redirect_uri","scope","resource","code_challenge","code_challenge_method"],"title":"ValidateAuthorizeRequest"},"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"}}}}