๐Ÿ”Œ Developer API โ€” v1

Build with the
PromptLens API

REST API for image-to-prompt analysis. Upload any image, get back optimized prompts for Midjourney, DALL-E, Flux, Stable Diffusion, and more. Integrate directly into your product, pipeline, or automation.

โœ“ REST + JSON โœ“ Bearer Auth โœ“ 9 AI Models

Base URL

Base URL
https://promptlens.polsia.app/api/v1

All API endpoints are prefixed with /api/v1. All requests and responses use JSON unless you're uploading files (multipart/form-data).

Authentication

The PromptLens API uses Bearer token authentication. Include your API key in the Authorization header of every request.

HTTP Header
Authorization: Bearer pl_your_api_key_here

Getting your API key

API keys are available on the Business tier ($99/mo). Once subscribed:

  1. Log in to your PromptLens account
  2. Go to Settings โ†’ API Keys
  3. Click "Generate New Key"
  4. Copy your key โ€” it will only be shown once
โš  Keep your API key secret. Never expose it in client-side code, public repositories, or browser environments. If compromised, revoke it immediately from your API Keys page.

Key format

All API keys follow the format pl_ followed by a 32-character random string (e.g., pl_4f8a9c2b7e1d3...). Keys are hashed server-side โ€” only your prefix is stored in plaintext.

Quick Start

Analyze your first image in under 60 seconds. You only need your API key and an image file.

curl https://promptlens.polsia.app/api/v1/analyze \
  -H "Authorization: Bearer pl_your_api_key" \
  -F "image=@/path/to/photo.jpg" \
  -F "model=midjourney"
import requests

url = "https://promptlens.polsia.app/api/v1/analyze"
headers = {"Authorization": "Bearer pl_your_api_key"}

with open("photo.jpg", "rb") as f:
    response = requests.post(
        url,
        headers=headers,
        files={"image": f},
        data={"model": "midjourney"}
    )

result = response.json()
print(result["prompts"]["basic"])
const FormData = require('form-data');
const fs = require('fs');
const fetch = require('node-fetch');

const form = new FormData();
form.append('image', fs.createReadStream('photo.jpg'));
form.append('model', 'midjourney');

const res = await fetch('https://promptlens.polsia.app/api/v1/analyze', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer pl_your_api_key',
    ...form.getHeaders()
  },
  body: form
});

const data = await res.json();
console.log(data.prompts.basic);
$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://promptlens.polsia.app/api/v1/analyze',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer pl_your_api_key'
    ],
    CURLOPT_POSTFIELDS => [
        'image' => new CURLFile('/path/to/photo.jpg'),
        'model' => 'midjourney'
    ]
]);

$response = curl_exec($curl);
$data = json_decode($response, true);
echo $data['prompts']['basic'];
Example Response
JSON Response ยท 200 OK
{
  "success": true,
  "share_id": "abc123",
  "model": "midjourney",
  "prompts": {
    "basic": "a flat lay of a minimalist white ceramic mug on a marble surface, soft natural light, clean composition, product photography",
    "premium": "studio product photography, minimalist white ceramic mug, marble surface, soft diffused window light, shallow depth of field, high resolution, commercial quality --ar 4:3 --style raw --q 2",
    "detailed": "professional product photography, pristine white ceramic mug, white marble surface with subtle grey veining, studio lighting setup with soft box from camera left creating gentle shadow, no harsh reflections, f/8 aperture, macro lens, ultra sharp focus on mug handle --ar 4:3 --style raw --q 2 --v 6"
  },
  "analysis": {
    "primary_subject": "ceramic mug",
    "style": "product photography",
    "lighting": "soft natural window light",
    "mood": "clean, minimalist",
    "colors": ["white", "grey", "cream"]
  },
  "performance_score": 88,
  "image_width": 1200,
  "image_height": 900
}

API Reference

POST /analyze

Analyzes an image and returns AI-optimized prompts for the specified target model. This is the primary endpoint for the PromptLens API.

POST /api/v1/analyze Image analysis & prompt generation
Content-Type: multipart/form-data โ€” Upload image as a file field, not base64.

Request Parameters

Parameter Type Required Description
image file Required Image file to analyze. Supported formats: JPEG, PNG, WebP, GIF. Max size: 10MB.
model string Optional Target AI model for prompt optimization. Defaults to all models. Options: midjourney, dalle, stable-diffusion, flux, grok, gemini, ideogram, recraft, playground-v2

Response Fields

Field Type Description
share_id string Unique ID for this analysis. Use to link to the PromptLens share page.
prompts.basic string Short, clean prompt optimized for fast generation.
prompts.premium string Enhanced prompt with model-specific parameters and quality flags.
prompts.detailed string Full technical prompt with detailed scene description, lighting, and parameters.
analysis object Structured breakdown: subject, style, lighting, mood, colors.
performance_score number 0-100 quality score based on prompt clarity, specificity, and predicted output quality.

GET /models

Returns all supported AI models with their identifiers, descriptions, and parameter syntax.

GET /api/v1/models List supported AI models
No auth required. This endpoint is publicly accessible. Useful for building model selectors in your UI.
cURL
curl https://promptlens.polsia.app/api/v1/models
Response
JSON ยท 200 OK
{
  "models": [
    { "id": "midjourney",       "name": "Midjourney",         "params": "--ar --style --q --v" },
    { "id": "dalle",            "name": "DALL-E 3",           "params": "natural language" },
    { "id": "stable-diffusion", "name": "Stable Diffusion",  "params": "--cfg --steps --sampler" },
    { "id": "flux",             "name": "Flux",               "params": "aspect_ratio guidance" },
    { "id": "grok",             "name": "Grok Aurora",        "params": "natural language" },
    { "id": "ideogram",         "name": "Ideogram",           "params": "--style --magic" },
    { "id": "recraft",          "name": "Recraft V3",         "params": "style controls" }
  ]
}

GET /usage

Returns your current API usage statistics for the billing period, including remaining quota and per-day breakdown.

GET /api/v1/usage Usage statistics for your API key
cURL
curl https://promptlens.polsia.app/api/v1/usage \
  -H "Authorization: Bearer pl_your_api_key"
Response
JSON ยท 200 OK
{
  "tier": "business",
  "period": {
    "start": "2026-03-01",
    "end": "2026-03-31"
  },
  "usage": {
    "requests_this_period": 1247,
    "limit": 10000,
    "remaining": 8753,
    "percent_used": 12.47
  }
}

Rate Limits

PromptLens enforces rate limits at both the request level and the monthly quota level.

Tier Monthly Quota Per-Minute Limit Max File Size
Free 5 requests 2 req/min 5 MB
Pro Unlimited (app usage) 10 req/min 10 MB
Business (API) 10,000 req/mo 60 req/min 10 MB
Enterprise Custom Custom 20 MB

Rate limit headers are included in every response:

Response Headers
X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 8753
X-RateLimit-Reset: 1743465600
Monthly quotas reset on the first of each calendar month. Need more? Contact sales@promptlens.polsia.app for Enterprise pricing with custom limits.

Error Codes

The API uses standard HTTP status codes. All error responses include a JSON body with an error string and human-readable message.

Error Response Structure
{
  "error": "invalid_model",
  "message": "Model must be one of: midjourney, dalle, stable-diffusion, flux, ..."
}
Code Error Meaning
400 no_image No image file was included in the request body.
400 invalid_model The model parameter is not a valid model ID.
401 unauthorized Missing or invalid API key in Authorization header.
402 quota_exceeded Monthly API quota exhausted. Resets on the 1st.
409 duplicate_image This image was already analyzed. Response includes the existing share_id.
413 file_too_large Image exceeds the maximum allowed size (10 MB on Business).
429 rate_limited Too many requests in a short window. Back off and retry.
500 analysis_failed Internal error during image analysis. Retry with exponential backoff.

SDKs & Tools

OpenAPI Spec

Our full OpenAPI 3.0 specification is available at /openapi.json. Import it into Postman, Insomnia, or any OpenAPI-compatible tool to get auto-generated API clients.

Import into Postman
# Download the spec
curl https://promptlens.polsia.app/openapi.json -o promptlens-api.json

# Or import the URL directly in Postman:
https://promptlens.polsia.app/openapi.json

Postman Collection

Prefer a pre-built collection? Download our Postman-compatible spec and import it under Import โ†’ OpenAPI. All endpoints, example values, and auth headers are pre-configured.

Zapier Integration

Connect PromptLens to 5,000+ apps without writing code. Trigger prompt generation from new Shopify products, Google Sheets rows, Airtable records, and more. Business tier required for API-based Zaps.

Need a specific SDK? Official SDKs for Python and Node.js are coming soon. Drop your email at dev@promptlens.polsia.app to get notified.

API Pricing

API access is included in the Business tier. There are no per-call charges โ€” your subscription covers 10,000 requests per month.

Pro
$19/mo
Unlimited app usage, no API access
  • โœ“ Unlimited generations via web app
  • โœ“ All 4 primary AI models
  • โœ“ Premium + detailed prompts
  • โœ“ Save & collections
  • โœ— No API access
See Pro Features
Need more than 10k requests/month? We offer custom Enterprise plans with unlimited API calls, dedicated infrastructure, and SLA guarantees. Contact sales for custom pricing.

Ready to build?

Get your API key in under 2 minutes. Business tier includes 10k requests, all 9 models, and full commercial use rights.