API Integration Guide: Automating AI Art Generation
For developers and power users, learn how to integrate Open Journey's API into your applications. Covers authentication, batch generation, webhooks, and building automated workflows.
Open Journey Team
Dec 20, 2025
Open Journey API Overview
The Open Journey API lets you programmatically generate AI art at scale. Build custom applications, automate workflows, and integrate AI art generation into your products.
Getting Started
Prerequisites
- Open Journey account (Creator or Studio plan for API access)
- API key from your dashboard
- Basic knowledge of REST APIs
Base URL
https://api.openjourney.ai/v1Authentication
Include your API key in the header:
Authorization: Bearer YOUR_API_KEYCore Endpoints
Generate Image
POST /generate
Generate a single image from a text prompt.
Request Body:
{
"prompt": "A golden retriever astronaut in space",
"style": "digital",
"aspect_ratio": "1:1",
"quality": "standard"
}Parameters:
| Parameter | Type | Required | Description |
| prompt | string | Yes | Text description of the image |
| style | string | No | Art style (default: "auto") |
| aspect_ratio | string | No | Image dimensions (default: "1:1") |
| quality | string | No | "standard" or "hd" |
Response:
{
"id": "img_abc123",
"status": "completed",
"url": "https://cdn.openjourney.ai/images/abc123.png",
"prompt": "A golden retriever astronaut in space",
"style": "digital",
"created_at": "2026-01-15T10:30:00Z"
}Batch Generation
POST /generate/batch
Generate multiple images in a single request.
Request Body:
{
"requests": [
{
"prompt": "Mountain landscape at sunset",
"style": "photographic"
},
{
"prompt": "Cyberpunk city street",
"style": "cinematic"
}
]
}Response:
{
"batch_id": "batch_xyz789",
"status": "processing",
"total": 2,
"completed": 0,
"results": []
}Check Batch Status
GET /generate/batch/{batch_id}
Poll for batch completion.
Response:
{
"batch_id": "batch_xyz789",
"status": "completed",
"total": 2,
"completed": 2,
"results": [
{
"id": "img_001",
"url": "https://cdn.openjourney.ai/images/001.png",
"prompt": "Mountain landscape at sunset"
},
{
"id": "img_002",
"url": "https://cdn.openjourney.ai/images/002.png",
"prompt": "Cyberpunk city street"
}
]
}Webhooks
Configure webhooks for async notifications.
Setup Webhook
POST /webhooks
{
"url": "https://your-app.com/webhook",
"events": ["generation.completed", "batch.completed"]
}Webhook Payload
When an event occurs, we'll POST to your URL:
{
"event": "generation.completed",
"timestamp": "2026-01-15T10:30:05Z",
"data": {
"id": "img_abc123",
"url": "https://cdn.openjourney.ai/images/abc123.png",
"prompt": "A golden retriever astronaut in space"
}
}Code Examples
Python
import requestsAPI_KEY = "your_api_key"
BASE_URL = "https://api.openjourney.ai/v1"
def generate_image(prompt, style="auto"):
response = requests.post(
f"{BASE_URL}/generate",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"prompt": prompt,
"style": style,
"aspect_ratio": "1:1"
}
)
return response.json()
# Generate an image
result = generate_image(
"A cozy coffee shop in Tokyo, rainy day",
style="cinematic"
)
print(f"Image URL: {result['url']}")
JavaScript/Node.js
const axios = require('axios');const API_KEY = 'your_api_key';
const BASE_URL = 'https://api.openjourney.ai/v1';
async function generateImage(prompt, style = 'auto') {
const response = await axios.post(
${BASE_URL}/generate,
{
prompt,
style,
aspect_ratio: '1:1'
},
{
headers: { Authorization: Bearer ${API_KEY} }
}
);
return response.data;
}
// Generate an image
generateImage('Futuristic robot in garden', 'digital')
.then(result => console.log(Image URL: ${result.url}));
cURL
curl -X POST https://api.openjourney.ai/v1/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Abstract geometric art, blue and gold",
"style": "minimalist",
"aspect_ratio": "16:9"
}'Rate Limits
| Plan | Requests/Minute | Concurrent |
| Creator | 20 | 5 |
| Studio | 60 | 20 |
| Enterprise | Custom | Custom |
Rate limit headers are included in responses:
X-RateLimit-Limit: 20
X-RateLimit-Remaining: 15
X-RateLimit-Reset: 1642248000Error Handling
Error Response Format
{
"error": {
"code": "invalid_prompt",
"message": "Prompt cannot be empty",
"details": {}
}
}Common Error Codes
| Code | Description | Solution |
| invalid_api_key | API key is invalid | Check your API key |
| rate_limit_exceeded | Too many requests | Implement backoff |
| invalid_prompt | Prompt validation failed | Check prompt content |
| insufficient_credits | No credits remaining | Upgrade or purchase |
| server_error | Internal error | Retry with backoff |
Best Practices
1. Implement Retry Logic
import time
import requestsdef generate_with_retry(prompt, max_retries=3):
for attempt in range(max_retries):
try:
result = generate_image(prompt)
return result
except requests.exceptions.RequestException as e:
if attempt == max_retries - 1:
raise
time.sleep(2 attempt) # Exponential backoff
2. Use Webhooks for Long Operations
Don't poll constantly. Set up webhooks for batch operations.
3. Cache Results
Store generated images rather than regenerating.
4. Validate Prompts Client-Side
Check prompt length and content before API calls.
5. Monitor Usage
Track your API usage to avoid unexpected limits.
Building Automated Workflows
Example: Daily Social Media Content
import schedule
import timedef generate_daily_content():
prompts = [
"Motivational sunrise over mountains",
"Peaceful workspace with plants",
"Abstract success concept art"
]
for prompt in prompts:
result = generate_image(prompt, style="photographic")
save_to_content_library(result)
print(f"Generated: {result['url']}")
schedule.every().day.at("06:00").do(generate_daily_content)
while True:
schedule.run_pending()
time.sleep(60)
Example: E-commerce Product Variants
def generate_product_variants(product_name, backgrounds):
results = []
for bg in backgrounds:
prompt = f"{product_name} on {bg}, professional product photography"
result = generate_image(prompt)
results.append(result)
return results# Generate product in different settings
variants = generate_product_variants(
"Modern smartwatch",
["white marble surface", "dark wood desk", "concrete texture"]
)
SDK Libraries
Official SDKs available:
- Python:
pip install openjourney - JavaScript:
npm install @openjourney/sdk - Ruby:
gem install openjourney - Go:
go get github.com/openjourney/go-sdk
Support
- Documentation: docs.openjourney.ai
- API Status: status.openjourney.ai
- Developer Discord: discord.gg/openjourney-dev
- Email: api-support@openjourney.ai
Build amazing things with AI art. We can't wait to see what you create.
Open Journey Team
The Open Journey team is dedicated to making AI art accessible to everyone. We share tutorials, tips, and insights to help you create stunning AI-generated artwork.
Share this article