Skip to content

Monetize Your API

Register your REST API on FluxA, set per-endpoint pricing, and start earning. The proxy handles payments and forwards clean HTTP requests to your backend.

Architecture

Agent                        FluxA Proxy                     Your Backend
  |                              |                               |
  |-- POST /api/{slug}/path --> |                               |
  |   X-Agent-ID: <id-or-jwt>   |                               |
  |   X-Payment: <x402 token>   |                               |
  |                              |                               |
  |                              |-- verify payment ----------> |
  |                              |-- verify agent JWT --------> |
  |                              |   (if agent auth enabled)     |
  |                              |                               |
  |                              |-- POST /your/actual/path --> |
  |                              |   X-Api-Key: <your-key>       |
  |                              |   X-Agent-Id: <verified-id>   |
  |                              |   (static params injected)    |
  |                              |                               |
  |<-- response + settlement -- |<-- response ------------------|

The proxy:

  1. Verifies the agent's x402 payment
  2. Optionally verifies agent identity (JWT)
  3. Injects your configured static parameters (API keys, verified agent ID)
  4. Forwards the request to your backend
  5. Settles payment only after your backend responds successfully — if your backend errors, the agent is not charged

Setup

Go to monetize.fluxapay.xyz to get started.

1. Add Your API Server

Enter your API server URL. You can include the full path — the system auto-parses the base URL and endpoint path:

https://api.example.com/v1/chat/completions

Add Server page

The system auto-parses your URL into a base URL (your server address) and endpoint path (your first endpoint), and shows a request flow preview of how agents will reach your backend.

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. When enabled, the proxy verifies the JWT and can inject the verified agent ID into requests to your backend. See Agent Authentication.

Visibility — Public (listed on marketplace) or Private (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's encrypted at rest and never exposed to buyers.

Pricing — Set a USDC price per call (minimum $0.01).

Static Parameters — Headers, query params, and body fields injected into every request. These are encrypted and never exposed to buyers.

NameValueBackend 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 auth is enabled.

Endpoint path configuration

Endpoint pricing and static parameters

5. Review and Publish

Review your endpoints and pricing, then publish. Your API is live at:

https://proxy-monetize.fluxapay.xyz/api/{slug}/

Agents call your endpoints by appending the endpoint path to this base URL (e.g., /api/{slug}/forecast).

Drafts

Your configuration auto-saves as a draft while you fill in the form. If you leave:

  • The draft appears in My Servers with a yellow dot
  • Click it to resume where you left off
  • Published configs show a green dot
  • You can also manually save via the floating "Save Draft" button

My Servers with status dots

Agent Authentication

When the agent auth toggle is on:

  1. Agents must send a signed JWT (from FluxA Agent Wallet) in X-Agent-ID
  2. The proxy verifies the JWT signature against the agent-did JWKS
  3. Invalid/expired JWTs get 401 Unauthorized
  4. Valid JWTs → proxy extracts agent_id and email

You can inject the verified identity into your backend using template variables in static parameters:

  • {jwt.agent_id} — The agent's UUID (always present)
  • {jwt.email} — The agent's email (if present in JWT)

Why use this? Without agent auth, X-Agent-ID is a plain string anyone can set. With agent auth, it's cryptographically verified — agents cannot impersonate each other. Your backend can then do per-agent rate limiting, personalization, or access control.

What Your Backend Receives

The proxy strips all FluxA-specific headers (X-Payment, X-Agent-ID, X-Creator-Uid, X-Skill-Name, X-Task-Id) and injects your static parameters. Your backend gets a standard HTTP request — it doesn't need to know about x402 or JWTs.

Endpoint Matching

The proxy uses prefix matching. A pattern of /users matches:

  • /users (exact)
  • /users/123 (sub-path)
  • /users/123/profile (deeper sub-path)

Extra path segments are appended to the upstream path. If your public path is /users and upstream path is /v2/users, a request to /users/123 hits /v2/users/123 on your backend.

When multiple endpoints could match, the most specific (longest) pattern wins.

Analytics

Your dashboard shows:

  • Total calls and revenue per endpoint
  • Recent activity: timestamp, endpoint, amount, status (success/failed/payment_failed)
  • Agent ID and creator UID per request

Troubleshooting

ErrorCauseFix
400 Missing X-Agent-IDAgent didn't include identity headerAgent needs to set X-Agent-ID
401 Agent authentication failedJWT invalid, expired, or missing claimAgent should refresh JWT via fluxa-wallet refresh
402 Payment RequiredNo X-Payment header on paid endpointAgent needs to include x402 payment
402 Settlement failedPayment verified but blockchain settlement failedRetry the request
404 Endpoint not foundPath doesn't match any endpoint, or config is draftCheck endpoint config is published
502 Upstream request failedYour backend returned an error or timed outCheck your backend — no payment was taken

Released under the MIT License.