{
  "openapi": "3.0.3",
  "info": {
    "title": "SVG Bar Chart Renderer",
    "description": "Deterministic, paid-per-render SVG bar chart generator for LLM agents. Accepts labeled scalar data and layout options, performs exact geometry math (min/max normalization, nice-interval y-axis ticks, label spacing, bar-width distribution), and returns schema-valid, escape-correct SVG with identical input always yielding byte-identical output.",
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "https://REPLACE-WITH-YOUR-WORKER-URL.workers.dev",
      "description": "Deployed Cloudflare Worker"
    }
  ],
  "paths": {
    "/": {
      "post": {
        "summary": "Render an SVG bar chart",
        "operationId": "renderBarChart",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "data"
                ],
                "properties": {
                  "data": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 500,
                    "items": {
                      "type": "object",
                      "required": [
                        "label",
                        "value"
                      ],
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "value": {
                          "type": "number"
                        }
                      }
                    }
                  },
                  "options": {
                    "type": "object",
                    "properties": {
                      "width": {
                        "type": "integer",
                        "minimum": 100,
                        "maximum": 4000,
                        "default": 640
                      },
                      "height": {
                        "type": "integer",
                        "minimum": 100,
                        "maximum": 4000,
                        "default": 400
                      },
                      "title": {
                        "type": "string",
                        "default": ""
                      },
                      "fill": {
                        "type": "string",
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "default": "#4f46e5"
                      },
                      "theme": {
                        "type": "string",
                        "enum": [
                          "light",
                          "dark"
                        ],
                        "default": "light"
                      },
                      "showGrid": {
                        "type": "boolean",
                        "default": true
                      },
                      "yAxisLabel": {
                        "type": "string",
                        "default": ""
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rendered chart (after x402 payment settlement).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "svg",
                    "byteLength",
                    "yAxis",
                    "pointCount"
                  ],
                  "properties": {
                    "svg": {
                      "type": "string",
                      "description": "Complete, well-formed SVG document."
                    },
                    "byteLength": {
                      "type": "integer",
                      "description": "UTF-8 byte length of the svg string."
                    },
                    "yAxis": {
                      "type": "object",
                      "required": [
                        "min",
                        "max",
                        "ticks"
                      ],
                      "properties": {
                        "min": {
                          "type": "number"
                        },
                        "max": {
                          "type": "number"
                        },
                        "ticks": {
                          "type": "array",
                          "items": {
                            "type": "number"
                          }
                        }
                      }
                    },
                    "pointCount": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (e.g., >500 points, non-numeric value, bad option type).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402 v2 challenge with payment requirements)."
          }
        }
      }
    }
  },
  "x-402": {
    "version": 2,
    "scheme": "exact",
    "network": "eip155:84532",
    "networkName": "Base Sepolia (testnet)",
    "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
    "amount": "10000",
    "amountDecimal": "0.01",
    "payTo": "REPLACE",
    "facilitator": "https://x402.org/facilitator",
    "eip712Domain": {
      "name": "USDC",
      "version": "2"
    }
  }
}