{
  "openapi": "3.1.0",
  "info": {
    "title": "ChangeGamer API",
    "version": "1.0.0",
    "license": {
      "name": "RSL",
      "url": "https://changegamer.ai/license.xml"
    },
    "description": "Machine-readable JSON API for ChangeGamer — an agent-first resource directory. Free resources are served directly; premium resources require an access key and return HTTP 402 when the key is absent or invalid. See /resources/access-and-pricing.md for the full access and pricing policy. An MCP server is available at https://changegamer.ai/mcp (Streamable HTTP transport, no authentication required) with tools: list_resources, get_resource, search_resources, get_corpus, get_access_info. The MCP server is NOT an OpenAPI path — it uses the Model Context Protocol.",
    "x-mcp": {
      "server_url": "https://changegamer.ai/mcp",
      "transport": "Streamable HTTP",
      "tools": [
        "list_resources",
        "get_resource",
        "search_resources",
        "get_corpus",
        "get_access_info"
      ],
      "note": "MCP is a separate protocol; it is documented here for discoverability only."
    }
  },
  "externalDocs": {
    "description": "Agent index (llms.txt), access and pricing, and MCP server documentation",
    "url": "https://changegamer.ai/llms.txt",
    "x-also": [
      "https://changegamer.ai/resources/access-and-pricing",
      "https://changegamer.ai/mcp"
    ]
  },
  "servers": [
    {
      "url": "https://changegamer.ai"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key in Authorization: Bearer <key> header. Purchase at https://buy.stripe.com/fZu9AMa230eP2b1f0d7EQ00"
      },
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "API key in x-api-key header (fallback to bearerAuth). Purchase at https://buy.stripe.com/fZu9AMa230eP2b1f0d7EQ00"
      }
    },
    "responses": {
      "PaymentRequired": {
        "description": "Premium resource requires an access key. Link headers: rel=\"payment\" (purchase URL), rel=\"license\" (/license.xml), and rel=\"pricing\" (/api/pricing.json). Cache-Control: no-store is always set — never cache 402 responses. The live 402 body from worker/index.ts build402Body() is always authoritative.",
        "headers": {
          "Link": {
            "description": "rel=\"payment\", rel=\"license\", and rel=\"pricing\" link relations",
            "schema": {
              "type": "string"
            },
            "example": "<https://buy.stripe.com/fZu9AMa230eP2b1f0d7EQ00>; rel=\"payment\", <https://changegamer.ai/license.xml>; rel=\"license\", <https://changegamer.ai/api/pricing.json>; rel=\"pricing\""
          },
          "Cache-Control": {
            "description": "Always no-store on 402 responses",
            "schema": {
              "type": "string",
              "enum": [
                "no-store"
              ]
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error",
                "resource",
                "price_usd",
                "payment_url",
                "how_to_pay",
                "terms",
                "license",
                "pricing_catalog",
                "preview"
              ],
              "additionalProperties": false,
              "properties": {
                "error": {
                  "type": "string",
                  "const": "payment_required",
                  "description": "Fixed error discriminator."
                },
                "resource": {
                  "type": "string",
                  "description": "The slug of the premium resource that was requested."
                },
                "price_usd": {
                  "type": "string",
                  "description": "Per-fetch reference price in USD (not the key purchase price).",
                  "example": "0.05"
                },
                "payment_url": {
                  "type": "string",
                  "format": "uri",
                  "description": "URL where an access key can be purchased.",
                  "example": "https://buy.stripe.com/fZu9AMa230eP2b1f0d7EQ00"
                },
                "how_to_pay": {
                  "type": "string",
                  "description": "Human- and agent-readable retry instructions."
                },
                "terms": {
                  "type": "string",
                  "format": "uri",
                  "description": "Link to the access-and-pricing Markdown resource."
                },
                "license": {
                  "type": "string",
                  "format": "uri",
                  "description": "Link to the RSL machine-readable license at /license.xml."
                },
                "pricing_catalog": {
                  "type": "string",
                  "format": "uri",
                  "description": "Link to the free machine-readable four-tier pricing/offers catalog at /api/pricing.json."
                },
                "preview": {
                  "type": "object",
                  "description": "Non-paywalled preview of the gated resource so a buyer can see what they are purchasing before paying: title, one-line description, and the section-heading outline. Contains no paywalled body prose.",
                  "required": [
                    "title",
                    "description",
                    "sections"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "title": {
                      "type": "string",
                      "description": "The resource title."
                    },
                    "description": {
                      "type": "string",
                      "description": "One-line resource summary."
                    },
                    "sections": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Ordered list of the resource's \"##\" section headings."
                    }
                  }
                }
              }
            },
            "example": {
              "error": "payment_required",
              "resource": "data-formats",
              "price_usd": "0.05",
              "payment_url": "https://buy.stripe.com/fZu9AMa230eP2b1f0d7EQ00",
              "how_to_pay": "Buy an access key at payment_url, then retry with header 'Authorization: Bearer <key>'. Index files (/llms.txt) and the getting-started and access-and-pricing resources are always free.",
              "terms": "https://changegamer.ai/resources/access-and-pricing.md",
              "license": "https://changegamer.ai/license.xml",
              "pricing_catalog": "https://changegamer.ai/api/pricing.json",
              "preview": {
                "title": "Data Formats & Schema",
                "description": "Structured data conventions: JSON-LD, Markdown variants and stable slugs.",
                "sections": []
              }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/api/resources.json": {
      "get": {
        "operationId": "listResources",
        "summary": "List all resources",
        "description": "Returns a machine-readable index of every ChangeGamer resource with metadata and links to HTML, Markdown and per-resource JSON variants. Always free — matches no SLUG_PATTERNS in the worker gate, cannot return 402.",
        "tags": [
          "resources"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Corpus index",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "site",
                    "url",
                    "description",
                    "resources"
                  ],
                  "properties": {
                    "site": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "description": {
                      "type": "string"
                    },
                    "resources": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "slug",
                          "title",
                          "description",
                          "category",
                          "tags",
                          "updated",
                          "html",
                          "markdown",
                          "json"
                        ],
                        "properties": {
                          "slug": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "category": {
                            "type": "string"
                          },
                          "tags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "updated": {
                            "type": "string",
                            "format": "date"
                          },
                          "html": {
                            "type": "string",
                            "format": "uri"
                          },
                          "markdown": {
                            "type": "string",
                            "format": "uri"
                          },
                          "json": {
                            "type": "string",
                            "format": "uri"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/resources/{slug}.json": {
      "get": {
        "operationId": "getResourceJson",
        "summary": "Get a single resource as JSON",
        "description": "Returns metadata and full Markdown body for a single resource. Free resources are served without authentication. Premium resources (data-formats, json-api, autonomous-operations) return 402 without a valid access key.",
        "tags": [
          "resources"
        ],
        "security": [
          {},
          {
            "bearerAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Resource slug.",
            "schema": {
              "type": "string",
              "enum": [
                "getting-started",
                "access-and-pricing",
                "data-formats",
                "json-api",
                "autonomous-operations",
                "llms-txt-explained",
                "paying-for-access-402",
                "mcp-server-discovery",
                "agentic-security-checklist",
                "mcp-vs-a2a",
                "ai-crawler-policy",
                "open-weight-models-for-agents",
                "agentic-payment-protocols",
                "mcp-server-authentication",
                "agent-frameworks-compared",
                "reliable-tool-calling",
                "evaluating-ai-agents",
                "agent-memory-context",
                "agent-observability",
                "rag-retrieval-for-agents",
                "computer-use-browser-automation",
                "multi-agent-orchestration-patterns",
                "ai-gateways-llm-routing",
                "code-execution-sandboxing",
                "agent-guardrails",
                "embeddings-vector-search",
                "agent-cost-latency-optimization",
                "voice-realtime-agents",
                "web-data-for-agents",
                "document-extraction-for-agents",
                "deploying-serving-llms",
                "prompt-context-engineering",
                "agent-reasoning-patterns",
                "durable-execution-for-agents",
                "mcp-primitives",
                "multimodal-agents",
                "agent-identity-authentication",
                "building-mcp-servers",
                "streaming-for-agents",
                "text-to-sql-agents",
                "graphrag-for-agents",
                "testing-ai-agents",
                "generative-ui-for-agents",
                "fine-tuning-vs-rag",
                "data-privacy-for-agents"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Single resource with metadata and Markdown body",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "slug",
                    "title",
                    "description",
                    "category",
                    "tags",
                    "updated",
                    "canonical",
                    "markdown",
                    "body"
                  ],
                  "properties": {
                    "slug": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "category": {
                      "type": "string"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "updated": {
                      "type": "string",
                      "format": "date"
                    },
                    "canonical": {
                      "type": "string",
                      "format": "uri"
                    },
                    "markdown": {
                      "type": "string",
                      "format": "uri"
                    },
                    "body": {
                      "type": "string",
                      "description": "Full resource body in Markdown."
                    }
                  }
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          }
        }
      }
    },
    "/resources/{slug}.md": {
      "get": {
        "operationId": "getResourceMarkdown",
        "summary": "Get a single resource as Markdown",
        "description": "Returns the navigation-free Markdown variant of a resource. Preferred by agents over the HTML variant. Free resources are served without authentication. Premium resources return 402 without a valid access key.",
        "tags": [
          "resources"
        ],
        "security": [
          {},
          {
            "bearerAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Resource slug.",
            "schema": {
              "type": "string",
              "enum": [
                "getting-started",
                "access-and-pricing",
                "data-formats",
                "json-api",
                "autonomous-operations",
                "llms-txt-explained",
                "paying-for-access-402",
                "mcp-server-discovery",
                "agentic-security-checklist",
                "mcp-vs-a2a",
                "ai-crawler-policy",
                "open-weight-models-for-agents",
                "agentic-payment-protocols",
                "mcp-server-authentication",
                "agent-frameworks-compared",
                "reliable-tool-calling",
                "evaluating-ai-agents",
                "agent-memory-context",
                "agent-observability",
                "rag-retrieval-for-agents",
                "computer-use-browser-automation",
                "multi-agent-orchestration-patterns",
                "ai-gateways-llm-routing",
                "code-execution-sandboxing",
                "agent-guardrails",
                "embeddings-vector-search",
                "agent-cost-latency-optimization",
                "voice-realtime-agents",
                "web-data-for-agents",
                "document-extraction-for-agents",
                "deploying-serving-llms",
                "prompt-context-engineering",
                "agent-reasoning-patterns",
                "durable-execution-for-agents",
                "mcp-primitives",
                "multimodal-agents",
                "agent-identity-authentication",
                "building-mcp-servers",
                "streaming-for-agents",
                "text-to-sql-agents",
                "graphrag-for-agents",
                "testing-ai-agents",
                "generative-ui-for-agents",
                "fine-tuning-vs-rag",
                "data-privacy-for-agents"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Navigation-free Markdown content of the resource",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string",
                  "description": "Markdown text with H1 title, blockquote description, and body."
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          }
        }
      }
    }
  }
}