{
  "openapi": "3.1.0",
  "info": {
    "title": "Cracked in Asia Public API",
    "version": "v1",
    "description": "Read-only API for published Cracked in Asia posts, signals, and categories."
  },
  "servers": [
    {
      "url": "https://www.crackedinasia.com"
    }
  ],
  "paths": {
    "/api/v1": {
      "get": {
        "summary": "API index",
        "responses": {
          "200": {
            "description": "Available public API endpoints",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/posts": {
      "get": {
        "summary": "List published posts",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "include",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "body"
              ]
            },
            "description": "Use include=body to include full article bodies."
          }
        ],
        "responses": {
          "200": {
            "description": "Published posts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "apiVersion": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Post"
                      }
                    },
                    "meta": {
                      "type": "object"
                    },
                    "links": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/posts/{slug}": {
      "get": {
        "summary": "Get a published post",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published post",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "apiVersion": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Post"
                      }
                    },
                    "meta": {
                      "type": "object"
                    },
                    "links": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Post not found"
          }
        }
      }
    },
    "/api/v1/signals": {
      "get": {
        "summary": "List published signals",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published signals",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "apiVersion": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Signal"
                      }
                    },
                    "meta": {
                      "type": "object"
                    },
                    "links": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/categories": {
      "get": {
        "summary": "List public categories",
        "responses": {
          "200": {
            "description": "Public categories",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "apiVersion": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Category"
                      }
                    },
                    "meta": {
                      "type": "object"
                    },
                    "links": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Post": {
        "type": "object",
        "properties": {
          "type": {
            "const": "post"
          },
          "title": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "excerpt": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "canonicalUrl": {
            "type": "string",
            "format": "uri"
          },
          "category": {
            "type": "object"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "authors": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "readTime": {
            "type": [
              "string",
              "null"
            ]
          },
          "publishedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "heroImage": {
            "type": [
              "object",
              "null"
            ]
          },
          "body": {
            "type": "object"
          }
        },
        "required": [
          "type",
          "title",
          "slug",
          "excerpt",
          "url",
          "canonicalUrl"
        ]
      },
      "Signal": {
        "type": "object",
        "properties": {
          "type": {
            "const": "signal"
          },
          "source": {
            "type": "object"
          },
          "body": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "category": {
            "type": "object"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "canonicalUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "type",
          "source",
          "body",
          "region",
          "category"
        ]
      },
      "Category": {
        "type": "object",
        "properties": {
          "type": {
            "const": "category"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "slug",
          "name",
          "label",
          "description",
          "color"
        ]
      }
    }
  }
}