Environment variables
This reference lists the environment variables used by the AgentPay API and the dashboard. Set these in your deployment (e.g. Render Environment, Railway Variables, Vercel environment variables) or in .env for local development.
API (AgentPay backend)
| Variable | Required | Description |
|---|---|---|
| PORT | No | HTTP port (default: 3000). |
| DATABASE_URL | Recommended | PostgreSQL connection URI (e.g. Supabase pooler). Used for API keys, wallets, and spend events. Without it, persistence is limited. |
| FACILITATOR_URL | Yes* | Base URL of the x402 facilitator (e.g. OpenFacilitator). Used for /verify and /settle. *Default may be set in code for development. |
| FACILITATOR_API_KEY | No | Optional Bearer token for facilitator requests. |
| ALCHEMY_RPC_URL | No | Alchemy (or other) Base RPC URL for future wallet signing and on-chain operations. |
| CDP_API_KEY_NAME, CDP_PRIVATE_KEY | No | Coinbase Developer Platform API key. Required (with CDP_WALLET_SECRET) for real wallet creation. |
| CDP_WALLET_SECRET | No | CDP Server Wallet Wallet Secret (Portal → Server Wallet → Wallet Secret). Required for POST /wallets to create real on-chain wallets; without it, wallet create returns 503. |
| INTERNAL_API_SECRET | No | When set, the dashboard can create API keys with organization_id and plan (for payment limit enforcement). Use the same value in the dashboard. |
Dashboard (Next.js)
| Variable | Required | Description |
|---|---|---|
| DATABASE_URL | Yes | Same PostgreSQL as API. Used for Prisma (users, sessions, user_api_keys, organizations). |
| NEXT_PUBLIC_SUPABASE_URL | Yes | Supabase project URL (e.g. https://<ref>.supabase.co). Required for Supabase Auth (GitHub sign-in). |
| NEXT_PUBLIC_SUPABASE_ANON_KEY | Yes | Supabase anon/public key. Configure GitHub OAuth in Supabase Dashboard → Authentication → Providers. |
| ENCRYPTION_KEY | Yes | At least 32 characters; used to encrypt API keys stored in the database. |
| NEXT_PUBLIC_AGENTPAY_API | Yes | Public base URL of the AgentPay API (e.g. https://api.agentpay.solutions). Used by the dashboard to proxy wallet and spend requests. |
| STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET | For paid plans | Stripe keys for subscriptions. Also set STRIPE_PRICE_DEVELOPER and STRIPE_PRICE_AGENCY. |
| INTERNAL_API_SECRET | No | Same value as on the API; enables creating keys with org/plan for payment limits. |
These variables are used when deploying the API and dashboard. For self-hosted setups, configure them in your hosting provider (e.g. Render Environment, Railway Variables, Vercel environment variables).