{"openapi":"3.1.0","info":{"title":"xlsxapi.io","version":"0.1.0"},"paths":{"/auth/login":{"post":{"tags":["Auth"],"summary":"Login","description":"Authenticate a tenant user and return a JWT token.\n\nFlow:\n1. Validate credentials\n2. Invalidate previous session (single-session enforcement)\n3. Generate new JWT token\n4. Store token hash in database\n5. Update last_login_at\n\nReturns:\n    JWT access token with expiry information","operationId":"login_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/logout":{"post":{"tags":["Auth"],"summary":"Logout","description":"Logout the current user by invalidating their JWT token.\n\nArgs:\n    invalidate_session: If True, clears current_token_hash in database (default).\n                       If False, only clears the cookie (used when logged in elsewhere).\n\nAlways clears the cookie, even if the token is invalid.","operationId":"logout_auth_logout_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"invalidate_session","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Invalidate Session"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/change-password":{"post":{"tags":["Auth"],"summary":"Change Password","description":"Change the current user's password.\n\nFlow:\n1. Validate current password\n2. Hash new password\n3. Update password_hash\n4. Invalidate current session (force re-login)\n\nSecurity: Forces re-login after password change to ensure\nthe user is aware of the change.\n\nNote: Users are not allowed to change their own password.","operationId":"change_password_auth_change_password_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePasswordRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/settings":{"get":{"tags":["Tenant"],"summary":"Get Tenant Settings","description":"Get current tenant settings.\n\nReturns tenant information including decrypted SharePoint credentials.\nNote: client_secret is masked in the response for security.","operationId":"get_tenant_settings_tenant_settings_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantSettingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Tenant"],"summary":"Update Tenant Settings","description":"Update tenant settings.\n\nAllows updating tenant name and SharePoint credentials.\nCredentials are encrypted before storage using envelope encryption.","operationId":"update_tenant_settings_tenant_settings_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantSettingsUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantSettingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/test-sharepoint-connection":{"post":{"tags":["Tenant"],"summary":"Test Sharepoint Connection","description":"Test SharePoint connection with current tenant settings.\n\nAttempts to authenticate with Microsoft Graph API using the configured credentials.\nReturns success status and any error messages.","operationId":"test_sharepoint_connection_tenant_test_sharepoint_connection_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/stats":{"get":{"tags":["Tenant"],"summary":"Get Tenant Stats","description":"Get tenant-wide usage statistics.\n\nAggregates job execution data across all engines and consumers.","operationId":"get_tenant_stats_tenant_stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start date (ISO 8601 or YYYY-MM-DD)","title":"Start Date"},"description":"Start date (ISO 8601 or YYYY-MM-DD)"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"End date (ISO 8601 or YYYY-MM-DD)","title":"End Date"},"description":"End date (ISO 8601 or YYYY-MM-DD)"},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantStatsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users":{"get":{"tags":["Users"],"summary":"List Users","description":"List all users in the current tenant.\n\nReturns a list of all users belonging to the authenticated user's tenant.","operationId":"list_users_users_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Users"],"summary":"Create User","description":"Create a new user in the current tenant.\n\nGenerates a temporary password that must be changed on first login.\nReturns the user object and the temporary password (shown only once).","operationId":"create_user_users_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCreateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/{user_id}":{"patch":{"tags":["Users"],"summary":"Update User","description":"Update a user in the current tenant.\n\nAllows updating email, active status, and optionally resetting the password.\nIf reset_password is true, generates a new temporary password and invalidates\nthe user's current session.\n\nNote: Users are not allowed to modify their own account.","operationId":"update_user_users__user_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserUpdateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Users"],"summary":"Delete User","description":"Delete a user from the current tenant.\n\nPermanently removes the user from the database.\nNote: Users are not allowed to delete themselves.","operationId":"delete_user_users__user_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/engines":{"get":{"tags":["Engines"],"summary":"List Engines","description":"List all engines for the current tenant.","operationId":"list_engines_engines_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EngineListItem"},"title":"Response List Engines Engines Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Engines"],"summary":"Create Engine","description":"Create a new engine.","operationId":"create_engine_engines_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineListItem"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/engines/{engine_id}":{"get":{"tags":["Engines"],"summary":"Get Engine","description":"Get detailed engine information including all versions and consumers.","operationId":"get_engine_engines__engine_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Engines"],"summary":"Delete Engine","description":"Delete an engine and all its versions.\nCascade deletes all engine_versions and consumer_engine_access records.\nJob execution history is preserved.","operationId":"delete_engine_engines__engine_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineDeleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Engines"],"summary":"Update Engine","description":"Update engine settings including IP whitelist configuration.","operationId":"update_engine_engines__engine_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/engines/{engine_id}/versions":{"post":{"tags":["Engines"],"summary":"Create Engine Version","description":"Create a new engine version with Excel file upload.\nUploads file to SharePoint, detects named ranges, and generates test API key.","operationId":"create_engine_version_engines__engine_id__versions_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_engine_version_engines__engine_id__versions_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineVersionCreateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/engines/{engine_id}/versions/{version_id}":{"patch":{"tags":["Engines"],"summary":"Update Engine Version","description":"Update engine version schemas (input_schema and output_schema).\nReturns warnings if schema properties don't match Excel named ranges.","operationId":"update_engine_version_engines__engine_id__versions__version_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Version Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineVersionUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineVersionUpdateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Engines"],"summary":"Delete Engine Version","description":"Delete an engine version.\nCannot delete the active version.","operationId":"delete_engine_version_engines__engine_id__versions__version_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Version Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineVersionDeleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/engines/{engine_id}/versions/{version_id}/activate":{"post":{"tags":["Engines"],"summary":"Activate Engine Version","description":"Activate an engine version (make it live).\nDeactivates the currently active version and activates the new version.","operationId":"activate_engine_version_engines__engine_id__versions__version_id__activate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Version Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineVersionActivateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/engines/{engine_id}/access":{"get":{"tags":["Engines"],"summary":"List Engine Access","description":"Get all consumer access permissions for an engine.","operationId":"list_engine_access_engines__engine_id__access_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccessListItem"},"title":"Response List Engine Access Engines  Engine Id  Access Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/engines/{engine_id}/access/{consumer_id}":{"put":{"tags":["Engines"],"summary":"Grant Or Update Access","description":"Grant or update consumer access to an engine.\n\nIf access record doesn't exist, it will be created.\nIf it exists, permissions will be updated.","operationId":"grant_or_update_access_engines__engine_id__access__consumer_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"consumer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Consumer Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantAccessRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessPermissionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Engines"],"summary":"Revoke Access","description":"Revoke all consumer access to an engine.\n\nThe consumer will no longer be able to execute or view jobs for this engine.","operationId":"revoke_access_engines__engine_id__access__consumer_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"consumer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Consumer Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessRevokeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/engines/{engine_id}/jobs":{"get":{"tags":["Engines"],"summary":"List Engine Jobs","description":"Get job executions for an engine with optional status filter.\n\nSupports pagination and filtering by job status.\nUseful for viewing failed jobs for debugging.","operationId":"list_engine_jobs_engines__engine_id__jobs_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by status (pending, processing, completed, failed)","title":"Status"},"description":"Filter by status (pending, processing, completed, failed)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"description":"Maximum number of results","default":50,"title":"Limit"},"description":"Maximum number of results"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Pagination offset","default":0,"title":"Offset"},"description":"Pagination offset"},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/engines/{engine_id}/jobs/recent":{"get":{"tags":["Engines"],"summary":"List Recent Jobs","description":"Get recent job executions for an engine.\n\nReturns the most recent jobs ordered by creation time.\nUseful for real-time monitoring of engine health.","operationId":"list_recent_jobs_engines__engine_id__jobs_recent_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of recent jobs","default":20,"title":"Limit"},"description":"Maximum number of recent jobs"},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RecentJobItem"},"title":"Response List Recent Jobs Engines  Engine Id  Jobs Recent Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/engines/{engine_id}/stats":{"get":{"tags":["Engines"],"summary":"Get Engine Stats","description":"Get usage statistics for an engine.\n\nAggregates job execution data by consumer, day, and version.\nCalculates success rate, avg execution time, and percentiles.","operationId":"get_engine_stats_engines__engine_id__stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"engine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engine Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start date (ISO 8601 or YYYY-MM-DD)","title":"Start Date"},"description":"Start date (ISO 8601 or YYYY-MM-DD)"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"End date (ISO 8601 or YYYY-MM-DD)","title":"End Date"},"description":"End date (ISO 8601 or YYYY-MM-DD)"},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineStatsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/consumers":{"get":{"tags":["Consumers"],"summary":"List Consumers","description":"List all active (non-archived) consumers for the current tenant.","operationId":"list_consumers_consumers_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ConsumerListItem"},"title":"Response List Consumers Consumers Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Consumers"],"summary":"Create Consumer","description":"Create a new consumer and generate API key.\n\nThe API key is shown only once in the response. It must be copied immediately.","operationId":"create_consumer_consumers_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsumerCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsumerCreateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/consumers/{consumer_id}":{"patch":{"tags":["Consumers"],"summary":"Update Consumer","description":"Update consumer (activate/deactivate).","operationId":"update_consumer_consumers__consumer_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"consumer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Consumer Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsumerUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsumerUpdateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Consumers"],"summary":"Delete Consumer","description":"Soft delete a consumer (archive).\n\nThe consumer is marked as archived and deactivated. The API key will be invalidated immediately.\nJob execution history and stats are preserved for audit purposes.","operationId":"delete_consumer_consumers__consumer_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"consumer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Consumer Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsumerDeleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/consumers/{consumer_id}/stats":{"get":{"tags":["Consumers"],"summary":"Get Consumer Stats","description":"Get usage statistics for a consumer.\n\nAggregates job execution data by engine and day.","operationId":"get_consumer_stats_consumers__consumer_id__stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"consumer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Consumer Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start date (ISO 8601 or YYYY-MM-DD)","title":"Start Date"},"description":"Start date (ISO 8601 or YYYY-MM-DD)"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"End date (ISO 8601 or YYYY-MM-DD)","title":"End Date"},"description":"End date (ISO 8601 or YYYY-MM-DD)"},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsumerStatsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/consumers/{consumer_id}/access":{"get":{"tags":["Consumers"],"summary":"List Consumer Engine Access","description":"Get all engine access permissions for a consumer.\nReturns list of engines the consumer has access to with their permissions.","operationId":"list_consumer_engine_access_consumers__consumer_id__access_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"consumer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Consumer Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ConsumerEngineAccessItem"},"title":"Response List Consumer Engine Access Consumers  Consumer Id  Access Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/jobs/execute/{tenant_slug}/{engine_slug}":{"post":{"tags":["Jobs"],"summary":"Execute Engine","description":"Execute the active version of a rating engine.\n\nThis endpoint only executes the active version. Use /test endpoint for testing\nnon-active versions.\n\nAuthentication: Regular consumer API key only (not test keys)","operationId":"execute_engine_jobs_execute__tenant_slug___engine_slug__post","security":[{"APIKeyHeader":[]},{"HTTPBearer":[]}],"parameters":[{"name":"tenant_slug","in":"path","required":true,"schema":{"type":"string","title":"Tenant Slug"}},{"name":"engine_slug","in":"path","required":true,"schema":{"type":"string","title":"Engine Slug"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/jobs/test/{tenant_slug}/{engine_slug}/{version_id}":{"post":{"tags":["Jobs"],"summary":"Execute Engine Test","description":"Execute a specific version of a rating engine for testing purposes.\n\nThis endpoint allows testing non-active versions before activation.\nRequires a test API key that matches the version being tested.\n\nAuthentication: Test API key only (generated when version was created)","operationId":"execute_engine_test_jobs_test__tenant_slug___engine_slug___version_id__post","security":[{"APIKeyHeader":[]},{"HTTPBearer":[]}],"parameters":[{"name":"tenant_slug","in":"path","required":true,"schema":{"type":"string","title":"Tenant Slug"}},{"name":"engine_slug","in":"path","required":true,"schema":{"type":"string","title":"Engine Slug"}},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Version Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/jobs/about/{tenant_slug}/{engine_slug}":{"get":{"tags":["Jobs"],"summary":"Get Engine About","description":"Get metadata about an engine (version, schemas, etc.).\n\nRequires the consumer to have access to the engine (any permission).\n\nAuthentication: API key (X-API-Key header or Authorization: Bearer header)","operationId":"get_engine_about_jobs_about__tenant_slug___engine_slug__get","security":[{"APIKeyHeader":[]},{"HTTPBearer":[]}],"parameters":[{"name":"tenant_slug","in":"path","required":true,"schema":{"type":"string","title":"Tenant Slug"}},{"name":"engine_slug","in":"path","required":true,"schema":{"type":"string","title":"Engine Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AboutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/jobs/{job_id}":{"get":{"tags":["Jobs"],"summary":"Get Job Status","description":"Get the status and results of a job execution.\n\nAuthentication: API key (X-API-Key header or Authorization: Bearer header)","operationId":"get_job_status_jobs__job_id__get","security":[{"APIKeyHeader":[]},{"HTTPBearer":[]}],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/jobs/{job_id}/download":{"get":{"tags":["Jobs"],"summary":"Download Job File","description":"Get a direct download URL for the filled Excel file.\n\nThe URL is valid for approximately 1 hour.\n\nAuthentication: API key (X-API-Key header or Authorization: Bearer header)","operationId":"download_job_file_jobs__job_id__download_get","security":[{"APIKeyHeader":[]},{"HTTPBearer":[]}],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DownloadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/sharepoint/discover-sites":{"post":{"tags":["Tenant"],"summary":"Discover Sites","description":"List accessible SharePoint sites using stored Graph API credentials.\n\nRequires at least client_id, client_secret, and tenant_id to be saved.","operationId":"discover_sites_tenant_sharepoint_discover_sites_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SharePointSiteInfo"},"title":"Response Discover Sites Tenant Sharepoint Discover Sites Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/sharepoint/discover-drives/{site_id}":{"post":{"tags":["Tenant"],"summary":"Discover Drives","description":"List document libraries (drives) for a SharePoint site.\n\nRequires at least client_id, client_secret, and tenant_id to be saved.","operationId":"discover_drives_tenant_sharepoint_discover_drives__site_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SharePointDriveInfo"},"title":"Response Discover Drives Tenant Sharepoint Discover Drives  Site Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/health":{"get":{"summary":"Health Check","description":"Health check endpoint.","operationId":"health_check_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"AboutResponse":{"properties":{"name":{"type":"string","title":"Name"},"slug":{"type":"string","title":"Slug"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"version":{"type":"string","title":"Version"},"input_schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Input Schema"},"output_schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Output Schema"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["name","slug","description","version","input_schema","output_schema","updated_at"],"title":"AboutResponse","description":"Response model for engine about endpoint."},"AccessListItem":{"properties":{"consumer_id":{"type":"string","format":"uuid","title":"Consumer Id"},"consumer_name":{"type":"string","title":"Consumer Name"},"is_active":{"type":"boolean","title":"Is Active"},"can_execute":{"type":"boolean","title":"Can Execute"},"can_view_jobs":{"type":"boolean","title":"Can View Jobs"},"can_download":{"type":"boolean","title":"Can Download"},"can_view_about":{"type":"boolean","title":"Can View About"},"granted_at":{"type":"string","format":"date-time","title":"Granted At"}},"type":"object","required":["consumer_id","consumer_name","is_active","can_execute","can_view_jobs","can_download","can_view_about","granted_at"],"title":"AccessListItem","description":"Response model for listing consumer access to an engine."},"AccessPermissionResponse":{"properties":{"consumer_id":{"type":"string","format":"uuid","title":"Consumer Id"},"engine_id":{"type":"string","format":"uuid","title":"Engine Id"},"can_execute":{"type":"boolean","title":"Can Execute"},"can_view_jobs":{"type":"boolean","title":"Can View Jobs"},"can_download":{"type":"boolean","title":"Can Download"},"can_view_about":{"type":"boolean","title":"Can View About"}},"type":"object","required":["consumer_id","engine_id","can_execute","can_view_jobs","can_download","can_view_about"],"title":"AccessPermissionResponse","description":"Response model for access permission grant/update."},"AccessRevokeResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"AccessRevokeResponse","description":"Response model for access revocation."},"Body_create_engine_version_engines__engine_id__versions_post":{"properties":{"version":{"type":"string","title":"Version"},"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["version","file"],"title":"Body_create_engine_version_engines__engine_id__versions_post"},"ChangePasswordRequest":{"properties":{"current_password":{"type":"string","minLength":1,"title":"Current Password"},"new_password":{"type":"string","minLength":8,"title":"New Password","description":"Minimum 8 characters"}},"type":"object","required":["current_password","new_password"],"title":"ChangePasswordRequest","description":"Change password request payload."},"ConsumerAccessSummary":{"properties":{"consumer_id":{"type":"string","format":"uuid","title":"Consumer Id"},"consumer_name":{"type":"string","title":"Consumer Name"},"last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Used At"},"can_execute":{"type":"boolean","title":"Can Execute"},"can_view_jobs":{"type":"boolean","title":"Can View Jobs"},"can_download":{"type":"boolean","title":"Can Download"},"can_view_about":{"type":"boolean","title":"Can View About"}},"type":"object","required":["consumer_id","consumer_name","last_used_at","can_execute","can_view_jobs","can_download","can_view_about"],"title":"ConsumerAccessSummary","description":"Summary of consumer access to an engine."},"ConsumerCreate":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"Consumer name"}},"type":"object","required":["name"],"title":"ConsumerCreate","description":"Request model for creating a new consumer."},"ConsumerCreateResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"name":{"type":"string","title":"Name"},"api_key":{"type":"string","title":"Api Key"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"message":{"type":"string","title":"Message","default":"API key shown only once. Copy it now."}},"type":"object","required":["id","name","api_key","created_at"],"title":"ConsumerCreateResponse","description":"Response model for consumer creation."},"ConsumerDeleteResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"ConsumerDeleteResponse","description":"Response model for consumer deletion."},"ConsumerEngineAccessItem":{"properties":{"engine_id":{"type":"string","format":"uuid","title":"Engine Id"},"engine_name":{"type":"string","title":"Engine Name"},"active_version_slug":{"type":"string","title":"Active Version Slug"},"can_execute":{"type":"boolean","title":"Can Execute"},"can_view_jobs":{"type":"boolean","title":"Can View Jobs"},"can_download":{"type":"boolean","title":"Can Download"},"can_view_about":{"type":"boolean","title":"Can View About"}},"type":"object","required":["engine_id","engine_name","active_version_slug","can_execute","can_view_jobs","can_download","can_view_about"],"title":"ConsumerEngineAccessItem","description":"Engine access information for a consumer."},"ConsumerListItem":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"name":{"type":"string","title":"Name"},"api_key":{"type":"string","title":"Api Key"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Used At"},"is_active":{"type":"boolean","title":"Is Active"}},"type":"object","required":["id","name","api_key","created_at","is_active"],"title":"ConsumerListItem","description":"Response model for consumer list item."},"ConsumerStatsBreakdown":{"properties":{"consumer_id":{"type":"string","format":"uuid","title":"Consumer Id"},"consumer_name":{"type":"string","title":"Consumer Name"},"total_calls":{"type":"integer","title":"Total Calls"},"successful_calls":{"type":"integer","title":"Successful Calls"},"failed_calls":{"type":"integer","title":"Failed Calls"},"success_rate":{"type":"number","title":"Success Rate"}},"type":"object","required":["consumer_id","consumer_name","total_calls","successful_calls","failed_calls","success_rate"],"title":"ConsumerStatsBreakdown","description":"Stats breakdown by consumer."},"ConsumerStatsResponse":{"properties":{"consumer_id":{"type":"string","format":"uuid","title":"Consumer Id"},"consumer_name":{"type":"string","title":"Consumer Name"},"period":{"$ref":"#/components/schemas/StatsPeriod"},"summary":{"$ref":"#/components/schemas/ConsumerSummaryStats"},"by_engine":{"items":{"$ref":"#/components/schemas/EngineStatsBreakdown"},"type":"array","title":"By Engine"},"by_day":{"items":{"$ref":"#/components/schemas/DailyStatsBreakdown"},"type":"array","title":"By Day"}},"type":"object","required":["consumer_id","consumer_name","period","summary","by_engine","by_day"],"title":"ConsumerStatsResponse","description":"Complete consumer statistics response."},"ConsumerSummaryStats":{"properties":{"total_calls":{"type":"integer","title":"Total Calls"},"successful_calls":{"type":"integer","title":"Successful Calls"},"failed_calls":{"type":"integer","title":"Failed Calls"},"success_rate":{"type":"number","title":"Success Rate"},"avg_execution_time_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Execution Time Ms"}},"type":"object","required":["total_calls","successful_calls","failed_calls","success_rate"],"title":"ConsumerSummaryStats","description":"Summary statistics for a consumer."},"ConsumerUpdate":{"properties":{"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active","description":"Activate or deactivate the consumer"}},"type":"object","title":"ConsumerUpdate","description":"Request model for updating a consumer."},"ConsumerUpdateResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"name":{"type":"string","title":"Name"},"is_active":{"type":"boolean","title":"Is Active"}},"type":"object","required":["id","name","is_active"],"title":"ConsumerUpdateResponse","description":"Response model for consumer update."},"DailyStatsBreakdown":{"properties":{"date":{"type":"string","title":"Date"},"total_calls":{"type":"integer","title":"Total Calls"},"successful_calls":{"type":"integer","title":"Successful Calls"},"failed_calls":{"type":"integer","title":"Failed Calls"},"avg_execution_time_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Execution Time Ms"}},"type":"object","required":["date","total_calls","successful_calls","failed_calls"],"title":"DailyStatsBreakdown","description":"Stats breakdown by day."},"DownloadResponse":{"properties":{"download_url":{"type":"string","title":"Download Url"},"filename":{"type":"string","title":"Filename"},"expires_at":{"type":"string","title":"Expires At"}},"type":"object","required":["download_url","filename","expires_at"],"title":"DownloadResponse","description":"Response model for download endpoint."},"EngineCreate":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"Engine name"},"slug":{"anyOf":[{"type":"string","maxLength":100,"minLength":1,"pattern":"^[a-z0-9-]+$"},{"type":"null"}],"title":"Slug","description":"URL-safe slug (auto-generated if not provided)"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Engine description"}},"type":"object","required":["name"],"title":"EngineCreate","description":"Request model for creating an engine."},"EngineDeleteResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"EngineDeleteResponse","description":"Response for engine deletion."},"EngineDetail":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"name":{"type":"string","title":"Name"},"slug":{"type":"string","title":"Slug"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"active_version_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Active Version Id"},"ip_whitelist_enabled":{"type":"boolean","title":"Ip Whitelist Enabled"},"ip_whitelist":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Ip Whitelist"},"versions":{"items":{"$ref":"#/components/schemas/EngineVersionDetail"},"type":"array","title":"Versions"},"consumers":{"items":{"$ref":"#/components/schemas/ConsumerAccessSummary"},"type":"array","title":"Consumers"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","name","slug","description","active_version_id","ip_whitelist_enabled","ip_whitelist","versions","consumers","created_at"],"title":"EngineDetail","description":"Detailed engine information."},"EngineListItem":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"name":{"type":"string","title":"Name"},"slug":{"type":"string","title":"Slug"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"ip_whitelist_enabled":{"type":"boolean","title":"Ip Whitelist Enabled"},"active_version":{"anyOf":[{"$ref":"#/components/schemas/EngineVersionSummary"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","name","slug","description","ip_whitelist_enabled","active_version","created_at"],"title":"EngineListItem","description":"Response model for engine list item."},"EngineStatsBreakdown":{"properties":{"engine_id":{"type":"string","format":"uuid","title":"Engine Id"},"engine_name":{"type":"string","title":"Engine Name"},"engine_slug":{"type":"string","title":"Engine Slug"},"active_version_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Active Version Slug"},"total_calls":{"type":"integer","title":"Total Calls"},"successful_calls":{"type":"integer","title":"Successful Calls"},"failed_calls":{"type":"integer","title":"Failed Calls"}},"type":"object","required":["engine_id","engine_name","engine_slug","total_calls","successful_calls","failed_calls"],"title":"EngineStatsBreakdown","description":"Stats breakdown by engine (for consumer stats)."},"EngineStatsResponse":{"properties":{"engine_id":{"type":"string","format":"uuid","title":"Engine Id"},"engine_name":{"type":"string","title":"Engine Name"},"period":{"$ref":"#/components/schemas/StatsPeriod"},"summary":{"$ref":"#/components/schemas/EngineSummaryStats"},"by_consumer":{"items":{"$ref":"#/components/schemas/ConsumerStatsBreakdown"},"type":"array","title":"By Consumer"},"by_day":{"items":{"$ref":"#/components/schemas/DailyStatsBreakdown"},"type":"array","title":"By Day"},"by_version":{"items":{"$ref":"#/components/schemas/VersionStatsBreakdown"},"type":"array","title":"By Version"}},"type":"object","required":["engine_id","engine_name","period","summary","by_consumer","by_day","by_version"],"title":"EngineStatsResponse","description":"Complete engine statistics response."},"EngineSummaryStats":{"properties":{"total_calls":{"type":"integer","title":"Total Calls"},"successful_calls":{"type":"integer","title":"Successful Calls"},"failed_calls":{"type":"integer","title":"Failed Calls"},"success_rate":{"type":"number","title":"Success Rate"},"avg_execution_time_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Execution Time Ms"},"p50_execution_time_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"P50 Execution Time Ms"},"p95_execution_time_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"P95 Execution Time Ms"},"p99_execution_time_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"P99 Execution Time Ms"},"avg_excel_calculation_time_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Excel Calculation Time Ms"}},"type":"object","required":["total_calls","successful_calls","failed_calls","success_rate"],"title":"EngineSummaryStats","description":"Summary statistics for an engine."},"EngineUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"ip_whitelist_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ip Whitelist Enabled"},"ip_whitelist":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Ip Whitelist"}},"type":"object","title":"EngineUpdate","description":"Request model for updating an engine."},"EngineVersionActivateResponse":{"properties":{"message":{"type":"string","title":"Message"},"previous_active_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Previous Active Version"},"new_active_version":{"type":"string","title":"New Active Version"}},"type":"object","required":["message","previous_active_version","new_active_version"],"title":"EngineVersionActivateResponse","description":"Response model for version activation."},"EngineVersionCreateResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"version":{"type":"string","title":"Version"},"status":{"type":"string","title":"Status"},"input_ranges":{"items":{"type":"string"},"type":"array","title":"Input Ranges"},"output_ranges":{"items":{"type":"string"},"type":"array","title":"Output Ranges"},"other_ranges":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Other Ranges"},"test_api_key":{"type":"string","title":"Test Api Key"},"sharepoint_file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sharepoint File Url"},"excel_filename":{"type":"string","title":"Excel Filename"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings","description":"Schema validation warnings"}},"type":"object","required":["id","version","status","input_ranges","output_ranges","other_ranges","test_api_key","sharepoint_file_url","excel_filename","created_at"],"title":"EngineVersionCreateResponse","description":"Response model for engine version creation."},"EngineVersionDeleteResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"EngineVersionDeleteResponse","description":"Response for version deletion."},"EngineVersionDetail":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"version":{"type":"string","title":"Version"},"status":{"type":"string","title":"Status"},"input_ranges":{"items":{"type":"string"},"type":"array","title":"Input Ranges"},"output_ranges":{"items":{"type":"string"},"type":"array","title":"Output Ranges"},"other_ranges":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Other Ranges"},"input_schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Input Schema"},"output_schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Output Schema"},"test_api_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Test Api Key"},"sharepoint_file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sharepoint File Url"},"excel_filename":{"type":"string","title":"Excel Filename"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","version","status","input_ranges","output_ranges","other_ranges","input_schema","output_schema","test_api_key","sharepoint_file_url","excel_filename","created_at"],"title":"EngineVersionDetail","description":"Detailed engine version information."},"EngineVersionSummary":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"version":{"type":"string","title":"Version"},"status":{"type":"string","title":"Status"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","version","status","created_at"],"title":"EngineVersionSummary","description":"Summary of an engine version."},"EngineVersionUpdate":{"properties":{"input_schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Input Schema","description":"Input JSON Schema"},"output_schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Output Schema","description":"Output JSON Schema"}},"type":"object","title":"EngineVersionUpdate","description":"Request model for updating engine version schemas."},"EngineVersionUpdateResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"version":{"type":"string","title":"Version"},"status":{"type":"string","title":"Status"},"input_ranges":{"items":{"type":"string"},"type":"array","title":"Input Ranges"},"output_ranges":{"items":{"type":"string"},"type":"array","title":"Output Ranges"},"other_ranges":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Other Ranges"},"input_schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Input Schema"},"output_schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Output Schema"},"test_api_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Test Api Key"},"sharepoint_file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sharepoint File Url"},"excel_filename":{"type":"string","title":"Excel Filename"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings","description":"Schema validation warnings"}},"type":"object","required":["id","version","status","input_ranges","output_ranges","other_ranges","input_schema","output_schema","test_api_key","sharepoint_file_url","excel_filename","created_at"],"title":"EngineVersionUpdateResponse","description":"Response model for engine version schema update."},"ExecuteRequest":{"properties":{"inputs":{"additionalProperties":true,"type":"object","title":"Inputs","description":"Input data matching the engine's input schema"},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Optional webhook URL for job completion notification"}},"type":"object","required":["inputs"],"title":"ExecuteRequest","description":"Request model for executing an engine."},"ExecuteResponse":{"properties":{"job_id":{"type":"string","format":"uuid","title":"Job Id"},"status":{"type":"string","title":"Status"},"message":{"type":"string","title":"Message"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["job_id","status","message","created_at"],"title":"ExecuteResponse","description":"Response model for execute endpoint."},"GrantAccessRequest":{"properties":{"can_execute":{"type":"boolean","title":"Can Execute","description":"Permission to execute the engine"},"can_view_jobs":{"type":"boolean","title":"Can View Jobs","description":"Permission to view job results"},"can_download":{"type":"boolean","title":"Can Download","description":"Permission to download Excel files"},"can_view_about":{"type":"boolean","title":"Can View About","description":"Permission to view engine metadata"}},"type":"object","required":["can_execute","can_view_jobs","can_download","can_view_about"],"title":"GrantAccessRequest","description":"Request model for granting/updating consumer access to an engine."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"JobListItem":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"consumer_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Consumer Id"},"consumer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Consumer Name"},"version":{"type":"string","title":"Version"},"status":{"type":"string","title":"Status"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"input_data":{"additionalProperties":true,"type":"object","title":"Input Data"},"output_data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Output Data"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"execution_time_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Execution Time Ms"},"is_test_run":{"type":"boolean","title":"Is Test Run"}},"type":"object","required":["id","version","status","input_data","created_at","updated_at","is_test_run"],"title":"JobListItem","description":"Job execution list item."},"JobListResponse":{"properties":{"total":{"type":"integer","title":"Total"},"jobs":{"items":{"$ref":"#/components/schemas/JobListItem"},"type":"array","title":"Jobs"}},"type":"object","required":["total","jobs"],"title":"JobListResponse","description":"Paginated job list response."},"JobStatusResponse":{"properties":{"job_id":{"type":"string","format":"uuid","title":"Job Id"},"status":{"type":"string","title":"Status"},"inputs":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Inputs"},"outputs":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Outputs"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"},"execution_time_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Execution Time Ms"},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url"},"webhook_sent_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Webhook Sent At"},"webhook_response_status":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Webhook Response Status"}},"type":"object","required":["job_id","status","created_at","updated_at"],"title":"JobStatusResponse","description":"Response model for job status query."},"LoginRequest":{"properties":{"email":{"type":"string","minLength":1,"title":"Email"},"password":{"type":"string","minLength":1,"title":"Password"}},"type":"object","required":["email","password"],"title":"LoginRequest","description":"Login request payload."},"LoginResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["access_token","expires_in"],"title":"LoginResponse","description":"Login response with JWT token."},"MessageResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"MessageResponse","description":"Generic message response."},"RecentJobItem":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"consumer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Consumer Name"},"status":{"type":"string","title":"Status"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"execution_time_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Execution Time Ms"}},"type":"object","required":["id","status","created_at"],"title":"RecentJobItem","description":"Recent job execution item."},"SharePointDriveInfo":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"drive_type":{"type":"string","title":"Drive Type"},"web_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Web Url"}},"type":"object","required":["id","name","drive_type"],"title":"SharePointDriveInfo","description":"SharePoint drive (document library) information for discovery."},"SharePointSiteInfo":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"display_name":{"type":"string","title":"Display Name"},"web_url":{"type":"string","title":"Web Url"}},"type":"object","required":["id","name","display_name","web_url"],"title":"SharePointSiteInfo","description":"SharePoint site information for discovery."},"StatsPeriod":{"properties":{"start_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Start Date"},"end_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"End Date"}},"type":"object","title":"StatsPeriod","description":"Time period for stats."},"TenantEngineStatsBreakdown":{"properties":{"engine_id":{"type":"string","format":"uuid","title":"Engine Id"},"engine_name":{"type":"string","title":"Engine Name"},"total_calls":{"type":"integer","title":"Total Calls"},"successful_calls":{"type":"integer","title":"Successful Calls"},"failed_calls":{"type":"integer","title":"Failed Calls"}},"type":"object","required":["engine_id","engine_name","total_calls","successful_calls","failed_calls"],"title":"TenantEngineStatsBreakdown","description":"Stats breakdown by engine (for tenant stats)."},"TenantSettingsResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"name":{"type":"string","title":"Name"},"slug":{"type":"string","title":"Slug"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"ms_graph_client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ms Graph Client Id"},"ms_graph_client_secret":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ms Graph Client Secret"},"ms_graph_client_secret_is_set":{"type":"boolean","title":"Ms Graph Client Secret Is Set","default":false},"ms_graph_tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ms Graph Tenant Id"},"ms_graph_sharepoint_site_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ms Graph Sharepoint Site Id"},"ms_graph_sharepoint_drive_id_templates":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ms Graph Sharepoint Drive Id Templates"},"ms_graph_sharepoint_drive_id_jobs":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ms Graph Sharepoint Drive Id Jobs"},"ms_graph_sharepoint_site_display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ms Graph Sharepoint Site Display Name"},"ms_graph_sharepoint_drive_display_name_templates":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ms Graph Sharepoint Drive Display Name Templates"},"ms_graph_sharepoint_drive_display_name_jobs":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ms Graph Sharepoint Drive Display Name Jobs"}},"type":"object","required":["id","name","slug","is_active","created_at","updated_at"],"title":"TenantSettingsResponse","description":"Response model for tenant settings (GET)."},"TenantSettingsUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Name"},"ms_graph_client_id":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Ms Graph Client Id"},"ms_graph_client_secret":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Ms Graph Client Secret"},"ms_graph_tenant_id":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Ms Graph Tenant Id"},"ms_graph_sharepoint_site_id":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Ms Graph Sharepoint Site Id"},"ms_graph_sharepoint_drive_id_templates":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Ms Graph Sharepoint Drive Id Templates"},"ms_graph_sharepoint_drive_id_jobs":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Ms Graph Sharepoint Drive Id Jobs"}},"type":"object","title":"TenantSettingsUpdate","description":"Request model for updating tenant settings (PUT)."},"TenantStatsResponse":{"properties":{"tenant_name":{"type":"string","title":"Tenant Name"},"period":{"$ref":"#/components/schemas/StatsPeriod"},"summary":{"$ref":"#/components/schemas/TenantSummaryStats"},"by_engine":{"items":{"$ref":"#/components/schemas/TenantEngineStatsBreakdown"},"type":"array","title":"By Engine"}},"type":"object","required":["tenant_name","period","summary","by_engine"],"title":"TenantStatsResponse","description":"Complete tenant-wide statistics response."},"TenantSummaryStats":{"properties":{"total_engines":{"type":"integer","title":"Total Engines"},"total_consumers":{"type":"integer","title":"Total Consumers"},"total_calls":{"type":"integer","title":"Total Calls"},"successful_calls":{"type":"integer","title":"Successful Calls"},"failed_calls":{"type":"integer","title":"Failed Calls"},"success_rate":{"type":"number","title":"Success Rate"}},"type":"object","required":["total_engines","total_consumers","total_calls","successful_calls","failed_calls","success_rate"],"title":"TenantSummaryStats","description":"Summary statistics for the entire tenant."},"UserCreate":{"properties":{"email":{"type":"string","format":"email","title":"Email","description":"User's email address"},"is_active":{"type":"boolean","title":"Is Active","description":"Whether the user is active","default":true}},"type":"object","required":["email"],"title":"UserCreate","description":"Request model for creating a new user."},"UserCreateResponse":{"properties":{"user":{"$ref":"#/components/schemas/UserResponse"},"temporary_password":{"type":"string","title":"Temporary Password","description":"Auto-generated temporary password (show once)"}},"type":"object","required":["user","temporary_password"],"title":"UserCreateResponse","description":"Response model after creating a user (includes generated password)."},"UserListResponse":{"properties":{"users":{"items":{"$ref":"#/components/schemas/UserResponse"},"type":"array","title":"Users"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["users","total"],"title":"UserListResponse","description":"Response model for listing users."},"UserResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"tenant_id":{"type":"string","format":"uuid","title":"Tenant Id"},"email":{"type":"string","title":"Email"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"last_login_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Login At"}},"type":"object","required":["id","tenant_id","email","is_active","created_at","updated_at"],"title":"UserResponse","description":"Response model for user information."},"UserUpdate":{"properties":{"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email","description":"User's email address"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active","description":"Whether the user is active"},"reset_password":{"type":"boolean","title":"Reset Password","description":"If true, generate a new temporary password and invalidate current session","default":false}},"type":"object","title":"UserUpdate","description":"Request model for updating a user."},"UserUpdateResponse":{"properties":{"user":{"$ref":"#/components/schemas/UserResponse"},"temporary_password":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Temporary Password","description":"New temporary password if reset_password was true"}},"type":"object","required":["user"],"title":"UserUpdateResponse","description":"Response model after updating a user."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VersionStatsBreakdown":{"properties":{"version_id":{"type":"string","format":"uuid","title":"Version Id"},"version":{"type":"string","title":"Version"},"total_calls":{"type":"integer","title":"Total Calls"},"successful_calls":{"type":"integer","title":"Successful Calls"},"failed_calls":{"type":"integer","title":"Failed Calls"}},"type":"object","required":["version_id","version","total_calls","successful_calls","failed_calls"],"title":"VersionStatsBreakdown","description":"Stats breakdown by engine version."}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key"}}}}