{"openapi":"3.1.0","info":{"title":"Zero Latency Memory API","description":"Structured memory extraction, storage, and recall for AI agents.","version":"0.1.0"},"paths":{"/auth/github":{"get":{"tags":["auth"],"summary":"Github Login","description":"Redirect to GitHub OAuth consent screen.","operationId":"github_login_auth_github_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/github/callback":{"get":{"tags":["auth"],"summary":"Github Callback","description":"Handle GitHub OAuth callback.","operationId":"github_callback_auth_github_callback_get","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":true,"schema":{"type":"string","title":"State"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/google":{"get":{"tags":["auth"],"summary":"Google Login","description":"Redirect to Google OAuth consent screen.","operationId":"google_login_auth_google_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/google/callback":{"get":{"tags":["auth"],"summary":"Google Callback","description":"Handle Google OAuth callback.","operationId":"google_callback_auth_google_callback_get","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":true,"schema":{"type":"string","title":"State"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/email/register":{"post":{"tags":["auth"],"summary":"Email Register","description":"Register with email and password.","operationId":"email_register_auth_email_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRegisterRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/email/login":{"post":{"tags":["auth"],"summary":"Email Login","description":"Login with email and password.","operationId":"email_login_auth_email_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailLoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/me":{"get":{"tags":["auth"],"summary":"Get Current User","description":"Get current user profile from JWT.","operationId":"get_current_user_auth_me_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"zl_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Zl Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/api-key/regenerate":{"post":{"tags":["auth"],"summary":"Regenerate Api Key","description":"Regenerate API key for the current user's tenant.","operationId":"regenerate_api_key_auth_api_key_regenerate_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"zl_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Zl Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/create-checkout":{"post":{"tags":["billing"],"summary":"Create Checkout","description":"Create a Stripe Checkout Session for Pro or Scale subscription.","operationId":"create_checkout_billing_create_checkout_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"zl_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Zl Token"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutRequest","default":{"plan":"pro"}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/subscription":{"get":{"tags":["billing"],"summary":"Get Subscription","description":"Get current user's subscription status.","operationId":"get_subscription_billing_subscription_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"zl_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Zl Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/portal":{"post":{"tags":["billing"],"summary":"Create Portal","description":"Create a Stripe Customer Portal session for self-service management.","operationId":"create_portal_billing_portal_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"zl_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Zl Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/webhook":{"post":{"tags":["billing"],"summary":"Stripe Webhook","description":"Handle Stripe webhook events. Public endpoint — verifies signature.","operationId":"stripe_webhook_billing_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/dashboard":{"get":{"summary":"Dashboard","description":"Tenant dashboard UI (requires API key).","operationId":"dashboard_dashboard_get","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/extract":{"post":{"summary":"Extract Endpoint","description":"Extract memories from a conversation turn.","operationId":"extract_endpoint_extract_post","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/memories/extract":{"post":{"summary":"Async Extract Endpoint","description":"Async memory extraction. Accepts instantly (202), processes in background.\n\nThis is the preferred extraction path. Recall is always sync and fast.\nExtraction accepts instantly and processes in the background.\nPartial results beat blocking.","operationId":"async_extract_endpoint_memories_extract_post","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AsyncExtractRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/memories/extract/{job_id}":{"get":{"summary":"Get Extract Job","description":"Check status of an async extraction job.","operationId":"get_extract_job_memories_extract__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/recall":{"post":{"summary":"Recall Endpoint","description":"Recall relevant memories for a conversation context.","operationId":"recall_endpoint_recall_post","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecallRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecallResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/memories":{"get":{"summary":"List Memories","description":"List memories for an agent with pagination.","operationId":"list_memories_memories_get","parameters":[{"name":"agent_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":128,"title":"Agent Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"memory_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Memory Type"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MemoryItem"},"title":"Response List Memories Memories Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/memories/{memory_id}":{"delete":{"summary":"Delete Memory","description":"Delete a specific memory. Tenant-isolated.","operationId":"delete_memory_memories__memory_id__delete","parameters":[{"name":"memory_id","in":"path","required":true,"schema":{"type":"string","title":"Memory Id"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"summary":"Update Memory Endpoint","description":"Update a memory. Automatically creates a version snapshot before updating.","operationId":"update_memory_endpoint_memories__memory_id__put","parameters":[{"name":"memory_id","in":"path","required":true,"schema":{"type":"string","title":"Memory Id"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/memories/search":{"get":{"summary":"Search Memories","description":"Search memories by keyword. Tenant-isolated.","operationId":"search_memories_memories_search_get","parameters":[{"name":"agent_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":128,"title":"Agent Id"}},{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":500,"title":"Q"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/extract/batch":{"post":{"summary":"Batch Extract","description":"Extract memories from multiple conversation turns in one request.","operationId":"batch_extract_extract_batch_post","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchExtractRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/memories/export":{"get":{"summary":"Export Memories","description":"Export all memories for an agent as JSON. For data portability and GDPR compliance.","operationId":"export_memories_memories_export_get","parameters":[{"name":"agent_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":128,"title":"Agent Id"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/health":{"get":{"summary":"Health Check","description":"Health check — no auth required. Verifies DB connectivity and pool status.","operationId":"health_check_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/graph/entity":{"get":{"summary":"Graph Entity Endpoint","description":"Get knowledge graph around an entity with multi-hop traversal.","operationId":"graph_entity_endpoint_graph_entity_get","parameters":[{"name":"agent_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":128,"title":"Agent Id"}},{"name":"entity","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":256,"title":"Entity"}},{"name":"depth","in":"query","required":false,"schema":{"type":"integer","maximum":4,"minimum":1,"default":2,"title":"Depth"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/graph/entities":{"get":{"summary":"Graph Entities Endpoint","description":"List all known entities for an agent.","operationId":"graph_entities_endpoint_graph_entities_get","parameters":[{"name":"agent_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":128,"title":"Agent Id"}},{"name":"entity_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Entity Type"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/graph/entity/memories":{"get":{"summary":"Graph Entity Memories Endpoint","description":"Get all memories associated with an entity.","operationId":"graph_entity_memories_endpoint_graph_entity_memories_get","parameters":[{"name":"agent_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":128,"title":"Agent Id"}},{"name":"entity","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":256,"title":"Entity"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/graph/path":{"get":{"summary":"Graph Path Endpoint","description":"Find shortest path between two entities in the knowledge graph.","operationId":"graph_path_endpoint_graph_path_get","parameters":[{"name":"agent_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":128,"title":"Agent Id"}},{"name":"source","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":256,"title":"Source"}},{"name":"target","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":256,"title":"Target"}},{"name":"max_depth","in":"query","required":false,"schema":{"type":"integer","maximum":6,"minimum":1,"default":4,"title":"Max Depth"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/memories/{memory_id}/history":{"get":{"summary":"Memory History Endpoint","description":"Get full version history for a memory.","operationId":"memory_history_endpoint_memories__memory_id__history_get","parameters":[{"name":"memory_id","in":"path","required":true,"schema":{"type":"string","title":"Memory Id"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks":{"post":{"summary":"Create Webhook Endpoint","description":"Register a webhook for memory events.","operationId":"create_webhook_endpoint_webhooks_post","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"List Webhooks Endpoint","description":"List all webhooks for the current tenant.","operationId":"list_webhooks_endpoint_webhooks_get","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/{webhook_id}":{"delete":{"summary":"Delete Webhook Endpoint","description":"Delete a webhook.","operationId":"delete_webhook_endpoint_webhooks__webhook_id__delete","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","title":"Webhook Id"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/criteria":{"post":{"summary":"Create Criteria Endpoint","description":"Create a custom recall scoring criteria.","operationId":"create_criteria_endpoint_criteria_post","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CriteriaRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"List Criteria Endpoint","description":"List all criteria for an agent.","operationId":"list_criteria_endpoint_criteria_get","parameters":[{"name":"agent_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":128,"title":"Agent Id"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/criteria/{criteria_id}":{"delete":{"summary":"Delete Criteria Endpoint","description":"Delete a criteria.","operationId":"delete_criteria_endpoint_criteria__criteria_id__delete","parameters":[{"name":"criteria_id","in":"path","required":true,"schema":{"type":"string","title":"Criteria Id"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/schemas":{"post":{"summary":"Create Schema Endpoint","description":"Create a custom extraction schema.","operationId":"create_schema_endpoint_schemas_post","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"List Schemas Endpoint","description":"List all schemas for the current tenant.","operationId":"list_schemas_endpoint_schemas_get","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/schemas/{schema_id}":{"delete":{"summary":"Delete Schema Endpoint","description":"Delete a schema.","operationId":"delete_schema_endpoint_schemas__schema_id__delete","parameters":[{"name":"schema_id","in":"path","required":true,"schema":{"type":"string","title":"Schema Id"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/memories/batch-delete":{"post":{"summary":"Batch Delete Endpoint","description":"Delete multiple memories in one request.","operationId":"batch_delete_endpoint_memories_batch_delete_post","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchDeleteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/memories/batch-search":{"post":{"summary":"Batch Search Endpoint","description":"Search with multiple queries in one request.","operationId":"batch_search_endpoint_memories_batch_search_post","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchSearchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/org/memories":{"post":{"summary":"Store Org Memory Endpoint","description":"Store an organization-level shared memory.","operationId":"store_org_memory_endpoint_org_memories_post","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgMemoryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"List Org Memories Endpoint","description":"List org-level memories.","operationId":"list_org_memories_endpoint_org_memories_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/org/memories/recall":{"get":{"summary":"Recall Org Memories Endpoint","description":"Recall relevant org-level memories by semantic search.","operationId":"recall_org_memories_endpoint_org_memories_recall_get","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":500,"title":"Q"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":10,"title":"Limit"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/memories/{memory_id}/promote":{"post":{"summary":"Promote To Org Endpoint","description":"Promote an agent memory to organization level.","operationId":"promote_to_org_endpoint_memories__memory_id__promote_post","parameters":[{"name":"memory_id","in":"path","required":true,"schema":{"type":"string","title":"Memory Id"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/org/memories/{memory_id}":{"delete":{"summary":"Delete Org Memory Endpoint","description":"Delete an org memory.","operationId":"delete_org_memory_endpoint_org_memories__memory_id__delete","parameters":[{"name":"memory_id","in":"path","required":true,"schema":{"type":"string","title":"Memory Id"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant-info":{"get":{"summary":"Get Tenant Info","description":"Get current tenant information.","operationId":"get_tenant_info_tenant_info_get","parameters":[{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantInfo"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/usage":{"get":{"summary":"Get Usage","description":"Get API usage stats for current tenant.","operationId":"get_usage_usage_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":1,"default":7,"title":"Days"}},{"name":"X-API-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api-keys":{"post":{"summary":"Create Api Key","description":"Create a new tenant and API key. Requires admin authentication.","operationId":"create_api_key_api_keys_post","parameters":[{"name":"X-Admin-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Admin-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTenantRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTenantResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/rotate-key/{tenant_id}":{"post":{"summary":"Rotate Api Key","description":"Rotate API key for a tenant. Old key is immediately invalidated.","operationId":"rotate_api_key_admin_rotate_key__tenant_id__post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Admin-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Admin-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RotateKeyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/revoke-key/{tenant_id}":{"post":{"summary":"Revoke Api Key","description":"Revoke API key by deactivating tenant. Immediate effect.","operationId":"revoke_api_key_admin_revoke_key__tenant_id__post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Admin-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Admin-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/reactivate/{tenant_id}":{"post":{"summary":"Reactivate Tenant","description":"Reactivate a previously revoked tenant.","operationId":"reactivate_tenant_admin_reactivate__tenant_id__post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Admin-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Admin-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants":{"get":{"summary":"List Tenants","description":"List all tenants. Admin only.","operationId":"list_tenants_admin_tenants_get","parameters":[{"name":"X-Admin-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Admin-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AsyncExtractRequest":{"properties":{"agent_id":{"type":"string","maxLength":128,"minLength":1,"title":"Agent Id"},"content":{"type":"string","maxLength":100000,"minLength":1,"title":"Content"},"session_key":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}],"title":"Session Key"}},"type":"object","required":["agent_id","content"],"title":"AsyncExtractRequest"},"AuthResponse":{"properties":{"token":{"type":"string","title":"Token"},"user":{"additionalProperties":true,"type":"object","title":"User"},"is_new":{"type":"boolean","title":"Is New","default":false},"api_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Key"}},"type":"object","required":["token","user"],"title":"AuthResponse"},"BatchDeleteRequest":{"properties":{"memory_ids":{"items":{"type":"string"},"type":"array","maxItems":100,"minItems":1,"title":"Memory Ids"}},"type":"object","required":["memory_ids"],"title":"BatchDeleteRequest"},"BatchExtractItem":{"properties":{"agent_id":{"type":"string","maxLength":128,"minLength":1,"title":"Agent Id"},"human_message":{"type":"string","maxLength":50000,"minLength":1,"title":"Human Message"},"agent_message":{"type":"string","maxLength":50000,"minLength":1,"title":"Agent Message"},"session_key":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}],"title":"Session Key"},"turn_id":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}],"title":"Turn Id"}},"type":"object","required":["agent_id","human_message","agent_message"],"title":"BatchExtractItem"},"BatchExtractRequest":{"properties":{"turns":{"items":{"$ref":"#/components/schemas/BatchExtractItem"},"type":"array","maxItems":50,"minItems":1,"title":"Turns"}},"type":"object","required":["turns"],"title":"BatchExtractRequest"},"BatchSearchRequest":{"properties":{"agent_id":{"type":"string","maxLength":128,"minLength":1,"title":"Agent Id"},"queries":{"items":{"type":"string"},"type":"array","maxItems":20,"minItems":1,"title":"Queries"},"limit_per_query":{"type":"integer","maximum":50.0,"minimum":1.0,"title":"Limit Per Query","default":10}},"type":"object","required":["agent_id","queries"],"title":"BatchSearchRequest"},"CheckoutRequest":{"properties":{"plan":{"type":"string","title":"Plan","default":"pro"}},"type":"object","title":"CheckoutRequest"},"CheckoutResponse":{"properties":{"checkout_url":{"type":"string","title":"Checkout Url"}},"type":"object","required":["checkout_url"],"title":"CheckoutResponse"},"CreateTenantRequest":{"properties":{"name":{"type":"string","maxLength":256,"minLength":1,"title":"Name"},"plan":{"type":"string","pattern":"^(free|pro|enterprise)$","title":"Plan","default":"free"}},"type":"object","required":["name"],"title":"CreateTenantRequest"},"CreateTenantResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"name":{"type":"string","title":"Name"},"api_key":{"type":"string","title":"Api Key"},"plan":{"type":"string","title":"Plan"},"created_at":{"type":"string","title":"Created At"},"memory_limit":{"type":"integer","title":"Memory Limit"},"rate_limit_rpm":{"type":"integer","title":"Rate Limit Rpm"}},"type":"object","required":["tenant_id","name","api_key","plan","created_at","memory_limit","rate_limit_rpm"],"title":"CreateTenantResponse"},"CriteriaRequest":{"properties":{"agent_id":{"type":"string","maxLength":128,"minLength":1,"title":"Agent Id"},"name":{"type":"string","maxLength":64,"minLength":1,"title":"Name"},"weight":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Weight","default":0.5},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description"},"scoring_prompt":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Scoring Prompt"}},"type":"object","required":["agent_id","name"],"title":"CriteriaRequest"},"EmailLoginRequest":{"properties":{"email":{"type":"string","maxLength":320,"minLength":5,"title":"Email"},"password":{"type":"string","maxLength":128,"minLength":1,"title":"Password"}},"type":"object","required":["email","password"],"title":"EmailLoginRequest"},"EmailRegisterRequest":{"properties":{"email":{"type":"string","maxLength":320,"minLength":5,"title":"Email"},"password":{"type":"string","maxLength":128,"minLength":8,"title":"Password"},"name":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}],"title":"Name"}},"type":"object","required":["email","password"],"title":"EmailRegisterRequest"},"ExtractRequest":{"properties":{"agent_id":{"type":"string","maxLength":128,"minLength":1,"title":"Agent Id"},"human_message":{"type":"string","maxLength":50000,"minLength":1,"title":"Human Message"},"agent_message":{"type":"string","maxLength":50000,"minLength":1,"title":"Agent Message"},"session_key":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}],"title":"Session Key"},"turn_id":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}],"title":"Turn Id"}},"type":"object","required":["agent_id","human_message","agent_message"],"title":"ExtractRequest"},"ExtractResponse":{"properties":{"memories_stored":{"type":"integer","title":"Memories Stored"},"memory_ids":{"items":{"type":"string"},"type":"array","title":"Memory Ids"}},"type":"object","required":["memories_stored","memory_ids"],"title":"ExtractResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthResponse":{"properties":{"status":{"type":"string","title":"Status"},"version":{"type":"string","title":"Version"},"timestamp":{"type":"string","title":"Timestamp"},"memories_total":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Memories Total"},"db_pool":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Db Pool"},"redis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Redis"}},"type":"object","required":["status","version","timestamp"],"title":"HealthResponse"},"MemoryItem":{"properties":{"id":{"type":"string","title":"Id"},"headline":{"type":"string","title":"Headline"},"memory_type":{"type":"string","title":"Memory Type"},"importance":{"type":"number","title":"Importance"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","headline","memory_type","importance","created_at"],"title":"MemoryItem"},"OrgMemoryRequest":{"properties":{"headline":{"type":"string","maxLength":500,"minLength":1,"title":"Headline"},"context":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Context"},"full_content":{"anyOf":[{"type":"string","maxLength":10000},{"type":"null"}],"title":"Full Content"},"memory_type":{"type":"string","maxLength":32,"title":"Memory Type","default":"fact"},"importance":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Importance","default":0.5},"entities":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Entities"},"categories":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Categories"}},"type":"object","required":["headline"],"title":"OrgMemoryRequest"},"PortalResponse":{"properties":{"portal_url":{"type":"string","title":"Portal Url"}},"type":"object","required":["portal_url"],"title":"PortalResponse"},"RecallRequest":{"properties":{"agent_id":{"type":"string","maxLength":128,"minLength":1,"title":"Agent Id"},"conversation_context":{"type":"string","maxLength":50000,"minLength":1,"title":"Conversation Context"},"budget_tokens":{"type":"integer","maximum":16000.0,"minimum":500.0,"title":"Budget Tokens","default":4000},"dynamic_budget":{"type":"boolean","title":"Dynamic Budget","default":false}},"type":"object","required":["agent_id","conversation_context"],"title":"RecallRequest"},"RecallResponse":{"properties":{"context_block":{"type":"string","title":"Context Block"},"memories_used":{"type":"integer","title":"Memories Used"},"tokens_used":{"type":"integer","title":"Tokens Used"}},"type":"object","required":["context_block","memories_used","tokens_used"],"title":"RecallResponse"},"RotateKeyResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"new_api_key":{"type":"string","title":"New Api Key"},"message":{"type":"string","title":"Message"}},"type":"object","required":["tenant_id","new_api_key","message"],"title":"RotateKeyResponse"},"SchemaRequest":{"properties":{"name":{"type":"string","maxLength":128,"minLength":1,"title":"Name"},"schema":{"additionalProperties":true,"type":"object","title":"Schema"},"extraction_prompt":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Extraction Prompt"}},"type":"object","required":["name","schema"],"title":"SchemaRequest"},"SubscriptionResponse":{"properties":{"has_subscription":{"type":"boolean","title":"Has Subscription"},"plan":{"type":"string","title":"Plan"},"plan_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan Name"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"current_period_start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Period Start"},"current_period_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Period End"},"stripe_subscription_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Subscription Id"}},"type":"object","required":["has_subscription","plan"],"title":"SubscriptionResponse"},"TenantInfo":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"plan":{"type":"string","title":"Plan"},"memory_limit":{"type":"integer","title":"Memory Limit"},"rate_limit_rpm":{"type":"integer","title":"Rate Limit Rpm"},"api_calls_count":{"type":"integer","title":"Api Calls Count"}},"type":"object","required":["id","name","plan","memory_limit","rate_limit_rpm","api_calls_count"],"title":"TenantInfo"},"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"},"WebhookRequest":{"properties":{"url":{"type":"string","maxLength":2048,"minLength":10,"title":"Url"},"events":{"items":{"type":"string"},"type":"array","maxItems":10,"minItems":1,"title":"Events"},"secret":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}],"title":"Secret"}},"type":"object","required":["url","events"],"title":"WebhookRequest"}}}}