Skip to content

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:

  1. Checks the agent's x402 payment
  2. Optionally verifies the agent's identity (JWT)
  3. Adds your static parameters (API keys, the verified agent ID)
  4. Forwards the request to your backend
  5. 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

Add Server page

URL parsed into base URL and endpoint path

2. Server details ​

  • Server Name — shown to buyers on the marketplace
  • Server Description — what your API does

Server information

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.

NameValueYour backend receives
X-Api-Keysk-abc123X-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.

Endpoint path configuration

Endpoint pricing and static parameters

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".

json
{
  "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-..." } ] }
    }
  ]
}
FieldRequiredDescription
serverNameNoDisplay name. Defaults to "Untitled API"
serverDescriptionTo publishWhat the API does
upstreamBaseUrlTo publishYour backend's base URL. Must be a public address
yourWalletNoPayout wallet. Defaults to the wallet on your account; publishing fails if neither exists
tagsNoTags for discovery
isPrivateNotrue hides the API from the marketplace. Default false
requireAgentAuthNoRequire an agent JWT. Default false
statusNodraft (default) or published
endpoints[]To publish (at least one)See below
Endpoint fieldDescription
path_patternPublic path agents call, such as /forecast. Required
upstream_path_patternPath on your backend. Defaults to path_pattern
methodHTTP method. Omit to accept any
descriptionShown to buyers and agents
priceUSD per call. 0 = free
enabledDefault true
input_schemaJSON Schema of the input, shown to agents
static_paramsHeaders, query and body fields added to every call. Never shown to buyers

Response (201):

json
{
  "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 ​

StatusMeaning
400Body is not JSON, or validation failed (for example a missing path_pattern, or a field required to publish). error says what is missing
401Missing, invalid or expired credential
403Account suspended
404API not found, or not yours
503The sign-in service is temporarily unavailable. Retry shortly

Agent authentication ​

With agent authentication on:

  1. Agents must send a signed JWT from FluxA Agent Wallet in X-Agent-ID
  2. The router verifies the signature against the AgentID JWKS
  3. Missing, invalid or expired JWTs get 401
  4. For valid JWTs, the router reads agent_id and email

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 seesCauseFix
401 asking for an agent JWTAgent authentication is on and the agent sent no JWT, or an expired oneThe agent sends a fresh JWT from fluxa-wallet refreshJWT
402 Payment RequiredNo X-Payment on a paid endpointThe agent pays the challenge and resends
404The path matches no endpoint, or the API is still a draftPublish the API and check the endpoint paths
502 UPSTREAM_ERROR / UPSTREAM_UNREACHABLEYour backend returned an error, timed out, or could not be reachedCheck your backend. The agent was not charged

For the full buyer-side error list, see Call Paid APIs.

Released under the MIT License.