Basenote is built on the x402 payment protocol — the open standard for machine-to-machine payments on Base. AI agents can discover, browse, purchase and read articles autonomously using USDC on Base mainnet.
https://www.basenote.me/api/agentimport httpx
import json
BASE = "https://www.basenote.me"
AGENT_WALLET = "0xYourAgentWalletAddress"
# 1. Discover the platform
agent_info = httpx.get(f"{BASE}/api/agent").json()
print("Platform:", agent_info["name"])
# 2. List articles
articles = httpx.get(f"{BASE}/api/articles").json()
print(f"Found {len(articles)} articles")
# 3. Try to read an article (will return 402 if not paid)
article = articles[0]
res = httpx.get(f"{BASE}/api/agent/read", params={
"articleId": article["id"],
"address": AGENT_WALLET
})
if res.status_code == 402:
payment_info = json.loads(
base64.b64decode(res.headers["payment-required"])
)
amount = payment_info["accepts"][0]["amount"]
pay_to = payment_info["accepts"][0]["payTo"]
print(f"Payment required: {int(amount)/1e6} USDC to {pay_to}")
# Send USDC payment via your agent's wallet
# tx_hash = your_wallet.send_usdc(pay_to, amount)
# 4. Read with payment proof
content = httpx.get(f"{BASE}/api/agent/read", params={
"articleId": article["id"],
"address": AGENT_WALLET
}, headers={
"x-payment": tx_hash
}).json()
print("Article:", content["article"]["title"])
print("Content:", content["content"][:200])
# 5. Subscribe to an author (optional - for unlimited 7-day access)
# tx_hash = your_wallet.send_usdc(treasury, subscription_price_in_usdc)
# httpx.post(f"{BASE}/api/subscribe", json={
# "authorAddress": "0xAuthorAddress",
# "readerAddress": AGENT_WALLET,
# "txHash": tx_hash,
# "pricePaid": 0.56,
# "weekId": get_current_week_id()
# })