publish-new
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesepublish.new
publish.new
Publish and sell digital artifacts (text, files, PDFs, datasets) with USDC micropayments via x402.
You have two ways to interact with publish.new:
- CLI — best when you have shell access (command)
publish - HTTP API — best when you only have web access (curl/fetch)
通过x402使用USDC小额支付即可发布和售卖数字产物(文本、文件、PDF、数据集)。
你有两种方式使用publish.new:
- CLI — 适合有Shell访问权限的场景(使用命令)
publish - HTTP API — 适合仅能访问网络的场景(使用curl/fetch)
Option 1: CLI
选项1:CLI
Install
安装
bash
npm install -g @publish-new/cliOr use without installing:
bash
npx @publish-new/cli listbash
npm install -g @publish-new/cli也可以无需安装直接使用:
bash
npx @publish-new/cli listPublish an artifact
发布产物
bash
publish new --price=1.50 --author=0xYOUR_WALLET --content="# My Article" --title="My Article" --json
publish new --price=5.00 --author=0xYOUR_WALLET --file=./report.pdf --title="Premium Report" --json
echo "# Hello" | publish new --price=0.50 --author=0xYOUR_WALLET --content=- --jsonUse to preview without creating:
--dry-runbash
publish new --price=1 --author=0xWALLET --content="# Test" --title="Test" --dry-run --jsonUse to skip the duplicate check and always create a new artifact:
--forcebash
publish new --price=1 --author=0xWALLET --content="# Test" --title="Test" --force --jsonbash
publish new --price=1.50 --author=0xYOUR_WALLET --content="# My Article" --title="My Article" --json
publish new --price=5.00 --author=0xYOUR_WALLET --file=./report.pdf --title="Premium Report" --json
echo "# Hello" | publish new --price=0.50 --author=0xYOUR_WALLET --content=- --json使用参数可预览效果而不会实际创建产物:
--dry-runbash
publish new --price=1 --author=0xWALLET --content="# Test" --title="Test" --dry-run --json使用参数可跳过重复校验,强制创建新的产物:
--forcebash
publish new --price=1 --author=0xWALLET --content="# Test" --title="Test" --force --jsonList artifacts
列出产物
bash
publish list --json
publish list --search="machine learning" --limit=10 --jsonbash
publish list --json
publish list --search="machine learning" --limit=10 --jsonGet artifact metadata
获取产物元数据
bash
publish get my-article-a1b2c3d4 --jsonbash
publish get my-article-a1b2c3d4 --jsonGet price
查询价格
bash
publish price my-article-a1b2c3d4 --jsonbash
publish price my-article-a1b2c3d4 --jsonBuy (unlock) content
购买(解锁)内容
Requires a funded wallet with USDC on the chosen chain.
bash
export PRIVATE_KEY=0xYOUR_PRIVATE_KEY
publish buy my-article-a1b2c3d4 --chain=base --json
publish buy my-article-a1b2c3d4 --chain=base --output=./downloaded.pdfUse to check the price without paying:
--dry-runbash
publish buy my-article-a1b2c3d4 --dry-run --json需要你选择的链上的钱包有足够的USDC余额。
bash
export PRIVATE_KEY=0xYOUR_PRIVATE_KEY
publish buy my-article-a1b2c3d4 --chain=base --json
publish buy my-article-a1b2c3d4 --chain=base --output=./downloaded.pdf使用参数可仅查询价格无需实际支付:
--dry-runbash
publish buy my-article-a1b2c3d4 --dry-run --jsonIdempotency
幂等性
Commands are safe to retry:
- checks for existing artifacts with matching title/price/author before creating
publish new - probes content first — if already unlocked, returns it without paying again
publish buy
所有命令都支持安全重试:
- 在创建前会校验是否存在标题/价格/作者完全匹配的已有产物
publish new - 会先探测内容状态——如果已经解锁,会直接返回内容无需重复支付
publish buy
Global flags
全局参数
| Flag | Description |
|---|---|
| Machine-readable JSON output |
| Suppress human-friendly messages |
| Override API base URL (default: https://publish.new) |
| 参数 | 说明 |
|---|---|
| 输出机器可读的JSON格式内容 |
| 屏蔽面向用户的友好提示信息 |
| 覆盖API基础地址(默认:https://publish.new) |
Option 2: HTTP API
选项2:HTTP API
Use these endpoints directly when you don't have CLI access (e.g. Claude web sessions, serverless functions, or any HTTP client).
Base URL:
https://publish.new当你无法使用CLI时可以直接调用这些端点(例如Claude网页会话、无服务器函数、任意HTTP客户端场景)。
基础地址:
https://publish.newPOST /api/artifact — Create an artifact
POST /api/artifact — 创建产物
Content-Type:
multipart/form-data| Field | Required | Description |
|---|---|---|
| yes | USDC price (e.g. |
| yes | Ethereum address to receive payments ( |
| one of content/file | Markdown text |
| one of content/file | File upload (max 100MB) |
| no | Artifact title (used to generate URL slug) |
| no | Short description |
bash
curl -X POST https://publish.new/api/artifact \
-F 'title=My Article' \
-F 'description=A short summary' \
-F 'content=# Hello World\n\nThis is my article.' \
-F 'price=1.50' \
-F 'walletAddress=0xYOUR_WALLET_ADDRESS'File upload:
bash
curl -X POST https://publish.new/api/artifact \
-F 'title=Premium Report' \
-F 'file=@./report.pdf' \
-F 'price=5.00' \
-F 'walletAddress=0xYOUR_WALLET_ADDRESS'Response (201):
json
{
"id": "uuid",
"slug": "my-article-a1b2c3d4",
"title": "My Article",
"description": "A short summary",
"content_type": "markdown",
"price": "1.500000",
"wallet_address": "0x...",
"attachment_id": null,
"created_at": "2026-03-25T00:00:00.000Z",
"updated_at": "2026-03-25T00:00:00.000Z",
"published_at": "2026-03-25T00:00:00.000Z"
}The artifact is now live at .
https://publish.new/<slug>Content-Type:
multipart/form-data| 字段 | 是否必填 | 说明 |
|---|---|---|
| 是 | USDC定价(例如 |
| 是 | 接收付款的以太坊地址( |
| content和file二选一 | Markdown文本内容 |
| content和file二选一 | 上传的文件(最大100MB) |
| 否 | 产物标题(用于生成URL slug) |
| 否 | 简短描述 |
bash
curl -X POST https://publish.new/api/artifact \
-F 'title=My Article' \
-F 'description=A short summary' \
-F 'content=# Hello World\n\nThis is my article.' \
-F 'price=1.50' \
-F 'walletAddress=0xYOUR_WALLET_ADDRESS'文件上传示例:
bash
curl -X POST https://publish.new/api/artifact \
-F 'title=Premium Report' \
-F 'file=@./report.pdf' \
-F 'price=5.00' \
-F 'walletAddress=0xYOUR_WALLET_ADDRESS'响应(201):
json
{
"id": "uuid",
"slug": "my-article-a1b2c3d4",
"title": "My Article",
"description": "A short summary",
"content_type": "markdown",
"price": "1.500000",
"wallet_address": "0x...",
"attachment_id": null,
"created_at": "2026-03-25T00:00:00.000Z",
"updated_at": "2026-03-25T00:00:00.000Z",
"published_at": "2026-03-25T00:00:00.000Z"
}产物创建后即可通过访问。
https://publish.new/<slug>GET /api/artifact — List artifacts
GET /api/artifact — 列出产物
| Param | Default | Description |
|---|---|---|
| 1 | Page number |
| 20 | Results per page (max 100) |
| — | Search title and description |
bash
curl 'https://publish.new/api/artifact?limit=10&search=machine+learning'Response (200):
json
{
"artifacts": [
{
"id": "uuid",
"slug": "my-article-a1b2c3d4",
"title": "My Article",
"description": "A short summary",
"content_type": "markdown",
"price": "1.500000",
"wallet_address": "0x...",
"attachment_id": null,
"published_at": "2026-03-25T00:00:00.000Z",
"created_at": "2026-03-25T00:00:00.000Z",
"updated_at": "2026-03-25T00:00:00.000Z"
}
],
"page": 1,
"limit": 10
}| 参数 | 默认值 | 说明 |
|---|---|---|
| 1 | 页码 |
| 20 | 每页返回结果数(最大100) |
| — | 搜索标题和描述内容 |
bash
curl 'https://publish.new/api/artifact?limit=10&search=machine+learning'响应(200):
json
{
"artifacts": [
{
"id": "uuid",
"slug": "my-article-a1b2c3d4",
"title": "My Article",
"description": "A short summary",
"content_type": "markdown",
"price": "1.500000",
"wallet_address": "0x...",
"attachment_id": null,
"published_at": "2026-03-25T00:00:00.000Z",
"created_at": "2026-03-25T00:00:00.000Z",
"updated_at": "2026-03-25T00:00:00.000Z"
}
],
"page": 1,
"limit": 10
}GET /api/artifact/:slug — Get artifact metadata
GET /api/artifact/:slug — 获取产物元数据
bash
curl https://publish.new/api/artifact/my-article-a1b2c3d4Response (200):
json
{
"id": "uuid",
"slug": "my-article-a1b2c3d4",
"title": "My Article",
"description": "A short summary",
"content_type": "markdown",
"price": "1.500000",
"wallet_address": "0x...",
"attachment_id": null,
"attachment": null,
"published_at": "2026-03-25T00:00:00.000Z",
"created_at": "2026-03-25T00:00:00.000Z",
"updated_at": "2026-03-25T00:00:00.000Z"
}Errors: 404 if not found, 400 if invalid slug format.
bash
curl https://publish.new/api/artifact/my-article-a1b2c3d4响应(200):
json
{
"id": "uuid",
"slug": "my-article-a1b2c3d4",
"title": "My Article",
"description": "A short summary",
"content_type": "markdown",
"price": "1.500000",
"wallet_address": "0x...",
"attachment_id": null,
"attachment": null,
"published_at": "2026-03-25T00:00:00.000Z",
"created_at": "2026-03-25T00:00:00.000Z",
"updated_at": "2026-03-25T00:00:00.000Z"
}错误:产物不存在返回404,slug格式无效返回400。
GET /api/artifact/:slug/price — Get price
GET /api/artifact/:slug/price — 查询价格
bash
curl https://publish.new/api/artifact/my-article-a1b2c3d4/priceResponse (200):
json
{
"price": 1.5
}bash
curl https://publish.new/api/artifact/my-article-a1b2c3d4/price响应(200):
json
{
"price": 1.5
}GET /api/artifact/:slug/content — Buy and download content
GET /api/artifact/:slug/content — 购买并下载内容
This endpoint is gated by x402. A plain GET without payment headers returns . The x402 protocol handles payment automatically when using an x402-compatible client like mppx.
402 Payment Requiredbash
curl https://publish.new/api/artifact/my-article-a1b2c3d4/content?chain=base| Param | Default | Description |
|---|---|---|
| base | |
| USDC | ERC-20 contract address |
Without payment → 402 with payment instructions in headers.
After x402 payment → 200 with content body:
- Markdown artifacts:
Content-Type: text/markdown - File artifacts: streamed with
Content-Disposition: attachment; filename="original-name.pdf"
Checking if content is already unlocked:
A plain GET that returns 200 means content is freely accessible or already unlocked. If you get 402, payment is required.
该端点受x402协议保护。未携带支付头的普通GET请求会返回。当你使用支持x402协议的客户端(例如mppx)时,x402协议会自动处理支付流程。
402 Payment Requiredbash
curl https://publish.new/api/artifact/my-article-a1b2c3d4/content?chain=base| 参数 | 默认值 | 说明 |
|---|---|---|
| base | 可选值: |
| USDC | ERC-20合约地址 |
未支付 → 返回402,响应头中包含支付指引。
完成x402支付后 → 返回200及内容主体:
- Markdown类产物:
Content-Type: text/markdown - 文件类产物:流式返回,
Content-Disposition: attachment; filename="original-name.pdf"
检查内容是否已解锁:
如果普通GET请求返回200,说明内容可免费访问或已解锁。如果返回402,则需要支付。
Error responses
错误响应
All endpoints return JSON errors:
json
{
"error": "Description of what went wrong"
}| Status | Meaning |
|---|---|
| 400 | Invalid input (missing fields, bad format) |
| 402 | Payment required (content endpoint) |
| 404 | Artifact not found |
| 500 | Server error |
所有端点的错误信息都为JSON格式:
json
{
"error": "错误描述信息"
}| 状态码 | 含义 |
|---|---|
| 400 | 输入无效(缺失字段、格式错误) |
| 402 | 需要支付(内容类端点) |
| 404 | 产物不存在 |
| 500 | 服务端错误 |
Validation rules
校验规则
- must match
walletAddressfollowed by 40 hex characters0x - must be a positive number
price - must match
slug[a-z0-9-]+ - File uploads max 100MB
- 必须符合
walletAddress加40位十六进制字符的格式0x - 必须为正数
price - 必须匹配正则
slug[a-z0-9-]+ - 上传文件最大100MB
Supported chains and currencies
支持的链和货币
| Chain | Currency | Contract address |
|---|---|---|
| tempo | USDC | |
| base | USDC | |
| base | DAI | |
| mainnet | USDC | |
| mainnet | DAI | |
| mainnet | USDT | |
| 链 | 货币 | 合约地址 |
|---|---|---|
| tempo | USDC | |
| base | USDC | |
| base | DAI | |
| mainnet | USDC | |
| mainnet | DAI | |
| mainnet | USDT | |
Example workflows
示例工作流
Agent publishes research and sells it
Agent发布研究报告并售卖
CLI:
bash
publish new \
--price=2.00 \
--author=0xAGENT_WALLET \
--file=./analysis.pdf \
--title="Q1 Market Analysis" \
--description="Comprehensive Q1 2026 market analysis" \
--jsonHTTP:
bash
curl -X POST https://publish.new/api/artifact \
-F 'title=Q1 Market Analysis' \
-F 'description=Comprehensive Q1 2026 market analysis' \
-F 'file=@./analysis.pdf' \
-F 'price=2.00' \
-F 'walletAddress=0xAGENT_WALLET'CLI方式:
bash
publish new \
--price=2.00 \
--author=0xAGENT_WALLET \
--file=./analysis.pdf \
--title="Q1 Market Analysis" \
--description="Comprehensive Q1 2026 market analysis" \
--jsonHTTP方式:
bash
curl -X POST https://publish.new/api/artifact \
-F 'title=Q1 Market Analysis' \
-F 'description=Comprehensive Q1 2026 market analysis' \
-F 'file=@./analysis.pdf' \
-F 'price=2.00' \
-F 'walletAddress=0xAGENT_WALLET'Agent discovers and buys data
Agent发现并购买数据
CLI:
bash
RESULTS=$(publish list --search="dataset" --limit=5 --json)
SLUG=$(echo "$RESULTS" | jq -r '.artifacts[0].slug')
publish price "$SLUG" --json
export PRIVATE_KEY=0xAGENT_KEY
publish buy "$SLUG" --chain=base --output=./dataset.csvHTTP:
bash
undefinedCLI方式:
bash
RESULTS=$(publish list --search="dataset" --limit=5 --json)
SLUG=$(echo "$RESULTS" | jq -r '.artifacts[0].slug')
publish price "$SLUG" --json
export PRIVATE_KEY=0xAGENT_KEY
publish buy "$SLUG" --chain=base --output=./dataset.csvHTTP方式:
bash
undefinedSearch for artifacts
搜索产物
curl -s 'https://publish.new/api/artifact?search=dataset&limit=5' | jq '.artifacts[0].slug'
curl -s 'https://publish.new/api/artifact?search=dataset&limit=5' | jq '.artifacts[0].slug'
Check price
查询价格
curl -s https://publish.new/api/artifact/SLUG/price | jq '.price'
curl -s https://publish.new/api/artifact/SLUG/price | jq '.price'
Buy requires an x402-compatible client (mppx) for automatic payment
购买需要使用支持x402协议的客户端(mppx)完成自动支付
undefinedundefinedAgent publishes text content without a file
Agent无需文件即可发布文本内容
HTTP:
bash
curl -X POST https://publish.new/api/artifact \
-F 'title=Daily Market Brief' \
-F 'content=# Market Brief\n\nToday the market moved significantly...' \
-F 'price=0.50' \
-F 'walletAddress=0xAGENT_WALLET'HTTP方式:
bash
curl -X POST https://publish.new/api/artifact \
-F 'title=Daily Market Brief' \
-F 'content=# Market Brief\n\nToday the market moved significantly...' \
-F 'price=0.50' \
-F 'walletAddress=0xAGENT_WALLET'Idempotency via API
通过API实现幂等
Before creating, search for an existing match:
bash
undefined创建前先搜索是否已有匹配的产物:
bash
undefinedCheck if artifact already exists
检查产物是否已存在
EXISTING=$(curl -s 'https://publish.new/api/artifact?search=My+Title&limit=5')
EXISTING=$(curl -s 'https://publish.new/api/artifact?search=My+Title&limit=5')
Parse results and check for matching title + price + wallet_address
解析结果,校验是否有标题+价格+钱包地址完全匹配的产物
If found, use the existing slug instead of creating a duplicate
如果存在,直接使用已有slug,无需创建重复内容
Before buying, check if content is already accessible:
```bash
购买前先检查内容是否已经可访问:
```bashProbe content endpoint without payment
不携带支付信息探测内容端点
STATUS=$(curl -s -o /dev/null -w '%{http_code}' https://publish.new/api/artifact/SLUG/content)
STATUS=$(curl -s -o /dev/null -w '%{http_code}' https://publish.new/api/artifact/SLUG/content)
If 200, content is already unlocked — no payment needed
如果返回200,说明内容已解锁——无需支付
If 402, proceed with x402 payment
如果返回402,再走x402支付流程
undefinedundefined