{
  "openapi": "3.1.0",
  "info": {
    "title": "OG Stamp",
    "version": "1.0.0",
    "description": "Pay-as-you-go Open Graph image API. Six layouts, nine typefaces, five size presets, logo and hex colour overrides, plus /api/auto which builds a card from a page URL. Credits never expire. PayPal checkout at https://ogstamp.com/pricing/. MCP at https://ogstamp.com/mcp.",
    "contact": {
      "email": "info@bakosbence.com",
      "url": "https://ogstamp.com/for-ai-agents/"
    }
  },
  "servers": [
    {
      "url": "https://ogstamp.com"
    }
  ],
  "paths": {
    "/api/og": {
      "get": {
        "operationId": "renderOgFree",
        "summary": "Render a 1200x630 PNG (free tier, 30/IP/day)",
        "parameters": [
          {
            "name": "title",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 120
            }
          },
          {
            "name": "subtitle",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 180
            }
          },
          {
            "name": "badge",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "theme",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "midnight",
                "paper",
                "forest",
                "coral",
                "slate"
              ]
            }
          },
          {
            "name": "logo_url",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "bg",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Hex background"
            }
          },
          {
            "name": "fg",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accent",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "layout",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "classic",
                "center",
                "split",
                "minimal",
                "quote",
                "terminal"
              ]
            }
          },
          {
            "name": "font",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "inter",
                "manrope",
                "playfair",
                "space",
                "dm",
                "lora",
                "mono",
                "figtree",
                "bitter"
              ]
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "og",
                "square",
                "linkedin",
                "story",
                "wide"
              ]
            }
          },
          {
            "name": "site",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 60
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PNG",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "429": {
            "description": "Free daily limit. Buy credits."
          }
        }
      },
      "post": {
        "operationId": "renderOgPaid",
        "summary": "Render a PNG and spend one credit",
        "security": [
          {
            "bearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "title"
                ],
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "subtitle": {
                    "type": "string"
                  },
                  "badge": {
                    "type": "string"
                  },
                  "theme": {
                    "type": "string",
                    "enum": [
                      "midnight",
                      "paper",
                      "forest",
                      "coral",
                      "slate"
                    ]
                  },
                  "logo_url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "bg": {
                    "type": "string"
                  },
                  "fg": {
                    "type": "string"
                  },
                  "accent": {
                    "type": "string"
                  },
                  "layout": {
                    "type": "string",
                    "enum": [
                      "classic",
                      "center",
                      "split",
                      "minimal",
                      "quote",
                      "terminal"
                    ]
                  },
                  "font": {
                    "type": "string",
                    "enum": [
                      "inter",
                      "manrope",
                      "playfair",
                      "space",
                      "dm",
                      "lora",
                      "mono",
                      "figtree",
                      "bitter"
                    ]
                  },
                  "size": {
                    "type": "string",
                    "enum": [
                      "og",
                      "square",
                      "linkedin",
                      "story",
                      "wide"
                    ]
                  },
                  "site": {
                    "type": "string",
                    "maxLength": 60
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "PNG",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Invalid API key"
          },
          "402": {
            "description": "No credits left"
          }
        }
      }
    },
    "/api/packs": {
      "get": {
        "operationId": "listPacks",
        "summary": "Credit packs",
        "responses": {
          "200": {
            "description": "Packs"
          }
        }
      }
    },
    "/api/credits": {
      "get": {
        "operationId": "creditBalance",
        "summary": "Remaining credits for a key",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Balance"
          },
          "401": {
            "description": "Invalid key"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "mcpJsonRpc",
        "summary": "MCP streamable HTTP. Tools: render_og_image, og_image_from_url, og_pricing",
        "responses": {
          "200": {
            "description": "JSON-RPC result"
          }
        }
      }
    },
    "/api/auto": {
      "get": {
        "operationId": "renderOgFromUrl",
        "summary": "Render a card for an existing page by reading its own metadata",
        "description": "Fetches the given public https page and builds a card from its title, description, favicon and theme-color. Any parameter you pass overrides the scraped value. Costs one credit when authenticated; otherwise counts against the free 30/IP/day allowance.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "title",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 120
            }
          },
          {
            "name": "subtitle",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 180
            }
          },
          {
            "name": "theme",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "midnight",
                "paper",
                "forest",
                "coral",
                "slate"
              ]
            }
          },
          {
            "name": "layout",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "classic",
                "center",
                "split",
                "minimal",
                "quote",
                "terminal"
              ]
            }
          },
          {
            "name": "font",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "inter",
                "manrope",
                "playfair",
                "space",
                "dm",
                "lora",
                "mono",
                "figtree",
                "bitter"
              ]
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "og",
                "square",
                "linkedin",
                "story",
                "wide"
              ]
            }
          },
          {
            "name": "site",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 60
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PNG",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Missing, non-https, private or unreachable url"
          },
          "429": {
            "description": "Free daily limit. Buy credits."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key ogs_\u2026 from PayPal checkout"
      }
    }
  }
}
