{
  "openapi": "3.0.3",
  "info": {
    "title": "OWSPACE Archive",
    "version": "1.0.0",
    "description": "Integrate OWSPACE (单向历) calendar images into your own app using date metadata and image redirects. Self-hostable, read-only API; /preview is an integration demo. A separate script supports local archives, which are not served by this API. Image links are generated without upstream availability verification, OCR, or text extraction. Calendar content and images belong to OWSPACE (单向空间). This is a non-profit, unofficial project maintained by community enthusiasts. Please support the official OWSPACE calendar: https://www.owspace.com/calendar.html"
  },
  "paths": {
    "/api/v1/calendar/today": {
      "get": {
        "summary": "Get calendar image metadata",
        "parameters": [
          {
            "name": "timezone",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "Asia/Shanghai"
            },
            "description": "IANA timezone, e.g. Australia/Melbourne"
          }
        ],
        "responses": {
          "200": {
            "description": "Generated image links; upstream availability is not checked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Calendar"
                }
              }
            }
          },
          "400": {
            "description": "Invalid date or timezone"
          }
        }
      }
    },
    "/api/v1/calendar/today/image": {
      "get": {
        "summary": "Redirect to calendar image",
        "parameters": [
          {
            "name": "timezone",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "Asia/Shanghai"
            },
            "description": "IANA timezone, e.g. Australia/Melbourne"
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to external wsrv.nl image proxy",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "400": {
            "description": "Invalid date or timezone"
          }
        }
      }
    },
    "/api/v1/calendar/{date}": {
      "get": {
        "summary": "Get calendar image metadata",
        "parameters": [
          {
            "name": "date",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Generated image links; upstream availability is not checked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Calendar"
                }
              }
            }
          },
          "400": {
            "description": "Invalid date or timezone"
          }
        }
      }
    },
    "/api/v1/calendar/{date}/image": {
      "get": {
        "summary": "Redirect to calendar image",
        "parameters": [
          {
            "name": "date",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to external wsrv.nl image proxy",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "400": {
            "description": "Invalid date or timezone"
          }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "Service health",
        "responses": {
          "200": {
            "description": "Service is running"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Calendar": {
        "type": "object",
        "required": [
          "date",
          "year",
          "month",
          "day",
          "sourceUrl",
          "imageUrl",
          "attribution",
          "availability"
        ],
        "properties": {
          "date": {
            "type": "string"
          },
          "year": {
            "type": "integer"
          },
          "month": {
            "type": "integer"
          },
          "day": {
            "type": "integer"
          },
          "sourceUrl": {
            "type": "string"
          },
          "imageUrl": {
            "type": "string"
          },
          "attribution": {
            "type": "string"
          },
          "availability": {
            "type": "string"
          }
        }
      }
    }
  },
  "externalDocs": {
    "description": "Support the official OWSPACE calendar / 支持单向空间官方单向历",
    "url": "https://www.owspace.com/calendar.html"
  },
  "servers": [
    {
      "url": "https://owspace-api.songhai.site",
      "description": "Public OWSPACE Archive API"
    },
    {
      "url": "http://127.0.0.1:3000",
      "description": "Optional local self-hosting"
    }
  ]
}
