curl -X PUT https://api.xenarch.dev/v1/sites/b2c3d4e5-f6a7-8901-bcde-f23456789012/pricing \
-H "Authorization: Bearer xk_pub_abc123..." \
-H "Content-Type: application/json" \
-d '{
"default_price_usd": "0.003",
"default_billing_scope": "page",
"rules": [
{"path": "/premium/*", "price_usd": "0.01", "billing_scope": "page"},
{"path": "/api/*", "price_usd": "0.05", "billing_scope": "path"},
{"path": "/public/*", "price_usd": "0"}
]
}'
{
"rules_applied": 4
}
Sites
Update Pricing
Set a site’s default x402 price and per-path pricing rules for AI agent access. Prices run from 0to1 per request in USDC.
PUT
/
v1
/
sites
/
{site_id}
/
pricing
curl -X PUT https://api.xenarch.dev/v1/sites/b2c3d4e5-f6a7-8901-bcde-f23456789012/pricing \
-H "Authorization: Bearer xk_pub_abc123..." \
-H "Content-Type: application/json" \
-d '{
"default_price_usd": "0.003",
"default_billing_scope": "page",
"rules": [
{"path": "/premium/*", "price_usd": "0.01", "billing_scope": "page"},
{"path": "/api/*", "price_usd": "0.05", "billing_scope": "path"},
{"path": "/public/*", "price_usd": "0"}
]
}'
{
"rules_applied": 4
}
curl -X PUT https://api.xenarch.dev/v1/sites/b2c3d4e5-f6a7-8901-bcde-f23456789012/pricing \
-H "Authorization: Bearer xk_pub_abc123..." \
-H "Content-Type: application/json" \
-d '{
"default_price_usd": "0.003",
"default_billing_scope": "page",
"rules": [
{"path": "/premium/*", "price_usd": "0.01", "billing_scope": "page"},
{"path": "/api/*", "price_usd": "0.05", "billing_scope": "path"},
{"path": "/public/*", "price_usd": "0"}
]
}'
{
"rules_applied": 4
}
Body
| Field | Type | Description |
|---|---|---|
default_price_usd | decimal | Price for paths no rule matches. 0 to 1 |
default_billing_scope | string | page (default) or path |
rules[].path | string | Glob pattern for the URL path |
rules[].price_usd | decimal | Price for matching paths. 0 to 1 |
rules[].billing_scope | string | page (default) or path. The plugins show these as per page and per path |
Notes
- Patterns use shell-style globs (Python
fnmatch).*matches any run of characters, including/. - When several rules match a path, the one with the longest pattern wins. If none match, the default price applies.
- A price of
"0"makes the path free for bots. - The request replaces all existing rules.
rules_appliedcounts the default plus each rule.
Body
application/json