Documentation Index
Fetch the complete documentation index at: https://docs.prudra.dev/llms.txt
Use this file to discover all available pages before exploring further.
Your first payment in 5 minutes
This guide walks you through adding a payment-gated endpoint to an Express server using Prudra. By the end, you’ll have a working endpoint that returns HTTP 402 when called without payment, accepts payment via either x402 or MPP, creates a vault, and returns the vault ID in the response. You’ll use stub mode for testing — no real wallet or crypto needed.- Dashboard
- SDK
Dashboard support for creating paid endpoints is coming soon. Follow the API/SDK steps to get started.
Test the endpoint
Without payment — expect HTTP 402:vaultId is the ID of the vault that was created for this payment. Your agent can use it to retrieve the result later via GET https://api.prudra.dev/vaults/<vaultId>.
Stub mode (
X-PAYMENT: stub_payment_accepted) only works when PAYMENT_STUB_MODE=true is set on the server. This is the default in development. Never enable stub mode in production.What happened
- The
walletMiddlewareattached your wallet to the request context — payment goes to that wallet - The
payMiddlewarechecked for a payment credential - Without one, it generated both an x402 and MPP challenge and returned 402
- With the stub payment, it skipped real verification and proceeded
- The
vaultMiddlewarecreated a new vault and attached it toreq.vault - Your handler ran, wrote a document to the vault, sealed it, and returned the vault ID
Error handling
| Error | Cause | Resolution |
|---|---|---|
401 Unauthorized | Missing or invalid API key | Check PRUDRA_API_KEY in your env. Keys start with prv_test_sk_ for test mode. |
WALLET_NOT_CONFIGURED | walletMiddleware can’t find a wallet | Set BYO_WALLET_ID in your env, or provision a managed wallet. |
vault-quota-exceeded | You’ve hit your plan’s active vault limit | Seal existing vaults or upgrade your plan. |
Next steps
- How Prudra works — understand the 402 flow, vaults, and wallets in depth
- Accept a payment — the full middleware chain with all options
- Add session payments — one payment covering multiple requests
- Subscribe to vault events — real-time streaming from a vault

