Sell Your API
Publish your REST API on FluxA AgentMarket, set a price per endpoint, and get paid when agents call it. The AgentMarket router takes the x402 payments and forwards ordinary HTTP requests to your backend.
How it works
Agent AgentMarket router Your backend
| | |
|-- GET /api/{slug}/path -------> | |
| X-Payment: <x402 token> | |
| X-Agent-ID: <id or JWT> | |
| |-- check payment |
| |-- verify agent JWT |
| | (if agent auth is on) |
| | |
| |-- GET /your/private/path ---> |
| | X-Api-Key: <your secret> |
| | X-Agent-Id: <verified id> |
| | |
|<-- response + settlement ------- |<-- response ------------------|The router:
- Checks the agent's x402 payment
- Optionally verifies the agent's identity (JWT)
- Adds your static parameters (API keys, the verified agent ID)
- Forwards the request to your backend
- Charges the agent only after your backend answers successfully. If your backend fails, the agent is not charged
Your API is live at:
https://router.fluxapay.xyz/api/{slug}/Publish in the Console
Sign in at agentmarket.fluxapay.xyz and open Console > API Studio (/console/apis). Click Add Server.
1. Add your API server
Enter your API URL. You can include a full path: the Console splits it into a base URL and your first endpoint path, and previews how agents will reach your backend.
https://api.example.com/v1/chat/completions

2. Server details
- Server Name — shown to buyers on the marketplace
- Server Description — what your API does

3. Server settings
Agent Authentication (optional) — require agents to prove their identity with a signed JWT. See Agent authentication.
Visibility — Public (listed on the marketplace) or Private (reachable by direct URL only).
4. Endpoints
Each endpoint has two paths:
| Example | |
|---|---|
| Public path (what agents call) | /weather |
| Private path (what your backend receives) | /v2/weather?apiKey=sk-abc |
The private path can contain secrets. It is encrypted at rest and never shown to buyers.
Pricing — a USD price per call. 0 makes the endpoint free.
Static parameters — headers, query parameters and body fields added to every request. They are encrypted and never shown to buyers.
| Name | Value | Your backend receives |
|---|---|---|
X-Api-Key | sk-abc123 | X-Api-Key: sk-abc123 |
X-Agent-Id | {jwt.agent_id} | X-Agent-Id: a6aa03b9-... |
X-Agent-Email | {jwt.email} | X-Agent-Email: agent@example.com |
Template variables ({jwt.agent_id}, {jwt.email}) only resolve when agent authentication is on.


5. Review and publish
Review endpoints and prices, then publish. Agents call https://router.fluxapay.xyz/api/{slug}/{endpoint-path}.
Drafts
The form saves a draft as you go. Drafts and published APIs are listed in Console > API Studio; open a draft to continue where you left off.
Publish programmatically
You can create and edit APIs over HTTP, for example from an agent or a CI job.
Auth: Authorization: Bearer <fxa_live_ API key> or Bearer <Agent VC>. See API Keys & Auth. You can only see and edit your own APIs.
POST https://router.fluxapay.xyz/configs/api
Creates an API. It is saved as a draft unless you send "status": "published".
{
"serverName": "Weather API",
"serverDescription": "Real-time weather data",
"upstreamBaseUrl": "https://api.example.com",
"tags": ["weather", "data"],
"isPrivate": false,
"requireAgentAuth": false,
"status": "published",
"endpoints": [
{
"path_pattern": "/forecast",
"upstream_path_pattern": "/v2/forecast",
"method": "GET",
"description": "Forecast for a city. Query: city",
"price": 0.01,
"enabled": true,
"input_schema": { "type": "object", "properties": { "city": { "type": "string" } } },
"static_params": { "headers": [ { "name": "X-Api-Key", "value": "sk-..." } ] }
}
]
}| Field | Required | Description |
|---|---|---|
serverName | No | Display name. Defaults to "Untitled API" |
serverDescription | To publish | What the API does |
upstreamBaseUrl | To publish | Your backend's base URL. Must be a public address |
yourWallet | No | Payout wallet. Defaults to the wallet on your account; publishing fails if neither exists |
tags | No | Tags for discovery |
isPrivate | No | true hides the API from the marketplace. Default false |
requireAgentAuth | No | Require an agent JWT. Default false |
status | No | draft (default) or published |
endpoints[] | To publish (at least one) | See below |
| Endpoint field | Description |
|---|---|
path_pattern | Public path agents call, such as /forecast. Required |
upstream_path_pattern | Path on your backend. Defaults to path_pattern |
method | HTTP method. Omit to accept any |
description | Shown to buyers and agents |
price | USD per call. 0 = free |
enabled | Default true |
input_schema | JSON Schema of the input, shown to agents |
static_params | Headers, query and body fields added to every call. Never shown to buyers |
Response (201):
{
"success": true,
"message": "API published",
"configId": "9c1e...",
"slug": "weather-api",
"proxyUrl": "https://router.fluxapay.xyz/api/weather-api",
"proxyUrlById": "https://router.fluxapay.xyz/api/9c1e...",
"status": "published"
}GET https://router.fluxapay.xyz/configs/api
Lists your APIs: configs[] with configId, slug, serverName, status, isPrivate, endpointCount and createdAt.
GET https://router.fluxapay.xyz/configs/api/{idOrSlug}
Returns one API in the same shape as the create body, plus configId, slug and status. You can edit it and send it back with PATCH.
PATCH https://router.fluxapay.xyz/configs/api/{idOrSlug}
Send only the fields to change. Sending endpoints replaces the endpoint list. Send "status": "published" to publish a draft. Returns { "success": true, "message": "API updated", ... }. Changes take effect on the next call.
Errors
| Status | Meaning |
|---|---|
400 | Body is not JSON, or validation failed (for example a missing path_pattern, or a field required to publish). error says what is missing |
401 | Missing, invalid or expired credential |
403 | Account suspended |
404 | API not found, or not yours |
503 | The sign-in service is temporarily unavailable. Retry shortly |
Agent authentication
With agent authentication on:
- Agents must send a signed JWT from FluxA Agent Wallet in
X-Agent-ID - The router verifies the signature against the AgentID JWKS
- Missing, invalid or expired JWTs get
401 - For valid JWTs, the router reads
agent_idandemail
Pass the verified identity to your backend with template variables in static parameters:
{jwt.agent_id}— the agent's ID (always present){jwt.email}— the agent's email (if present in the JWT)
Why use it? Without agent authentication, X-Agent-ID is a plain string anyone can set. With it, the ID is verified, so agents cannot impersonate each other, and your backend can rate-limit, personalize or control access per agent.
What your backend receives
The router removes AgentMarket headers (X-Payment, X-Agent-ID, X-Creator-Uid, X-Skill-Name, X-Task-Id) and adds your static parameters. Your backend gets a standard HTTP request and needs no x402 or JWT code.
Endpoint matching
Paths are prefix-matched. A public path of /users serves:
/users/users/123/users/123/profile
Extra segments are appended to the private path: with public /users and private /v2/users, a call to /users/123 reaches /v2/users/123. When several endpoints match, the longest one wins.
Getting paid
Agents pay in USDC on Base or Monetize Credits. A call is charged only when your backend answers successfully. You cannot buy your own API.
Console > Product Analytics shows calls and revenue per endpoint, and recent calls with their outcome.
Troubleshooting
| What the agent sees | Cause | Fix |
|---|---|---|
401 asking for an agent JWT | Agent authentication is on and the agent sent no JWT, or an expired one | The agent sends a fresh JWT from fluxa-wallet refreshJWT |
402 Payment Required | No X-Payment on a paid endpoint | The agent pays the challenge and resends |
404 | The path matches no endpoint, or the API is still a draft | Publish the API and check the endpoint paths |
502 UPSTREAM_ERROR / UPSTREAM_UNREACHABLE | Your backend returned an error, timed out, or could not be reached | Check your backend. The agent was not charged |
For the full buyer-side error list, see Call Paid APIs.
