@x402/express (x402 v2). For x402 v1 or another framework, see Integrations.
1
Get an API key
In Forge, open your project’s Agents page and create an API key (it starts with
forge_). It’s shown once. The same page shows your backendUrl, which ends in /api/sdk/v2.2
Install
3
Mount the middleware before your payment middleware
server.js
4
Flush events on shutdown
5
Check it
Inspect a paid route without paying:The output should show the rating sentence at the end of the description, and a
forge-feedback block under Extensions. See Verify your setup for more checks.publicUrl is required and never taken from the request’s Host header, which anyone can fake. It’s the origin agents see in rating URLs.Next
- How it works: what Forge changes, and why each change is safe.
- OpenAPI: let discovery tools (such as agentcash) show the rating routes before the call.