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)

VariableRequiredDescription
PORTNoHTTP port (default: 3000).
DATABASE_URLRecommendedPostgreSQL connection URI (e.g. Supabase pooler). Used for API keys, wallets, and spend events. Without it, persistence is limited.
FACILITATOR_URLYes*Base URL of the x402 facilitator (e.g. OpenFacilitator). Used for /verify and /settle. *Default may be set in code for development.
FACILITATOR_API_KEYNoOptional Bearer token for facilitator requests.
ALCHEMY_RPC_URLNoAlchemy (or other) Base RPC URL for future wallet signing and on-chain operations.
CDP_API_KEY_NAME, CDP_PRIVATE_KEYNoCoinbase Developer Platform API key. Required (with CDP_WALLET_SECRET) for real wallet creation.
CDP_WALLET_SECRETNoCDP 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_SECRETNoWhen 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)

VariableRequiredDescription
DATABASE_URLYesSame PostgreSQL as API. Used for Prisma (users, sessions, user_api_keys, organizations).
NEXT_PUBLIC_SUPABASE_URLYesSupabase project URL (e.g. https://<ref>.supabase.co). Required for Supabase Auth (GitHub sign-in).
NEXT_PUBLIC_SUPABASE_ANON_KEYYesSupabase anon/public key. Configure GitHub OAuth in Supabase Dashboard → Authentication → Providers.
ENCRYPTION_KEYYesAt least 32 characters; used to encrypt API keys stored in the database.
NEXT_PUBLIC_AGENTPAY_APIYesPublic 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_SECRETFor paid plansStripe keys for subscriptions. Also set STRIPE_PRICE_DEVELOPER and STRIPE_PRICE_AGENCY.
INTERNAL_API_SECRETNoSame 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).