Comprehensive documentation for the Stylize MCP Server REST API.
The server supports multiple authentication methods:
Include your API key in the Authorization header:
curl -H "Authorization: Bearer your-api-key-here" \
-X POST https://stylize-mcp-server-997481449751.us-central1.run.app/stylize_imageAccess 5 free images without registration:
# No authentication needed - server automatically creates trial session
curl -X POST https://stylize-mcp-server-997481449751.us-central1.run.app/stylize_image \
-F "style_id=van_gogh" \
-F "user_prompt=a beautiful landscape"Include JWT token from login:
curl -H "Authorization: Bearer jwt-token-here" \
-X GET https://stylize-mcp-server-997481449751.us-central1.run.app/user/profileTransform images with artistic styles or generate from text descriptions.
Authentication: API key, trial session, or JWT token
curl -H "Authorization: Bearer your-api-key" \
-X POST /stylize_image \
-F "style_id=van_gogh" \
-F "user_prompt=a serene mountain landscape" \
-F "image=@photo.jpg" # Optional: upload image to stylize# Omit style_id to generate 4 different artistic styles
curl -H "Authorization: Bearer your-api-key" \
-X POST /stylize_image \
-F "user_prompt=a serene mountain landscape"| Parameter | Type | Required | Description |
|---|---|---|---|
style_id |
string | No | Style to apply. Omit for 4 random styles |
user_prompt |
string | Yes | Description of desired image |
image |
file | No | Image file to stylize (multipart upload) |
project_context |
object | No | Brand colors, mood, target audience |
{
"original_id": "req-123",
"style": "van_gogh",
"stylized_image_url": "https://storage.googleapis.com/...",
"prompt_used": "a serene mountain landscape, in the style of Vincent van Gogh...",
"trial_info": {
"images_used": 1,
"images_remaining": 4,
"signup_message": "You have 4 free images remaining. Sign up for 100 free images per month!",
"signup_url": "/auth/register"
}
}{
"original_id": "req-124",
"multiple_styles": true,
"images": [
{
"style_id": "van_gogh",
"style_name": "Van Gogh",
"stylized_image_url": "https://storage.googleapis.com/...",
"prompt_used": "a serene mountain landscape, in the style of Vincent van Gogh..."
},
{
"style_id": "pixel_art",
"style_name": "Pixel Art",
"stylized_image_url": "https://storage.googleapis.com/...",
"prompt_used": "a serene mountain landscape, as pixel art..."
},
{
"style_id": "flat_ui_icon",
"style_name": "Flat UI Icon",
"stylized_image_url": "https://storage.googleapis.com/...",
"prompt_used": "a serene mountain landscape, as a minimalist flat design..."
},
{
"style_id": "neumorphic_button",
"style_name": "Neumorphic Button",
"stylized_image_url": "https://storage.googleapis.com/...",
"prompt_used": "a serene mountain landscape, as a neumorphic UI element..."
}
],
"total_images": 4,
"trial_info": {
"images_used": 5,
"images_remaining": 0,
"signup_message": "You have 0 free images remaining. Sign up for 100 free images per month!",
"signup_url": "/auth/register"
}
}List all available artistic styles.
Authentication: API key, trial session, or JWT token
[
{
"id": "van_gogh",
"name": "Van Gogh",
"description": "Bold, swirling brush strokes with vibrant colors inspired by Vincent van Gogh",
"example_prompt": "in the style of Vincent van Gogh with bold brush strokes and vibrant colors"
},
{
"id": "pixel_art",
"name": "Pixel Art",
"description": "Retro 8-bit video game aesthetic with blocky, pixelated appearance",
"example_prompt": "as pixel art with a retro 8-bit video game aesthetic"
},
{
"id": "flat_ui_icon",
"name": "Flat UI Icon",
"description": "Modern, minimalist flat design with clean lines and solid colors",
"example_prompt": "as a minimalist flat design icon with clean lines and solid colors"
},
{
"id": "neumorphic_button",
"name": "Neumorphic Button",
"description": "Soft UI design with subtle shadows and highlights creating depth",
"example_prompt": "as a neumorphic UI element with soft shadows and subtle depth"
},
{
"id": "abstract_geometric",
"name": "Abstract Geometric",
"description": "Geometric patterns and shapes with abstract artistic interpretation",
"example_prompt": "as abstract geometric art with patterns and angular shapes"
}
]Check current trial session usage and limits.
Authentication: None required (uses session tracking)
{
"session_id": "trial-abc123",
"images_used": 3,
"images_remaining": 2,
"can_generate": true,
"signup_message": "You have 2 free images remaining. Sign up for 100 free images per month!",
"signup_url": "/auth/register",
"upgrade_options": [
{
"type": "free_account",
"title": "Free Account",
"description": "100 images per month",
"action_url": "/auth/register"
},
{
"type": "credit_purchase",
"title": "Credit Packages",
"description": "Unlimited usage with credits",
"action_url": "/pricing/packages"
}
]
}View available credit packages for purchase.
Authentication: None required
[
{
"id": "starter",
"name": "Starter Pack",
"credits": 50,
"bonus_credits": 5,
"total_credits": 55,
"price": 9.99,
"popular": false
},
{
"id": "popular",
"name": "Popular Pack",
"credits": 200,
"bonus_credits": 25,
"total_credits": 225,
"price": 29.99,
"popular": true
},
{
"id": "pro",
"name": "Pro Pack",
"credits": 500,
"bonus_credits": 75,
"total_credits": 575,
"price": 59.99,
"popular": false
},
{
"id": "enterprise",
"name": "Enterprise Pack",
"credits": 1000,
"bonus_credits": 200,
"total_credits": 1200,
"price": 99.99,
"popular": false
}
]Convert anonymous trial session to registered user account.
Authentication: None required (uses trial session)
{
"session_id": "trial-abc123",
"email": "user@example.com",
"password": "securepass123",
"first_name": "John",
"last_name": "Doe",
"company": "Example Corp"
}{
"message": "Trial converted successfully",
"user_id": "user-xyz789",
"jwt_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"credits_awarded": 100,
"subscription": {
"tier": "free",
"monthly_limit": 100,
"current_usage": 0
}
}Register new user account.
Authentication: None required
{
"email": "user@example.com",
"password": "securepass123",
"first_name": "John",
"last_name": "Doe",
"company": "Example Corp"
}{
"message": "User registered successfully",
"user_id": "user-xyz789",
"jwt_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"subscription": {
"tier": "free",
"monthly_limit": 100,
"credits": 100
}
}Authenticate user and receive JWT token.
Authentication: None required
{
"email": "user@example.com",
"password": "securepass123"
}{
"jwt_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"user": {
"id": "user-xyz789",
"email": "user@example.com",
"first_name": "John",
"last_name": "Doe"
},
"subscription": {
"tier": "free",
"monthly_limit": 100,
"current_usage": 25
}
}Get current user profile information.
Authentication: JWT token required
{
"id": "user-xyz789",
"email": "user@example.com",
"first_name": "John",
"last_name": "Doe",
"company": "Example Corp",
"created_at": "2024-01-01T00:00:00Z",
"subscription": {
"tier": "free",
"monthly_limit": 100,
"current_usage": 25
}
}Get user credit balance and usage information.
Authentication: JWT token required
{
"credits": 150,
"monthly_credits": 100,
"purchased_credits": 50,
"current_month_usage": 25,
"monthly_limit": 100,
"subscription_tier": "free",
"next_reset_date": "2024-02-01T00:00:00Z"
}Purchase additional credits.
Authentication: JWT token required
{
"package_id": "starter"
}{
"message": "Credits purchased successfully",
"package": {
"name": "Starter Pack",
"credits": 50,
"bonus_credits": 5,
"total_credits": 55,
"price": 9.99
},
"new_balance": {
"total_credits": 205,
"purchased_credits": 105
},
"transaction_id": "txn-abc123"
}Get complete user dashboard data.
Authentication: JWT token required
{
"user": {
"id": "user-xyz789",
"email": "user@example.com",
"first_name": "John",
"last_name": "Doe"
},
"credits": {
"total": 205,
"monthly": 100,
"purchased": 105,
"current_month_usage": 25
},
"subscription": {
"tier": "free",
"monthly_limit": 100,
"next_reset": "2024-02-01T00:00:00Z"
},
"usage_stats": {
"total_images_generated": 125,
"this_month": 25,
"favorite_style": "van_gogh"
},
"credit_packages": [
{
"id": "starter",
"name": "Starter Pack",
"total_credits": 55,
"price": 9.99,
"popular": false
}
]
}Create API key for current user.
Authentication: JWT token required
{
"name": "My Integration",
"permissions": ["stylize", "styles"]
}{
"key_id": "key-abc123",
"name": "My Integration",
"api_key": "sk-1234567890abcdef...",
"permissions": ["stylize", "styles"],
"created_at": "2024-01-01T00:00:00Z",
"warning": "Store this API key securely. It will not be shown again."
}List user's API keys.
Authentication: JWT token required
[
{
"key_id": "key-abc123",
"name": "My Integration",
"permissions": ["stylize", "styles"],
"is_active": true,
"created_at": "2024-01-01T00:00:00Z",
"last_used": "2024-01-15T10:30:00Z"
}
]Revoke user's API key.
Authentication: JWT token required
{
"message": "API key revoked successfully",
"key_id": "key-abc123"
}Interactive demo page with trial credits and MCP integration guide.
Authentication: None required
Response: HTML page with:
- Drag & drop image upload interface
- Text-to-image generation form
- Real-time credit tracking (5 free images)
- Style selection including "Surprise Me" (4 random styles)
- Step-by-step Claude Desktop MCP setup instructions
- Mobile-friendly responsive design
Trial upgrade form for converting anonymous users to registered accounts.
Authentication: None required (uses session tracking)
Response: HTML form with:
- Trial session progress indicator
- Account creation form (email, password, name)
- Benefits of upgrading (100 free images/month)
- Professional responsive design
Process trial conversion via web form.
Authentication: None required (uses trial session)
email: User email addresspassword: Account passwordfirst_name: User first namelast_name: User last namecompany: Company name (optional)
Success: Redirect to /web/dashboard with success message
Error: Redirect back to /web/upgrade with error message
User dashboard with credit balance and purchase options.
Authentication: Cookie-based session (automatic after login/registration)
Response: HTML dashboard with:
- Current credit balance and usage statistics
- Monthly subscription limits and usage
- Credit purchase buttons for all 4 pricing tiers
- Recent image generation history
- Account management options
- Professional SaaS-quality interface
Process credit purchase via web form.
Authentication: Cookie-based session required
package_id: Credit package to purchase (starter,popular,pro,enterprise)
Success: Redirect to /web/dashboard with purchase confirmation
Error: Redirect back to /web/dashboard with error message
User logout endpoint.
Authentication: Cookie-based session
Clears session cookies and redirects to homepage.
Create API key (admin only).
Authentication: API key with admin permission required
{
"name": "Production Client",
"permissions": ["stylize", "styles", "mcp"]
}{
"key_id": "key-abc123",
"name": "Production Client",
"api_key": "sk-1234567890abcdef...",
"permissions": ["stylize", "styles", "mcp"],
"created_at": "2024-01-01T00:00:00Z"
}List all API keys.
Authentication: API key with admin permission required
[
{
"key_id": "key-abc123",
"name": "Production Client",
"permissions": ["stylize", "styles", "mcp"],
"is_active": true,
"created_at": "2024-01-01T00:00:00Z",
"last_used": "2024-01-15T10:30:00Z"
}
]Update API key properties.
Authentication: API key with admin permission required
{
"is_active": false,
"permissions": ["stylize", "styles"]
}{
"message": "API key updated successfully",
"key_id": "key-abc123",
"is_active": false,
"permissions": ["stylize", "styles"]
}Deactivate API key.
Authentication: API key with admin permission required
{
"message": "API key deactivated successfully",
"key_id": "key-abc123"
}Get security metrics and abuse statistics.
Authentication: API key with admin permission required
{
"daily_stats": {
"total_requests": 1250,
"trial_requests": 800,
"authenticated_requests": 450,
"blocked_requests": 25,
"high_risk_requests": 75
},
"abuse_prevention": {
"captcha_challenges": 15,
"vpn_detections": 45,
"rate_limit_hits": 30,
"device_fingerprints": 650
},
"trial_usage": {
"active_sessions": 125,
"exhausted_sessions": 200,
"conversion_rate": 0.15
},
"top_risk_indicators": [
{"type": "vpn_usage", "count": 45},
{"type": "automation_detected", "count": 20},
{"type": "suspicious_timing", "count": 15}
]
}Report manual abuse event.
Authentication: API key with admin permission required
{
"session_id": "trial-abc123",
"abuse_type": "manual_review",
"description": "Suspicious usage pattern detected",
"action_taken": "session_blocked"
}{
"message": "Abuse event recorded successfully",
"event_id": "abuse-xyz789",
"timestamp": "2024-01-15T10:30:00Z"
}Force CAPTCHA challenge for session.
Authentication: None required (public security endpoint)
{
"session_id": "trial-abc123",
"challenge_type": "recaptcha"
}{
"challenge_required": true,
"challenge_type": "recaptcha",
"site_key": "6LcXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"challenge_url": "/security/verify-challenge"
}Client-side device fingerprinting library.
Authentication: None required
Response: JavaScript library for device fingerprinting with:
- Canvas fingerprinting with spoofing detection
- WebGL context analysis
- Screen resolution and font detection
- Mouse movement tracking
- Automated behavior detection
Server health check.
Authentication: None required
{
"status": "healthy",
"timestamp": "2024-01-15T10:30:00Z",
"version": "1.0.0",
"services": {
"openai": "connected",
"gcs": "connected",
"firestore": "connected",
"redis": "connected"
},
"uptime": 86400
}OpenAPI documentation (Swagger UI).
Authentication: None required
Interactive API documentation with request/response examples.
Server-Sent Events transport for MCP clients.
Authentication: API key with mcp permission OR trial session
MCP tools available:
start_trial_session- Begin anonymous trialcheck_trial_status- Monitor trial usagestylize_image- Transform images with artistic stylesgenerate_image_from_text- Create images from descriptionslist_styles- Get available artistic stylesget_style_details- Get detailed style information
JSON-RPC endpoint for MCP protocol.
Authentication: API key with mcp permission OR trial session
Same tools as SSE transport, accessible via JSON-RPC calls.
{
"error": {
"code": "TRIAL_LIMIT_EXCEEDED",
"message": "You have reached your trial limit of 5 images",
"details": {
"images_used": 5,
"upgrade_options": [
{
"type": "free_account",
"title": "Free Account",
"description": "100 images per month",
"action_url": "/auth/register"
}
]
}
}
}| Code | Description | HTTP Status |
|---|---|---|
TRIAL_LIMIT_EXCEEDED |
Trial image limit reached | 429 |
CONTENT_VIOLATION |
Image violates content policy | 400 |
INVALID_STYLE |
Style ID not found | 400 |
AUTHENTICATION_REQUIRED |
Valid API key or session required | 401 |
INSUFFICIENT_PERMISSIONS |
API key lacks required permissions | 403 |
RATE_LIMIT_EXCEEDED |
Too many requests | 429 |
SERVICE_UNAVAILABLE |
External service error | 503 |
INVALID_REQUEST |
Malformed request data | 400 |
| Endpoint | Authentication | Limit |
|---|---|---|
/stylize_image |
Trial Session | 5 images total |
/stylize_image |
API Key | Based on subscription |
/stylize_image |
Anonymous | 5 images per IP per day |
/auth/* |
None | 10 requests per minute |
/trial/status |
None | 60 requests per minute |
| All endpoints | API Key | 1000 requests per hour |
| Permission | Grants Access To |
|---|---|
stylize |
/stylize_image endpoint and MCP image generation tools |
styles |
/styles endpoint and MCP style management tools |
mcp |
All MCP tools and resources |
admin |
All admin endpoints and operations |
- Always handle trial limits gracefully - Guide users to upgrade when limits are reached
- Cache style information -
/stylesendpoint results don't change frequently - Use multi-style generation for exploration - Omit
style_idto show variety - Implement retry logic - Handle temporary service unavailability
- Validate images before upload - Check file size and format client-side
- Start with trial sessions - Let users explore before requiring signup
- Progressive enhancement - Show more features as users engage
- Natural error handling - Convert technical errors to helpful guidance
- Context awareness - Use project context for brand-aligned results
- Performance optimization - Cache sessions and styles for better UX
- Store API keys securely - Never expose in client-side code
- Use HTTPS - All communication must be encrypted
- Implement request signing - For additional security in sensitive applications
- Monitor usage patterns - Track for unusual activity
- Rotate API keys regularly - Best practice for production systems