{
  "openapi": "3.1.0",
  "info": {
    "title": "iNoU Platform API Gateway",
    "version": {
      "majorVersion": 0,
      "minorMilestone": 4,
      "buildIteration": 76,
      "deployedPercentage": 0,
      "specRevisionIndex": 4,
      "implementationPercentage": 76,
      "fullVersionString": "0.4.76",
      "calculatedAt": "2026-09-14T06:00:44.728Z"
    },
    "description": "Canonical REST & Real-Time Event Bus API for the iNoU Cognitive OS. Provides multi-client management of projects, workspaces, DAG tasks, preferences, and real-time SSE streaming.",
    "contact": {
      "name": "iNoU Core Team",
      "url": "https://inou.dev"
    },
    "license": {
      "name": "MIT"
    }
  },
  "servers": [
    {
      "url": "http://127.0.0.1:8765",
      "description": "Local Development Server"
    },
    {
      "url": "/api",
      "description": "Relative API Base"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "System Health & Diagnostics",
        "description": "Returns the operational health and readiness of the iNoU node.",
        "responses": {
          "200": {
            "description": "Healthy system status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InuoApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/features": {
      "get": {
        "summary": "Get Feature Flags",
        "description": "Returns active client and ecosystem feature flags, including navigator visibility.",
        "responses": {
          "200": {
            "description": "Feature flags map",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "enableInouNavigator": {
                          "type": "boolean",
                          "description": "Whether iNoU Navigator Chrome tab is enabled"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/projects": {
      "get": {
        "summary": "List Projects",
        "description": "Retrieves all registered project containers.",
        "responses": {
          "200": {
            "description": "List of projects",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InouProject"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create Project",
        "description": "Creates a new project container.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "jurisdiction": {
                    "type": "string"
                  },
                  "metadata": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Project successfully created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InuoApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/workspaces": {
      "get": {
        "summary": "List Workspaces",
        "description": "Retrieves all active filesystem workspaces.",
        "responses": {
          "200": {
            "description": "List of workspaces",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InouWorkspace"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Add Workspace",
        "description": "Registers a directory path as a workspace.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "path"
                ],
                "properties": {
                  "path": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Workspace registered",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InuoApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks": {
      "get": {
        "summary": "List Tasks / DAG Nodes",
        "description": "Retrieves task DAG nodes, needs, and offers.",
        "responses": {
          "200": {
            "description": "List of tasks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InouTask"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create Task / Need / Offer",
        "description": "Creates a new task node in the execution graph.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "title"
                ],
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "task",
                      "need",
                      "offer"
                    ]
                  },
                  "status": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Task created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InuoApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/preferences": {
      "get": {
        "summary": "List Preferences",
        "description": "Retrieves user preferences and UI configuration settings.",
        "responses": {
          "200": {
            "description": "Active preferences",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InouPreference"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Set Preference",
        "description": "Updates or adds a user preference key-value pair.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "key",
                  "value"
                ],
                "properties": {
                  "key": {
                    "type": "string"
                  },
                  "value": {}
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preference updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InuoApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/chats": {
      "get": {
        "summary": "List Chat Sessions",
        "description": "Retrieves available chat sessions and conversation history.",
        "responses": {
          "200": {
            "description": "List of chat sessions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InuoApiResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create Chat Session",
        "description": "Initializes a new isolated conversation thread.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "provider_id": {
                    "type": "string"
                  },
                  "model_type": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Chat created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InuoApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/stream": {
      "get": {
        "summary": "Real-Time Event Bus (Server-Sent Events)",
        "description": "Persistent SSE stream broadcasting real-time platform events, CLI output, task state transitions, and mesh gossip notifications.",
        "responses": {
          "200": {
            "description": "SSE Event Stream",
            "content": {
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/InuoEventEnvelope"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "InuoApiResponse": {
        "type": "object",
        "required": [
          "success"
        ],
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "nullable": true
          },
          "error": {
            "type": "string",
            "nullable": true
          },
          "meta": {
            "type": "object",
            "properties": {
              "timestamp": {
                "type": "string",
                "format": "date-time"
              },
              "version": {
                "type": "string"
              }
            }
          }
        }
      },
      "InouProject": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "jurisdiction": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended",
              "archived"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "InouWorkspace": {
        "type": "object",
        "required": [
          "id",
          "path"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          }
        }
      },
      "InouTask": {
        "type": "object",
        "required": [
          "id",
          "title"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "task",
              "need",
              "offer"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "in_progress",
              "completed",
              "blocked"
            ]
          },
          "dependencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "InouPreference": {
        "type": "object",
        "required": [
          "key",
          "value"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "value": {},
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "InouEventEnvelope": {
        "type": "object",
        "required": [
          "eventId",
          "eventType",
          "entity",
          "action",
          "timestamp",
          "payload"
        ],
        "properties": {
          "eventId": {
            "type": "string",
            "format": "uuid"
          },
          "eventType": {
            "type": "string",
            "example": "task.created"
          },
          "entity": {
            "type": "string",
            "enum": [
              "project",
              "workspace",
              "task",
              "memory",
              "preference"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "add",
              "update",
              "enable",
              "disable",
              "remove",
              "list"
            ]
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "sourceNodeId": {
            "type": "string"
          },
          "payload": {
            "type": "object"
          }
        }
      },
      "InuoEventEnvelope": {
        "type": "object",
        "required": [
          "eventId",
          "eventType",
          "entity",
          "action",
          "timestamp",
          "payload"
        ],
        "properties": {
          "eventId": {
            "type": "string",
            "format": "uuid"
          },
          "eventType": {
            "type": "string",
            "example": "task.created"
          },
          "entity": {
            "type": "string",
            "enum": [
              "project",
              "workspace",
              "task",
              "memory",
              "preference"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "add",
              "update",
              "enable",
              "disable",
              "remove",
              "list"
            ]
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "sourceNodeId": {
            "type": "string"
          },
          "payload": {
            "type": "object"
          }
        }
      },
      "InouApiResponse": {
        "type": "object",
        "required": [
          "success"
        ],
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "nullable": true
          },
          "error": {
            "type": "string",
            "nullable": true
          },
          "meta": {
            "type": "object",
            "properties": {
              "timestamp": {
                "type": "string",
                "format": "date-time"
              },
              "version": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}