V1 Dev API - Postman Collection
September 8, 2025 ยท View on GitHub
A comprehensive Postman collection for the V1 Dev platform APIs with OAuth setup, CSRF protection, and all endpoints properly documented.
๐ Overview
This collection includes 100+ API endpoints organized into logical groups:
- ๐ Authentication - OAuth, email auth, session management (16 endpoints)
- ๐ค Agent & Code Generation - AI-powered webapp creation (5 endpoints)
- ๐ฑ Apps Management - CRUD operations, public feed, favorites (10 endpoints)
- ๐ค User Management - Profile, apps with pagination (2 endpoints)
- ๐ Analytics & Stats - User stats, AI Gateway analytics (4 endpoints)
- ๐ค Model Configuration - AI model settings, BYOK providers (8 endpoints)
- ๐ข Custom Model Providers - OpenAI-compatible API management (6 endpoints)
- ๐ Secrets Management - API keys, credentials with templates (5 endpoints)
- ๐ GitHub Integration - Repository export, OAuth (2 endpoints)
๐ Quick Setup
1. Import Collection & Environment
-
Import Collection:
- Open Postman โ Import โ Upload
v1dev-api-collection.postman_collection.json
- Open Postman โ Import โ Upload
-
Import Environment:
- Import โ Upload
v1dev-environment.postman_environment.json
- Import โ Upload
-
Select Environment:
- Choose "V1 Dev Environment" from the environment dropdown
2. Configure Base URL
Update the baseUrl environment variable:
- Production:
https://your-production-domain.com - Local Development:
http://localhost:8787(Wrangler dev server)
3. OAuth Setup in Postman
โ ๏ธ IMPORTANT: OAuth endpoints redirect to external providers (Google/GitHub) and cannot be tested directly in Postman.
๐ Recommended Approach: OAuth Helper Requests
-
Use the OAuth Helper requests:
- Run "๐ OAuth Helper - Get Google URL"
- Check the Console tab in Postman for the OAuth URL
- Copy the URL and open it in your browser
-
Complete authentication in browser:
- Follow the OAuth flow in your browser
- After successful auth, you'll be redirected back to your app
- Session cookies are now set for your domain
-
Return to Postman:
- Session cookies will work automatically for same-domain requests
- Test with "Get User Profile" to verify authentication
Alternative: Manual URL Construction
If helpers don't work, manually construct URLs:
- Google OAuth:
{{baseUrl}}/api/auth/oauth/google - GitHub OAuth:
{{baseUrl}}/api/auth/oauth/github - Open these URLs directly in your browser
Why Direct OAuth Requests Show HTML
- OAuth endpoints return HTTP redirects (302) to provider websites
- Postman shows the redirect HTML instead of following it
- This is normal behavior - OAuth requires browser-based flows
4. CSRF Token Automation
The collection automatically handles CSRF tokens:
- Pre-request scripts fetch CSRF tokens when needed
- Tokens are stored in the
csrf_tokenenvironment variable - All state-changing requests include the token automatically
๐ Authentication Methods
1. Email Authentication
POST /api/auth/register
{
"email": "user@example.com",
"password": "SecurePassword123!",
"name": "Test User"
}
POST /api/auth/login
{
"email": "user@example.com",
"password": "SecurePassword123!"
}
2. OAuth Authentication
- Google OAuth:
GET /api/auth/oauth/google - GitHub OAuth:
GET /api/auth/oauth/github
3. Session-Based Authentication
- Uses secure HTTP-only cookies
- Sessions are automatically maintained across requests
- CSRF protection via
X-CSRF-Tokenheader
๐ฑ Core API Workflows
1. Create a New App with AI
# 1. Login or use OAuth
POST /api/auth/login
# 2. Start code generation
POST /api/agent
{
"query": "Create a React todo app with TypeScript and Tailwind CSS",
"agentMode": "smart",
"language": "typescript",
"frameworks": ["react", "tailwindcss"],
"selectedTemplate": "react-typescript"
}
# 3. Connect to WebSocket for real-time updates
GET /api/agent/{agentId}/ws (WebSocket)
# 4. Deploy preview when ready
GET /api/agent/{agentId}/preview
2. Browse and Interact with Apps
# Get public apps (no auth required)
GET /api/apps/public?page=1&limit=20&sort=stars&order=desc
# Get app details (no auth required)
GET /api/apps/{appId}
# Star an app (requires auth)
POST /api/apps/{appId}/star
# Fork an app (requires auth)
POST /api/apps/{appId}/fork
3. Configure AI Models
# Get available models and providers
GET /api/model-configs/byok-providers
# Update model configuration for specific agent action
PUT /api/model-configs/planner
{
"modelName": "claude-3-5-sonnet-20241022",
"maxTokens": 4096,
"temperature": 0.7,
"reasoningEffort": "medium"
}
# Test model configuration
POST /api/model-configs/test
{
"agentActionName": "planner",
"useUserKeys": true
}
4. Manage API Keys and Secrets
# Get secret templates
GET /api/secrets/templates
# Store an API key
POST /api/secrets
{
"templateId": "openai_api_key",
"name": "My OpenAI API Key",
"envVarName": "OPENAI_API_KEY",
"value": "sk-your-api-key-here"
}
# Create custom model provider
POST /api/user/providers
{
"name": "My Custom OpenAI Provider",
"baseUrl": "https://api.openai.com/v1",
"apiKey": "sk-your-key",
"models": [...]
}
๐ง Advanced Features
Environment Variables
The collection uses these automatically managed variables:
| Variable | Description | Auto-populated |
|---|---|---|
csrf_token | CSRF protection token | โ |
user_id | Current user ID | โ |
session_id | Current session ID | โ |
agent_id | Current agent/app ID | โ |
app_id | Current app ID | โ |
provider_id | Model provider ID | Manual |
secret_id | Secret ID | Manual |
Request Automation
- CSRF Tokens: Automatically fetched and included
- Session Management: Cookies handled transparently
- Variable Population: IDs extracted from responses
- Error Handling: Test scripts validate responses
WebSocket Testing
For WebSocket endpoints like agent communication:
- Use a WebSocket client (wscat, Postman WebSocket, etc.)
- Connect to:
ws://localhost:8787/api/agent/{agentId}/ws - Include authentication cookies
- Send/receive real-time messages during code generation
๐ ๏ธ Development Setup
Local Development
-
Start Wrangler Dev Server:
cd /path/to/v1dev npm run local # Starts on http://localhost:8787 -
Update Environment:
- Set
baseUrltohttp://localhost:8787 - Ensure
.dev.varscontains required environment variables
- Set
-
Test Authentication:
- OAuth may require ngrok for localhost callback URLs
- Email auth works directly with localhost
Production Testing
- Update
baseUrlto your production domain - Ensure OAuth apps are configured with correct callback URLs
- Test with real OAuth credentials
๐ API Documentation
Authentication Levels
- Public: No authentication required
- Authenticated: Requires valid session
- Owner Only: Requires ownership of the resource
Common Parameters
| Parameter | Description | Example |
|---|---|---|
page | Page number for pagination | 1 |
limit | Items per page | 20 |
sort | Sort field | createdAt, stars |
order | Sort order | asc, desc |
period | Time period filter | today, week, month, all |
search | Search query | "todo app" |
Response Format
All API responses follow this structure:
{
"success": true,
"data": { ... },
"message": "Optional message",
"pagination": { // For paginated responses
"page": 1,
"limit": 20,
"total": 100,
"totalPages": 5
}
}
Error Responses
{
"success": false,
"error": "Error message",
"code": "ERROR_CODE",
"details": { ... } // Optional additional details
}
๐จ Troubleshooting
Common Issues
-
CSRF Token Errors:
- Ensure pre-request scripts are enabled
- Manually run "Get CSRF Token" request
- Check that
X-CSRF-Tokenheader is included in POST/PUT/DELETE requests
-
Authentication Issues:
- Verify cookies are enabled in Postman
- Check that OAuth callback URLs match your configuration
- Ensure session hasn't expired (check "Get User Profile")
-
WebSocket Connection Issues:
- WebSockets require active session authentication
- Use external WebSocket client if Postman WebSocket support is limited
- Verify agent ownership for WebSocket connections
-
Local Development Issues:
- Ensure Wrangler is running (
npm run local) - Check that
.dev.varsfile contains required environment variables - Verify D1 database is set up (
npm run db:setup)
- Ensure Wrangler is running (
Getting Help
- Check API Response: Look at response body for detailed error messages
- Verify Environment: Ensure correct
baseUrlis set - Test Authentication: Run "Check Auth Status" to verify session
- Review Logs: Check browser DevTools or Wrangler logs for additional context
๐ฏ Testing Workflows
Complete User Journey
- Register/Login โ Authentication working
- Create App โ AI generation working
- Browse Public Apps โ Public feed working
- Star/Fork App โ Social features working
- Configure Models โ AI customization working
- Manage Secrets โ Security features working
- Export to GitHub โ Integration working
Quick Health Check
Run these requests to verify the system:
GET /api/auth/providers- System statusGET /api/apps/public- Public API workingPOST /api/auth/login- Authentication workingGET /api/model-configs- AI system workingGET /api/stats- Analytics working
This collection provides comprehensive coverage of all V1 Dev APIs with proper authentication, error handling, and real-world usage examples. Perfect for development, testing, and integration work!