{
  "openapi": "3.0.0",
  "info": {
    "title": "VitaDAO Research API",
    "description": "Read-only API for VitaDAO longevity research projects and blog articles. VitaDAO is a decentralized autonomous organization funding early-stage longevity science via Intellectual Property Tokens (IPTs).",
    "version": "1.0.0",
    "contact": { "url": "https://www.vitadao.com" }
  },
  "servers": [
    { "url": "https://www.vitadao.com/api", "description": "VitaDAO Git-backed Content API" }
  ],
  "paths": {
    "/articles": {
      "get": {
        "operationId": "listArticles",
        "summary": "List blog articles",
        "description": "Returns VitaDAO blog articles about longevity research, project updates, newsletters, and DeSci topics.",
        "parameters": [
          { "name": "pagination[page]", "in": "query", "schema": { "type": "integer", "default": 1 } },
          { "name": "pagination[pageSize]", "in": "query", "schema": { "type": "integer", "default": 10, "maximum": 100 } },
          { "name": "sort", "in": "query", "schema": { "type": "string", "example": "publishedDate:desc" } },
          { "name": "filters[category][name][$eq]", "in": "query", "description": "Filter by category name", "schema": { "type": "string" } },
          { "name": "populate", "in": "query", "schema": { "type": "string", "example": "coverImage,category" } }
        ],
        "responses": {
          "200": {
            "description": "List of articles with pagination metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Article" }
                    },
                    "meta": { "$ref": "#/components/schemas/PaginationMeta" }
                  }
                }
              }
            }
          },
          "400": { "description": "Bad request — invalid filter or pagination parameters" }
        }
      }
    },
    "/articles/{documentId}": {
      "get": {
        "operationId": "getArticle",
        "summary": "Get a single blog article",
        "description": "Returns full content of a VitaDAO blog article including body HTML, cover image, and category.",
        "parameters": [
          { "name": "documentId", "in": "path", "required": true, "schema": { "type": "string" } },
          { "name": "populate", "in": "query", "schema": { "type": "string", "example": "coverImage,category,author" } }
        ],
        "responses": {
          "200": {
            "description": "Article detail with full content",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": { "$ref": "#/components/schemas/Article" },
                    "meta": { "type": "object" }
                  }
                }
              }
            }
          },
          "404": { "description": "Article not found" }
        }
      }
    },
    "/projects": {
      "get": {
        "operationId": "listProjects",
        "summary": "List funded research projects",
        "description": "Returns all longevity research projects funded or incubated by VitaDAO, including IPT details, therapeutic area, funding status, and project synopsis.",
        "parameters": [
          { "name": "pagination[page]", "in": "query", "schema": { "type": "integer", "default": 1 } },
          { "name": "pagination[pageSize]", "in": "query", "schema": { "type": "integer", "default": 25 } },
          { "name": "populate", "in": "query", "schema": { "type": "string", "example": "coverImage,therapeuthic_area_tags" } }
        ],
        "responses": {
          "200": {
            "description": "List of research projects",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Project" }
                    },
                    "meta": { "$ref": "#/components/schemas/PaginationMeta" }
                  }
                }
              }
            }
          },
          "400": { "description": "Bad request" }
        }
      }
    },
    "/projects/{documentId}": {
      "get": {
        "operationId": "getProject",
        "summary": "Get a single research project",
        "description": "Returns full details of a VitaDAO funded research project including synopsis, updates, team, and IPT information.",
        "parameters": [
          { "name": "documentId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Content document ID or slug of the project" },
          { "name": "populate", "in": "query", "schema": { "type": "string", "example": "deep" } }
        ],
        "responses": {
          "200": {
            "description": "Research project detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": { "$ref": "#/components/schemas/Project" },
                    "meta": { "type": "object" }
                  }
                }
              }
            }
          },
          "404": { "description": "Project not found" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Article": {
        "type": "object",
        "description": "A VitaDAO blog article about longevity research, project updates, or DeSci topics",
        "properties": {
          "id": { "type": "integer", "description": "Numeric article ID" },
          "documentId": { "type": "string", "description": "Content document ID (used in API paths)" },
          "title": { "type": "string", "description": "Article headline" },
          "slug": { "type": "string", "description": "URL-friendly slug for the article" },
          "summary": { "type": "string", "description": "Short summary or excerpt (1-3 sentences)" },
          "content": { "type": "string", "description": "Full article body as HTML" },
          "publishedDate": { "type": "string", "format": "date", "description": "Date the article was published" },
          "publishedAt": { "type": "string", "format": "date-time", "description": "ISO datetime of publication" },
          "updatedAt": { "type": "string", "format": "date-time", "description": "ISO datetime of last update" },
          "coverImage": {
            "type": "object",
            "description": "Cover image (populated with ?populate=coverImage)",
            "properties": {
              "url": { "type": "string", "description": "Relative or absolute URL to the image" },
              "alternativeText": { "type": "string" },
              "width": { "type": "integer" },
              "height": { "type": "integer" }
            }
          },
          "category": {
            "type": "object",
            "description": "Article category (populated with ?populate=category)",
            "properties": {
              "name": { "type": "string", "example": "Research Update" },
              "slug": { "type": "string" }
            }
          }
        }
      },
      "Project": {
        "type": "object",
        "description": "A longevity research project funded or incubated by VitaDAO via an Intellectual Property Token (IPT)",
        "properties": {
          "id": { "type": "integer" },
          "documentId": { "type": "string", "description": "Content document ID (used in API paths)" },
          "project_title": { "type": "string", "description": "Full name of the research project" },
          "slug": { "type": "string", "description": "URL-friendly slug for the project" },
          "project_synopsis": {
            "type": "array",
            "description": "Rich text synopsis as a block array. First item's first child text is the plain-text summary.",
            "items": { "type": "object" }
          },
          "therapeuthic_area_tags": {
            "type": "array",
            "description": "Therapeutic area tags (note: field name has a typo in the API). Returns a plain string[].",
            "items": { "type": "string" },
            "example": ["senolytics", "epigenetic reprogramming", "gene therapy"]
          },
          "funding_type": {
            "type": "string",
            "description": "How the project was funded",
            "enum": ["IP-NFT", "EQUITY", "INITIATIVE"]
          },
          "project_status": {
            "type": "string",
            "description": "Current status of the project",
            "example": "Active"
          },
          "updatedAt": { "type": "string", "format": "date-time" },
          "publishedAt": { "type": "string", "format": "date-time" },
          "hero_image": {
            "type": "object",
            "description": "Hero/cover image (populated with ?populate=hero_image)",
            "properties": {
              "url": { "type": "string" },
              "alternativeText": { "type": "string" },
              "width": { "type": "integer" },
              "height": { "type": "integer" }
            }
          },
          "project_body_copy": {
            "type": "string",
            "description": "Full project description as HTML (populated by default)"
          },
          "at_a_glance": {
            "type": "object",
            "description": "Key project metadata as arbitrary key-value pairs (e.g. funding amount, institution, PI name)",
            "additionalProperties": { "type": "string" }
          },
          "project_updates": {
            "type": "array",
            "description": "Project milestone updates (populated with ?populate=project_updates)",
            "items": {
              "type": "object",
              "properties": {
                "documentId": { "type": "string" },
                "title": { "type": "string" },
                "content": { "type": "string", "description": "Update body as HTML" },
                "date": { "type": "string", "format": "date" }
              }
            }
          },
          "project_people": {
            "type": "array",
            "description": "Team members and founders (populated with ?populate[project_people][populate][profile_photo]=true)",
            "items": {
              "type": "object",
              "properties": {
                "documentId": { "type": "string" },
                "name": { "type": "string" },
                "role": { "type": "string" },
                "bio": { "type": "string" },
                "profile_photo": {
                  "type": "object",
                  "properties": {
                    "url": { "type": "string" },
                    "alternativeText": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      },
      "PaginationMeta": {
        "type": "object",
        "description": "Pagination metadata",
        "properties": {
          "pagination": {
            "type": "object",
            "properties": {
              "page": { "type": "integer", "description": "Current page number" },
              "pageSize": { "type": "integer", "description": "Items per page" },
              "pageCount": { "type": "integer", "description": "Total number of pages" },
              "total": { "type": "integer", "description": "Total number of items" }
            }
          }
        }
      }
    }
  }
}
