Getting Started with DreamAPI
From zero to a fully secured API gateway in under 5 minutes. Follow the steps below or jump to any section.
Jump to
1. Create a Project
Click "+ New Project" from your dashboard or the nav bar.
Give it a name (e.g. "My SaaS App") and an optional description.
Each project is a self-contained workspace — its own integrations, keys, and billing scope.
Free tier: 1 project after launch. Builder: $9.99/mo.
2. Connect Integrations
Inside your project, go to the Integrations tab.
Click Connect via Secure Sign-In for each provider (OAuth).
Dream stores only encrypted OAuth custody material — never customer-pasted provider API keys.
Token Scope, Status, and Expiration are shown on the Integration Wall.
Paste API keys and vault storage are removed. Free tier: 3 integrations. Builder: unlimited.
3. Keyless OAuth Relay
Dream is an airlock: your app uses one Dream Key; providers use short-lived OAuth access tokens.
Refresh tokens are encrypted at rest (Phase 1). Access tokens are never persisted.
Use Reauthorize Provider if a connection is marked broken.
See Architecture_Blueprints/00_MASTER_SPEC.md for the mandatory architecture.
Phase 2 will eliminate token custody entirely (provider-validated Dream signatures).
4. Generate a Dream Key
Go to the Keys section of your project.
Click "Generate Dream Key" — you'll get a single token like dpk_live_abc123....
This key is your master gateway token. Use it in your .env file instead of individual API keys.
Copy it immediately — for security, the full key is only shown once.
Free tier: 1 key per project. Builder plan: unlimited keys.
5. Gateway Checkout & Webhooks
Use the gateway checkout endpoint to create Stripe checkout sessions through DreamAPI:
POST /api/gateway/checkout with your Dream Key in the Authorization header.
Set up webhook receivers at /api/gateway/webhook/[projectId]/[provider] to capture events from Stripe, Clerk, GitHub, and more.
All webhook events are logged in your project for debugging.
The gateway validates your Dream Key and routes requests using ephemeral OAuth access tokens.
6. Download Your .env
From the project overview, download a .env file with your Dream Key pre-configured.
Drop it into your project root and your app connects to all services through one token.
When you rotate keys, just download a fresh .env — no need to update 10 different dashboards.
The .env file never contains raw third-party API keys — only your Dream Project Key.
7. Rotate & Revoke
From the Keys panel, click "Revoke" on any active key to instantly disable it.
Generate a new key to replace it — all your integrations continue working with the new token.
Rotation is instant with zero downtime for your services.
Rotate your keys regularly as a security best practice. Revoked keys can never be reactivated.
8. Client SDK (`lib/dream-client.ts`)
Import DreamClient from @/lib/dream-client in Server Components, Route Handlers, or Client Components.
Set DREAM_PROJECT_KEY (or pass apiKey) — supports both dpk_live_... and dpk_test_... modes.
Call dream.ping() to verify the relay and OAuth connections, or dream.checkout(...) for Stripe sessions (live keys only).
Example: const dream = new DreamClient(); const status = await dream.authenticate();
Test keys are for relay verification only. Checkout always requires a live Dream Project Key.
Plans at a Glance
Free
$0/mo
- ✓ 1 project
- ✓ 3 integrations
- ✓ 1 Dream Key
- ✓ Keyless OAuth relay
Builder
$9.99/mo
Launch trial available when active. Builder is $9.99/mo after trial.
- ✓ Unlimited projects
- ✓ Unlimited integrations
- ✓ Unlimited Dream Keys
- ✓ Priority support