{
  "openapi": "3.1.0",
  "info": {
    "title": "CCLEAR Public Data API",
    "version": "1.0.0",
    "summary": "Read-only access to CCLEAR's published research on U.S. Regulation Crowdfunding.",
    "description": "CCLEAR is the hand-verified data record of U.S. Regulation Crowdfunding (Reg CF) since May 2016, sourced from SEC EDGAR. This public API exposes CCLEAR's published research briefs, weekly tear-sheet issues, and service metadata. The full transaction-level corpus is available under a data license — see https://cclear.ai/data-licensing. All errors are returned as JSON.",
    "termsOfService": "https://cclear.ai/terms",
    "contact": {
      "name": "CCLEAR",
      "url": "https://cclear.ai/data-licensing"
    },
    "license": {
      "name": "CCLEAR Terms of Service",
      "url": "https://cclear.ai/terms"
    }
  },
  "servers": [
    {
      "url": "https://cclear.ai/api/v1",
      "description": "Static JSON snapshots served from the site origin."
    },
    {
      "url": "https://api.cclear.ai/v1",
      "description": "Dynamic API (live weekly issues, structured JSON errors). Requires no authentication for public endpoints."
    }
  ],
  "paths": {
    "/index.json": {
      "get": {
        "operationId": "getApiIndex",
        "summary": "API discovery document",
        "description": "Lists every available endpoint, the data license, and contact routes.",
        "responses": {
          "200": {
            "description": "API index",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/health.json": {
      "get": {
        "operationId": "getHealth",
        "summary": "Service health",
        "responses": {
          "200": {
            "description": "Health document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "version": {
                      "type": "string"
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Resource not found. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/briefs.json": {
      "get": {
        "operationId": "listBriefs",
        "summary": "List published research briefs",
        "responses": {
          "200": {
            "description": "Brief collection",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Brief"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Resource not found. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/briefs/{slug}.json": {
      "get": {
        "operationId": "getBrief",
        "summary": "Retrieve one research brief",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "democratized-capital"
          }
        ],
        "responses": {
          "200": {
            "description": "Brief document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Brief"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/weekly-issues": {
      "get": {
        "operationId": "listWeeklyIssues",
        "summary": "List published weekly tear-sheet issues",
        "description": "Live endpoint on the dynamic server. Returns published issues with headline KPIs for the week.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Weekly issue collection",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WeeklyIssue"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Resource not found. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error. Structured JSON error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "example": "not_found"
              },
              "message": {
                "type": "string",
                "example": "No resource matches this path."
              },
              "hint": {
                "type": "string",
                "example": "See https://cclear.ai/openapi.json for the available endpoints."
              },
              "status": {
                "type": "integer",
                "example": 404
              },
              "documentation_url": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      },
      "Brief": {
        "type": "object",
        "required": [
          "slug",
          "title",
          "summary",
          "url"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "number": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "one_liner": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "audience": {
            "type": "string"
          },
          "headline_stat": {
            "type": "object",
            "properties": {
              "value": {
                "type": "string"
              },
              "label": {
                "type": "string"
              }
            }
          },
          "key_findings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "faq": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "question": {
                  "type": "string"
                },
                "answer": {
                  "type": "string"
                }
              }
            }
          },
          "date_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "pdf_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "source": {
            "type": "string"
          },
          "license": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "WeeklyIssue": {
        "type": "object",
        "properties": {
          "issue_number": {
            "type": [
              "integer",
              "null"
            ]
          },
          "period_start": {
            "type": "string",
            "format": "date"
          },
          "period_end": {
            "type": "string",
            "format": "date"
          },
          "cadence": {
            "type": "string",
            "example": "weekly"
          },
          "tier": {
            "type": "string",
            "enum": [
              "free",
              "pro"
            ]
          },
          "kpis": {
            "type": "object",
            "additionalProperties": true
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    }
  }
}
