{
  "openapi": "3.1.0",
  "info": {
    "title": "Loke.dev public API",
    "version": "1.0.0",
    "description": "Small, public JSON endpoints used by Loke.dev tools. They are read-only, do not expose Sanity drafts, and are rate limited.",
    "contact": {
      "name": "Loke Development",
      "url": "https://loke.dev/contact"
    }
  },
  "servers": [
    {
      "url": "https://loke.dev",
      "description": "Production"
    }
  ],
  "externalDocs": {
    "description": "Human-readable developer notes",
    "url": "https://loke.dev/developers"
  },
  "paths": {
    "/api/search": {
      "get": {
        "operationId": "searchPublishedContent",
        "summary": "Search published posts and projects",
        "description": "Searches published Loke.dev posts and projects. Send a query between 2 and 100 characters. Drafts and private content are never returned.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "The search phrase.",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published search hits.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "query",
                    "posts",
                    "projects"
                  ],
                  "properties": {
                    "query": {
                      "type": "string"
                    },
                    "posts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "title",
                          "slug",
                          "description",
                          "date"
                        ],
                        "properties": {
                          "title": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "date": {
                            "type": "string",
                            "format": "date"
                          }
                        }
                      }
                    },
                    "projects": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "title",
                          "description"
                        ],
                        "properties": {
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "url": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uri"
                          },
                          "github": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uri"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The query is missing or outside the allowed length.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "code",
                    "resolution"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "A short human-readable error."
                    },
                    "code": {
                      "type": "string",
                      "description": "A stable machine-readable code."
                    },
                    "resolution": {
                      "type": "string",
                      "description": "A short hint for correcting the request or retrying."
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "The caller has exceeded the short request window.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before trying again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "code",
                    "resolution"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "A short human-readable error."
                    },
                    "code": {
                      "type": "string",
                      "description": "A stable machine-readable code."
                    },
                    "resolution": {
                      "type": "string",
                      "description": "A short hint for correcting the request or retrying."
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The search index is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "code",
                    "resolution"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "A short human-readable error."
                    },
                    "code": {
                      "type": "string",
                      "description": "A stable machine-readable code."
                    },
                    "resolution": {
                      "type": "string",
                      "description": "A short hint for correcting the request or retrying."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/inspect-url": {
      "get": {
        "operationId": "inspectPublicUrlMetadata",
        "summary": "Inspect public page metadata",
        "description": "Fetches one public HTTP or HTTPS page and returns its final URL, status, title, description, canonical, robots, Open Graph, X card, and selected response headers. Private and local network addresses are rejected.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "A complete public HTTP or HTTPS URL.",
            "schema": {
              "type": "string",
              "format": "uri"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The page metadata and selected headers.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "requestedUrl",
                    "finalUrl",
                    "status",
                    "contentType",
                    "title",
                    "canonical",
                    "robots",
                    "description",
                    "openGraph",
                    "twitter",
                    "headers"
                  ],
                  "properties": {
                    "requestedUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "finalUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "contentType": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "canonical": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uri"
                    },
                    "robots": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "openGraph": {
                      "type": "object",
                      "additionalProperties": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "twitter": {
                      "type": "object",
                      "additionalProperties": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "headers": {
                      "type": "object",
                      "additionalProperties": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The URL is invalid or points to a private address.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "code",
                    "resolution"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "A short human-readable error."
                    },
                    "code": {
                      "type": "string",
                      "description": "A stable machine-readable code."
                    },
                    "resolution": {
                      "type": "string",
                      "description": "A short hint for correcting the request or retrying."
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "The target response is too large to inspect.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "code",
                    "resolution"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "A short human-readable error."
                    },
                    "code": {
                      "type": "string",
                      "description": "A stable machine-readable code."
                    },
                    "resolution": {
                      "type": "string",
                      "description": "A short hint for correcting the request or retrying."
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "The caller has exceeded the short request window.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before trying again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "code",
                    "resolution"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "A short human-readable error."
                    },
                    "code": {
                      "type": "string",
                      "description": "A stable machine-readable code."
                    },
                    "resolution": {
                      "type": "string",
                      "description": "A short hint for correcting the request or retrying."
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The target page could not be fetched or followed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "code",
                    "resolution"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "A short human-readable error."
                    },
                    "code": {
                      "type": "string",
                      "description": "A stable machine-readable code."
                    },
                    "resolution": {
                      "type": "string",
                      "description": "A short hint for correcting the request or retrying."
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}