{"uid":"cap_nhimoV0t43uhWB8jFB5bl","slug":"2s-pubsub-publish-6730e8d6","name":"2s PubSub Publish","description":"The (most) everything API: 575+ pay-per-call endpoints for AI agents — ground-truth data, a full AI gateway, and agent infrastructure (storage, queues, watchers). USDC via x402, no signup, no API keys, and upto billing: pay actual usage, not the quote.","url":"https://2s.io/api/pubsub/publish","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"message":{"description":"The payload to fan out — any JSON, up to 64 KB."},"topicId":{"type":"string","description":"The topic you own (from pubsub.create-topic)."}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_o7fqlTX1iPGOEaoSZp20i","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Publishes a JSON message payload to a topic, fanning it out to all subscribers in real time.","exampleAgentPrompt":"Publish this JSON payload — {\"event\":\"order_placed\",\"orderId\":\"abc123\"} — to my topic 'orders-prod' so all subscribers get notified right away.","exampleUseCases":[{"title":"Agent fleet task broadcast","prompt":"I need to broadcast a new crawl task — {\"url\":\"https://example.com\",\"depth\":2} — to all my scraper agents listening on topic 'crawl-jobs'. Can you publish that now?"},{"title":"Real-time inventory alert","prompt":"Push an inventory alert to my 'stock-updates' topic with this payload: {\"sku\":\"WIDGET-99\",\"quantity\":0,\"warehouse\":\"east\"} so all downstream services know it's out of stock."},{"title":"Cross-agent event notification","prompt":"My pricing agent just repriced a product — publish {\"productId\":\"P-4421\",\"newPrice\":29.99,\"currency\":\"USD\"} to topic 'pricing-events' so the recommendation and search agents can react."}],"resultDescription":"Returns a JSON object with ok: true, an items array containing the topicId and the number of subscribers the message was delivered to, and a total count. Lets the caller confirm how many listeners received the fan-out.","failureModes":["Invalid or non-owned topicId — topic not found or permission denied","Payload exceeds 64 KB limit — message rejected","Malformed JSON in message body — parse error returned","No subscribers on topic — delivers 0, ok still true","Payment failure via x402 — call not executed"],"whenToPreferThis":"Use this endpoint when you need to fan out a JSON event or task to multiple subscribers on a topic you own within the 2s.io pub/sub infrastructure — especially inside agent pipelines where workers listen on named topics. Prefer this over generic HTTP webhooks when you need delivery confirmation (count of recipients) and pay-per-use billing with no API key setup.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T00:58:10.782Z","isFirstParty":false}