The API supports two authentication methods:
Authorization: Bearer <your-jwt-token>
X-API-Key: <your-api-key>
Generate a new image using DALL-E 3.
POST /api/images/generate
{
"prompt": "A futuristic city at sunset",
"size": "1024x1024",
"style": "standard"
}| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Text description of the image (max 1000 chars) |
| size | string | No | Image size: 1024x1024, 1792x1024, or 1024x1792 (default: 1024x1024) |
| style | string | No | Style: "standard" or "vivid" (default: "standard") |
{
"success": true,
"image": {
"id": "abc123...",
"url": "https://...",
"prompt": "A futuristic city at sunset",
"size": "1024x1024",
"style": "standard",
"createdAt": "2024-01-15T10:30:00Z"
},
"credits_remaining": 9
}curl -X POST https://api.imagify.ca/api/images/generate \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A futuristic city at sunset",
"size": "1024x1024",
"style": "standard"
}'const response = await fetch('https://api.imagify.ca/api/images/generate', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'A futuristic city at sunset',
size: '1024x1024',
style: 'standard'
})
});
const data = await response.json();
console.log(data.image.url);Retrieve your generated images with pagination.
GET /api/images/history?page=1&limit=20
| Parameter | Type | Default | Description |
|---|---|---|---|
| page | number | 1 | Page number |
| limit | number | 20 | Items per page |
{
"error": "Authentication required"
}{
"error": "Insufficient credits",
"credits": 0,
"message": "Please purchase more credits to continue"
}{
"error": "Prompt is required"
}API requests are limited to 100 requests per 15 minutes per IP address. Additional rate limits may apply based on your subscription tier.