Skip to main content

Agent quickstart

This guide makes a paid API call using the x402 protocol in stub mode — no real USDC required.

Prerequisites

  • A Prudra API key (prv_test_sk_...)
  • Node.js with @prudra/payments and ethers installed
  • A running Prudra-protected server (use example-01 or your own)

Step 1: Start a server with PAYMENT_STUB_MODE

With PAYMENT_STUB_MODE=true, the server accepts any payment signature — you don’t need real USDC.

Step 2: Make the first request (expect 402)

You receive a 402 with the challenge headers:

Step 3: Pay and retry (TypeScript)

What you get back

The vaultId gives you access to the full vault contents — documents and files generated by the server.

Next steps