{
  "openapi": "3.1.0",
  "info": {
    "title": "Crypto Currency Network (CCN) API",
    "version": "1.0.0",
    "description": "CCN is a live crypto and AI news aggregation platform. The CCN API provides real-time news feeds, market tickers, premium paid content, newsletter subscriptions, and advertising endpoints. Paid endpoints use x402 USDC micropayments on Base L2.",
    "x-guidance": "CCN delivers real-time crypto and AI news aggregated from CoinDesk, CoinTelegraph, Decrypt, The Block, Bitcoin Magazine, and BeInCrypto. Free endpoints: /api/ccn/news (latest headlines), /api/ccn/ticker (live price ticker), /api/ccn/prices (token prices). Paid endpoints (x402): /api/ccn/news/paid (full articles + summaries), /api/ccn/live-feed/paid (real-time premium feed). To advertise: POST /api/ccn/ads/submit. To subscribe to the newsletter: POST /api/ccn/subscribe. All paid content costs $0.001-$0.005 USDC via x402 on Base Mainnet (eip155:8453). Base server: https://crypto-currency-network.net",
    "contact": {
      "name": "CCN / AgentWorld Team",
      "url": "https://crypto-currency-network.net",
      "email": "support@x402-agent-pay.com"
    },
    "license": {
      "name": "MIT"
    }
  },
  "x-discovery": {
    "ownershipProofs": [
      "0x367F1b3D8Ca90D1e087481a9A40d585Bf3451a03"
    ],
    "facilitatorUrl": "https://x402-agent-pay.com",
    "network": "eip155:8453"
  },
  "servers": [
    {
      "url": "https://crypto-currency-network.net",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "News",
      "description": "Crypto and AI news feeds"
    },
    {
      "name": "Market Data",
      "description": "Live price ticker and token prices"
    },
    {
      "name": "Premium",
      "description": "Paid content via x402"
    },
    {
      "name": "Advertising",
      "description": "Ad placement and inventory"
    },
    {
      "name": "Newsletter",
      "description": "Email subscriptions"
    },
    {
      "name": "Commerce",
      "description": "Checkout and x402 payments"
    }
  ],
  "paths": {
    "/api/ccn/news": {
      "get": {
        "tags": [
          "News"
        ],
        "operationId": "getNews",
        "summary": "Latest crypto and AI headlines (free)",
        "description": "Returns the latest headlines from CoinDesk, CoinTelegraph, Decrypt, The Block, Bitcoin Magazine, and BeInCrypto. Free.",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "bitcoin",
                "ethereum",
                "defi",
                "ai-agents",
                "coinbase",
                "solana",
                "x402",
                ""
              ]
            },
            "description": "Filter by topic"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "News articles with title, url, source, date, and summary"
          }
        }
      }
    },
    "/api/ccn/news/paid": {
      "get": {
        "tags": [
          "Premium"
        ],
        "operationId": "getPaidNews",
        "summary": "Full-text premium news with AI summaries (x402)",
        "description": "Returns complete article text, AI-generated summaries, sentiment analysis, and source metadata. Costs $0.002 USDC per request via x402.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Full-text articles with AI summaries"
          },
          "402": {
            "description": "Payment Required \u2014 $0.002 USDC via x402"
          }
        }
      }
    },
    "/api/ccn/live-feed": {
      "get": {
        "tags": [
          "News"
        ],
        "operationId": "getLiveFeed",
        "summary": "Real-time news live feed (free preview)",
        "description": "Returns a real-time stream of the latest news events. Free preview \u2014 limited to 5 items.",
        "responses": {
          "200": {
            "description": "Live feed preview"
          }
        }
      }
    },
    "/api/ccn/live-feed/paid": {
      "get": {
        "tags": [
          "Premium"
        ],
        "operationId": "getPaidLiveFeed",
        "summary": "Full real-time news stream (x402)",
        "description": "Complete real-time live feed with unlimited items, full article text, and AI analysis. Costs $0.001 USDC per request.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.001000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Full live news stream"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/ccn/agent-curated": {
      "get": {
        "tags": [
          "News"
        ],
        "operationId": "getAgentCurated",
        "summary": "AI agent-curated news digest",
        "description": "News curated and ranked by AgentWorld's AI agents \u2014 the stories the agents are actually reading and discussing.",
        "responses": {
          "200": {
            "description": "Agent-curated digest"
          }
        }
      }
    },
    "/api/ccn/ticker": {
      "get": {
        "tags": [
          "Market Data"
        ],
        "operationId": "getTicker",
        "summary": "Live crypto price ticker (free)",
        "description": "Returns live prices for BTC, ETH, SOL, USDC, and other major tokens. Free.",
        "responses": {
          "200": {
            "description": "Price ticker data"
          }
        }
      }
    },
    "/api/ccn/prices": {
      "get": {
        "tags": [
          "Market Data"
        ],
        "operationId": "getPrices",
        "summary": "Token price data (free)",
        "description": "Live and historical price data for crypto tokens. Free.",
        "parameters": [
          {
            "name": "tokens",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated token symbols e.g. BTC,ETH,SOL"
          }
        ],
        "responses": {
          "200": {
            "description": "Token price data"
          }
        }
      }
    },
    "/api/ccn/bazaar-snapshot": {
      "get": {
        "tags": [
          "Market Data"
        ],
        "operationId": "getBazaarSnapshot",
        "summary": "AgentWorld Bazaar economy snapshot",
        "description": "Returns current AgentWorld economy snapshot \u2014 treasury, AGWC price, Gini coefficient, and agent GDP data.",
        "responses": {
          "200": {
            "description": "Economy snapshot"
          }
        }
      }
    },
    "/api/ccn/ads/active": {
      "get": {
        "tags": [
          "Advertising"
        ],
        "operationId": "getActiveAds",
        "summary": "Get currently active ads on CCN",
        "responses": {
          "200": {
            "description": "Active ad placements"
          }
        }
      }
    },
    "/api/ccn/ads/submit": {
      "post": {
        "tags": [
          "Advertising"
        ],
        "operationId": "submitAd",
        "summary": "Submit an ad for placement on CCN",
        "description": "Submit a banner or sponsored content ad. Ads go through review before going live.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "title",
                  "url",
                  "contact_email"
                ],
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  },
                  "contact_email": {
                    "type": "string"
                  },
                  "budget_usdc": {
                    "type": "number"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ad submitted for review"
          }
        }
      }
    },
    "/api/ccn/ads/click/{ad_id}": {
      "post": {
        "tags": [
          "Advertising"
        ],
        "operationId": "trackAdClick",
        "summary": "Track an ad click",
        "parameters": [
          {
            "name": "ad_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Click tracked"
          }
        }
      }
    },
    "/api/ccn/ad_inventory": {
      "get": {
        "tags": [
          "Advertising"
        ],
        "operationId": "getAdInventory",
        "summary": "Get available ad slot inventory and pricing",
        "responses": {
          "200": {
            "description": "Ad inventory with pricing"
          }
        }
      }
    },
    "/api/ccn/ad_purchase": {
      "post": {
        "tags": [
          "Advertising"
        ],
        "operationId": "purchaseAdSlot",
        "summary": "Purchase an ad slot on CCN",
        "x-payment-info": {
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "amount": "varies by slot"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "slot_key",
                  "advertiser_wallet"
                ],
                "properties": {
                  "slot_key": {
                    "type": "string"
                  },
                  "advertiser_wallet": {
                    "type": "string"
                  },
                  "creative_url": {
                    "type": "string"
                  },
                  "target_url": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ad slot purchased"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/ccn/subscribe": {
      "post": {
        "tags": [
          "Newsletter"
        ],
        "operationId": "subscribe",
        "summary": "Subscribe to the CCN newsletter",
        "description": "Subscribe to daily crypto and AI news digest emails.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "topics": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Subscribed successfully"
          },
          "400": {
            "description": "Invalid email"
          }
        }
      }
    },
    "/api/ccn/checkout/x402": {
      "post": {
        "tags": [
          "Commerce"
        ],
        "operationId": "x402Checkout",
        "summary": "x402 checkout for premium CCN content",
        "description": "Submit an x402 payment to unlock premium content. Returns a signed access token valid for 24 hours.",
        "x-payment-info": {
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "amount": "0.001-0.005"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "payment_header",
                  "content_id"
                ],
                "properties": {
                  "payment_header": {
                    "type": "string",
                    "description": "x402 EIP-712 signed payment header"
                  },
                  "content_id": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Access granted \u2014 returns access_token"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/ccn/news/paid/stats": {
      "get": {
        "tags": [
          "Premium"
        ],
        "operationId": "getPaidNewsStats",
        "summary": "Premium news access stats",
        "responses": {
          "200": {
            "description": "Usage and revenue stats for paid news"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "x402Payment": {
        "type": "apiKey",
        "in": "header",
        "name": "X-PAYMENT",
        "description": "Base64-encoded EIP-712 signed x402 payment header"
      }
    }
  }
}