{"openapi":"3.0.3","info":{"title":"Ontogent Context API","description":"The context platform for agentic GTM. Context assembly, delivery profiles, brand rules, intelligence signals, job inventory, deployment plans, feedback loops, cross-client patterns, compliance linting, and knowledge graph traversal.","version":"2.0.0","contact":{"name":"Ontogent","url":"https://ontogent.ai"}},"servers":[{"url":"https://ontogent.ai","description":"Current environment"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key (ilk_...)","description":"Pass your Ontogent API key as a Bearer token."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"status":{"type":"integer"}}}}},"ContextRequest":{"type":"object","required":["task"],"properties":{"task":{"type":"string","description":"Task slug or description"},"product":{"type":"string"},"persona":{"type":"string"},"vertical":{"type":"string"},"channel":{"type":"string"},"competitor":{"type":"string"},"max_tokens":{"type":"integer","default":6000},"format":{"type":"string","enum":["markdown","json","xml"],"default":"markdown"}}},"LintRequest":{"type":"object","required":["content"],"properties":{"content":{"type":"string","description":"Marketing content to lint"},"format":{"type":"string"}}},"LintResult":{"type":"object","properties":{"violations":{"type":"array","items":{"type":"object","properties":{"ruleType":{"type":"string"},"severity":{"type":"string","enum":["error","warning"]},"message":{"type":"string"},"found":{"type":"string"},"expected":{"type":"string","nullable":true},"replacement":{"type":"string","nullable":true}}}},"errorCount":{"type":"integer"},"warningCount":{"type":"integer"},"verdict":{"type":"string","enum":["ready","not_ready"]}}},"ScoreBreakdown":{"type":"object","properties":{"total":{"type":"number"},"coverage":{"type":"object"},"consistency":{"type":"object"},"freshness":{"type":"object"},"connectivity":{"type":"object"}}},"DocumentSummary":{"type":"object","properties":{"slug":{"type":"string"},"title":{"type":"string"},"layer":{"type":"string","enum":["foundation","audience","channel"]},"category":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","approved"]},"version":{"type":"integer"},"updated_at":{"type":"string","format":"date-time"}}},"AgentSummary":{"type":"object","properties":{"slug":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"gtm_function":{"type":"string"},"status":{"type":"string","enum":["draft","active","archived"]},"knowledge_nodes":{"type":"array","items":{"type":"string"}},"deployments":{"type":"object"}}},"Graph":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string"},"title":{"type":"string"},"layer":{"type":"string"},"category":{"type":"string"}}}},"edges":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"target":{"type":"string"},"relationship_type":{"type":"string"}}}}}},"CreateKeyRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}}}},"WebhookRegisterRequest":{"type":"object","required":["url","events"],"properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"},"description":"Event types: document.created, document.updated, document.deleted, document.approved, score.changed, agent.deployed, alert.created"}}}}},"paths":{"/api/v1/context":{"post":{"summary":"Assemble context payload","description":"Assembles an optimized context payload for a given GTM task by traversing the knowledge graph.","operationId":"assembleContext","tags":["Context"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextRequest"}}}},"responses":{"200":{"description":"Context assembled successfully"},"400":{"description":"Bad request"},"401":{"description":"Unauthorized"}}}},"/api/v1/lint":{"post":{"summary":"Lint marketing content","description":"Checks content against the client Ontogent for compliance violations.","operationId":"lintContent","tags":["Lint"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LintRequest"}}}},"responses":{"200":{"description":"Lint result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LintResult"}}}},"401":{"description":"Unauthorized"}}}},"/api/v1/score":{"get":{"summary":"Get Ontogent health score","description":"Returns a breakdown of coverage, consistency, freshness, and connectivity scores.","operationId":"getScore","tags":["Score"],"responses":{"200":{"description":"Score breakdown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScoreBreakdown"}}}},"401":{"description":"Unauthorized"}}}},"/api/v1/documents":{"get":{"summary":"List documents","description":"Returns all documents in the Ontogent for the authenticated client.","operationId":"listDocuments","tags":["Documents"],"parameters":[{"name":"layer","in":"query","schema":{"type":"string","enum":["foundation","audience","channel"]}},{"name":"category","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string","enum":["draft","in_review","approved"]}}],"responses":{"200":{"description":"Document list","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DocumentSummary"}}}}},"401":{"description":"Unauthorized"}}}},"/api/v1/documents/by-slug/{slug}":{"get":{"summary":"Get document by slug","description":"Returns a single document including full content_human and content_machine fields.","operationId":"getDocument","tags":["Documents"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Full document"},"401":{"description":"Unauthorized"},"404":{"description":"Document not found"}}}},"/api/v1/agents":{"get":{"summary":"List agents","description":"Returns all agents configured for the authenticated client.","operationId":"listAgents","tags":["Agents"],"responses":{"200":{"description":"Agent list","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AgentSummary"}}}}},"401":{"description":"Unauthorized"}}}},"/api/v1/agents/{slug}":{"get":{"summary":"Get agent by slug","description":"Returns a single agent including the full system_prompt.","operationId":"getAgent","tags":["Agents"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Full agent"},"401":{"description":"Unauthorized"},"404":{"description":"Agent not found"}}}},"/api/v1/graph":{"get":{"summary":"Get knowledge graph","description":"Returns all nodes (documents) and edges (relationships) for the client.","operationId":"getGraph","tags":["Graph"],"responses":{"200":{"description":"Graph data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Graph"}}}},"401":{"description":"Unauthorized"}}}},"/api/v1/graph/traverse":{"get":{"summary":"Traverse knowledge graph","description":"Returns nodes reachable from a starting document within a given depth.","operationId":"traverseGraph","tags":["Graph"],"parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string"},"description":"Starting document slug"},{"name":"depth","in":"query","schema":{"type":"integer","default":2},"description":"Max traversal depth (1-10)"},{"name":"types","in":"query","schema":{"type":"string"},"description":"Comma-separated relationship types to follow"}],"responses":{"200":{"description":"Traversal result"},"400":{"description":"Missing from parameter"},"401":{"description":"Unauthorized"}}}},"/api/v1/keys":{"get":{"summary":"List API keys","description":"Returns all active API keys for the client. Never exposes the actual key value.","operationId":"listKeys","tags":["Admin"],"responses":{"200":{"description":"Key list"},"401":{"description":"Unauthorized"},"403":{"description":"Requires admin scope"}}},"post":{"summary":"Create API key","description":"Creates a new API key. The full key is returned ONCE in this response.","operationId":"createKey","tags":["Admin"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKeyRequest"}}}},"responses":{"201":{"description":"Key created (includes full key value)"},"401":{"description":"Unauthorized"},"403":{"description":"Requires admin scope"}}}},"/api/v1/webhooks":{"get":{"summary":"List webhooks","description":"Returns all registered webhooks for the client.","operationId":"listWebhooks","tags":["Admin"],"responses":{"200":{"description":"Webhook list"},"401":{"description":"Unauthorized"},"403":{"description":"Requires admin scope"}}},"post":{"summary":"Register webhook","description":"Registers a new webhook endpoint. Returns the webhook ID and signing secret.","operationId":"registerWebhook","tags":["Admin"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRegisterRequest"}}}},"responses":{"201":{"description":"Webhook registered (includes signing secret)"},"401":{"description":"Unauthorized"},"403":{"description":"Requires admin scope"}}}},"/api/v1/profiles":{"get":{"summary":"Get delivery profiles","description":"Returns active context delivery profiles. Use ?name=slug for a single profile with full config.","operationId":"getProfiles","tags":["Context Platform"],"parameters":[{"name":"name","in":"query","schema":{"type":"string"},"description":"Profile slug to fetch"}],"responses":{"200":{"description":"Profile list or single profile"},"401":{"description":"Unauthorized"}}}},"/api/v1/rules":{"get":{"summary":"Get brand rules & governance","description":"Returns tenets, brand rules, and governance gates. Agents check these before producing output.","operationId":"getRules","tags":["Context Platform"],"parameters":[{"name":"category","in":"query","schema":{"type":"string"},"description":"Filter by category"},{"name":"visibility","in":"query","schema":{"type":"string"},"description":"Filter by visibility"}],"responses":{"200":{"description":"Rules, tenets, and gates"},"401":{"description":"Unauthorized"}}}},"/api/v1/intelligence":{"get":{"summary":"Get intelligence signals","description":"Returns blindspots, patterns, competitive nodes, and feedback signals.","operationId":"getIntelligence","tags":["Context Platform"],"parameters":[{"name":"type","in":"query","schema":{"type":"string"},"description":"blindspot, pattern, recommendation, competitive"},{"name":"status","in":"query","schema":{"type":"string"},"description":"active, acknowledged, resolved"},{"name":"limit","in":"query","schema":{"type":"integer"},"description":"Max results (default 20)"}],"responses":{"200":{"description":"Intelligence data"},"401":{"description":"Unauthorized"}}}},"/api/v1/jobs":{"get":{"summary":"Get job inventory","description":"Returns GTM job inventory with ARI scores. Use ?view=opportunity for automation wedge analysis.","operationId":"getJobs","tags":["Context Platform"],"parameters":[{"name":"view","in":"query","schema":{"type":"string"},"description":"summary or opportunity"},{"name":"function_area","in":"query","schema":{"type":"string"},"description":"GTM function filter"},{"name":"ari_tier","in":"query","schema":{"type":"integer"},"description":"Tier: 1-4"},{"name":"nobody","in":"query","schema":{"type":"boolean"},"description":"Show abandoned tasks only"}],"responses":{"200":{"description":"Job inventory"},"401":{"description":"Unauthorized"}}}},"/api/v1/plan":{"get":{"summary":"Get deployment plan","description":"Returns priority-ranked agent deployment roadmap with scores and agent metadata.","operationId":"getPlan","tags":["Context Platform"],"responses":{"200":{"description":"Deployment plan"},"401":{"description":"Unauthorized"}}}},"/api/v1/feedback":{"post":{"summary":"Report output feedback","description":"Agent reports approval/rejection. Closes the performance compounding loop — promotes or decays artifacts.","operationId":"reportFeedback","tags":["Context Platform"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["fleet_agent_id","output_type","status"],"properties":{"fleet_agent_id":{"type":"string","format":"uuid"},"output_type":{"type":"string"},"status":{"type":"string","enum":["approved","rejected"]},"rejection_reason":{"type":"string"},"output_summary":{"type":"string"},"artifacts_used":{"type":"array","items":{"type":"string","format":"uuid"}},"context_profile_used":{"type":"string"}}}}}},"responses":{"200":{"description":"Feedback recorded, artifacts updated"},"400":{"description":"Bad request"},"401":{"description":"Unauthorized"}}}},"/api/v1/patterns":{"get":{"summary":"Get cross-client patterns","description":"Returns anonymized patterns for your archetype/stage. No client-specific data exposed.","operationId":"getPatterns","tags":["Context Platform"],"responses":{"200":{"description":"Cross-client patterns"},"401":{"description":"Unauthorized"}}}},"/api/v1/openapi":{"get":{"summary":"OpenAPI specification","description":"Returns this OpenAPI 3.0 spec. No authentication required.","operationId":"getOpenApiSpec","tags":["Discovery"],"security":[],"responses":{"200":{"description":"OpenAPI 3.0 specification"}}}}}}