# 2s Pub/Sub Create Topic

> 2s Pub/Sub Create Topic is a paid API for AI agents from 2s.io, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-14).

Creates a named pub/sub topic on the 2s agent infrastructure platform, returning a topicId for subsequent publishing and subscribing.

## Facts

- Endpoint: POST https://2s.io/api/pubsub/create-topic
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/2s-pub-sub-create-topic-4536c15f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_R3L2vjMnzFapTGmEbJD5v

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability 2s-pub-sub-create-topic-4536c15f -d '<json body>'
```

Example prompt: Create a new pub/sub topic called 'price-alerts' on 2s so my agents can start publishing and subscribing to price change events.

## When to prefer this

Use this endpoint when you need to provision a named pub/sub topic as part of building an event-driven agent pipeline on the 2s platform. It is the first step before publishing messages or subscribing to a channel. Prefer this over general-purpose message brokers when you are already using 2s for other agent infrastructure (storage, queues, watchers) and want pay-per-call pricing with no signup.

## Known failure modes

- Invalid topic name (must be 1-64 chars of [A-Za-z0-9._:-]) returns an error response
- Duplicate topic name may return an error or an existing topic depending on platform behavior
- Payment failure via x402 if USDC balance is insufficient
- Network timeout or 5xx if the 2s platform is temporarily unavailable

## How this service works

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.

## Output

Returns a JSON object with ok: true, an items array containing the created topic's topicId and name, a total count, and a source object with provider, URL, and license metadata.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "name": {
   "type": "string",
   "description": "Topic name, 1-64 chars of [A-Za-z0-9._:-]. e.g. \"price-alerts\"."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "schema": {
  "type": "object",
  "required": [
   "ok",
   "items",
   "total",
   "source"
  ],
  "properties": {
   "ok": {
    "enum": [
     true
    ],
    "type": "boolean"
   },
   "items": {
    "type": "array",
    "items": {
     "type": "object",
     "required": [
      "topicId",
      "name"
     ],
     "properties": {
      "name": {
       "type": "string"
      },
      "topicId": {
       "type": "string"
      }
     },
     "additionalProperties": false
    }
   },
   "total": {
    "type": "integer",
    "nullable": true,
    "description": "Total matching rows upstream; null when unknown."
   },
   "source": {
    "type": "object",
    "required": [
     "provider",
     "url",
     "license"
    ],
    "properties": {
     "url": {
      "type": "string"
     },
     "license": {
      "type": "string"
     },
     "provider": {
      "type": "string"
     }
    },
    "additionalProperties": false
   }
  },
  "additionalProperties": false
 },
 "example": {
  "ok": true,
  "items": [
   {
    "name": "example",
    "topicId": "example"
   }
  ],
  "total": 1,
  "source": {
   "url": "example",
   "license": "example",
   "provider": "example"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/2s-pub-sub-create-topic-4536c15f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from 2s.io](https://www.zero.xyz/host/2s.io/llms.txt)
