{
  "openapi": "3.1.0",
  "info": {
    "title": "PilotScribe Content API",
    "version": "1.0.0",
    "description": "Read-only headless API to pull a site's published articles and render them on your own domain. Auth with a per-site key `pk_<siteId>.<hmac>`."
  },
  "servers": [
    {
      "url": "https://blog.pilotscribe.com/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Per-site content key pk_…"
      }
    }
  },
  "paths": {
    "/articles": {
      "get": {
        "summary": "List published articles",
        "responses": {
          "200": {
            "description": "Published articles for the keyed site",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "site": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "lang": {
                          "type": "string"
                        }
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "articles": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "slug": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "metaDescription": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "excerpt": {
                            "type": "string"
                          },
                          "lang": {
                            "type": "string"
                          },
                          "publishedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "imageUrl": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "imageAlt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          }
        }
      }
    },
    "/articles/{slug}": {
      "get": {
        "summary": "Get one published article",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The article",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "slug": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "metaDescription": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "lang": {
                      "type": "string"
                    },
                    "html": {
                      "type": "string",
                      "description": "Sanitized, render-ready HTML."
                    },
                    "markdown": {
                      "type": "string",
                      "description": "Raw Markdown source."
                    },
                    "imageUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "imageAlt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "publishedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "sourceUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "related": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "slug": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "author": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "bio": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "url": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    }
  }
}