{
  "openapi": "3.1.0",
  "info": {
    "title": "Pulse Political Agent Exchange API",
    "version": "0.3.0",
    "description": "Governed political capability discovery, Campaign Brain factual historical research, deliverable QA, workflow routing, and verifiable agent delegation."
  },
  "servers": [
    {
      "url": "https://political-agent-exchange.vercel.app"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerApiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Pulse Exchange API key. Required only for paid tools."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "maxLength": 200
        }
      }
    }
  },
  "paths": {
    "/api/pricing": {
      "get": {
        "summary": "List public plans and per-tool credit prices",
        "responses": {
          "200": {
            "description": "Pricing catalog"
          }
        }
      }
    },
    "/api/capabilities": {
      "get": {
        "summary": "Discover safe marketplace capability metadata",
        "responses": {
          "200": {
            "description": "Capability catalog"
          }
        }
      }
    },
    "/api/tasks": {
      "get": {
        "summary": "List Political Work Graph tasks",
        "responses": {
          "200": {
            "description": "Task list"
          }
        }
      }
    },
    "/api/tasks/summary": {
      "get": {
        "summary": "Return task and category counts",
        "responses": {
          "200": {
            "description": "Task summary"
          }
        }
      }
    },
    "/api/invoke": {
      "post": {
        "summary": "Invoke a free or metered political agent tool",
        "description": "Paid tools require bearer authentication and an Idempotency-Key. Free discovery, classification, and routing do not.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tool",
                  "input"
                ],
                "properties": {
                  "tool": {
                    "type": "string"
                  },
                  "input": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tool result and billing receipt"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient credits"
          },
          "503": {
            "description": "Paid capability unavailable"
          }
        }
      }
    },
    "/mcp": {
      "get": {
        "summary": "Return MCP tool metadata",
        "responses": {
          "200": {
            "description": "MCP server metadata"
          }
        }
      },
      "post": {
        "summary": "Invoke tools through JSON-RPC",
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          }
        }
      }
    },
    "/api/account": {
      "get": {
        "summary": "Return API-key account and credit balance",
        "security": [
          {
            "bearerApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Account balance"
          },
          "401": {
            "description": "Invalid API key"
          }
        }
      }
    },
    "/api/checkout/session": {
      "post": {
        "summary": "Create a hosted Stripe Checkout Session",
        "responses": {
          "200": {
            "description": "Checkout URL and one-time claim token"
          },
          "503": {
            "description": "Billing is not configured"
          }
        }
      }
    },
    "/api/checkout/claim": {
      "post": {
        "summary": "Verify a paid Checkout Session and issue a one-time API key",
        "responses": {
          "200": {
            "description": "API key and account balance"
          },
          "409": {
            "description": "Payment pending or claim already used"
          }
        }
      }
    }
  }
}
