API Documentation
Complete reference for the apiphotolab.me REST API.
Base URL
https://apiphotolab.me/api
All endpoints are relative to this base URL. All responses are JSON.
Authentication
All API requests require your API key passed as a Bearer token in the Authorization header.
Authorization: Bearer YOUR_API_KEY
Get your API key by registering a free account. New accounts receive 50 free credits.
Generate Image / Video
POST
/api/generate
Apply a Photolab combo effect to a photo and get back an image or video URL. Costs 1 credit per successful request.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
combo_id |
integer | Required | The Photolab combo ID (number from photolab.me/d/ID) |
photo_url |
string | Required | Publicly accessible URL of the photo to process |
Success Response
{
"success": true,
"media_url": "https://worker-images.ws.pho.to/xxx.jpg",
"type": "image", // "image" or "video"
"credits_remaining": 49
}
"success": true,
"media_url": "https://worker-images.ws.pho.to/xxx.jpg",
"type": "image", // "image" or "video"
"credits_remaining": 49
}
Check Credits
GET
/api/credits
Returns the remaining and used credits for the authenticated API key.
Success Response
{
"success": true,
"credits": 49,
"used": 1
}
"success": true,
"credits": 49,
"used": 1
}
Error Codes
| HTTP Code | Reason | Description |
|---|---|---|
| 401 | API key missing | No Authorization header sent |
| 401 | Invalid API key | API key not found in our system |
| 403 | Insufficient credits | Your credits are 0 — request more |
| 422 | combo_id and photo_url are required | Missing parameters |
| 422 | combo_id must be numeric | Invalid combo_id format |
| 422 | photo_url must be a valid URL | Invalid URL format |
| 422 | Invalid combo ID or Photolab could not process it | Combo doesn't exist or Photolab rejected it |
| 429 | Too many requests | Rate limit: 30 requests per minute |
Code Examples
Ready-to-use examples for generating an image using the API.
Generate Image
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://apiphotolab.me/api/generate',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'combo_id' => '51952891',
'photo_url' => 'https://yoursite.com/photo.jpg',
]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($response['success']) {
echo $response['media_url'];
}
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://apiphotolab.me/api/generate',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'combo_id' => '51952891',
'photo_url' => 'https://yoursite.com/photo.jpg',
]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($response['success']) {
echo $response['media_url'];
}
curl -X POST https://apiphotolab.me/api/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"combo_id": "51952891",
"photo_url": "https://yoursite.com/photo.jpg"
}'
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"combo_id": "51952891",
"photo_url": "https://yoursite.com/photo.jpg"
}'
const response = await fetch('https://apiphotolab.me/api/generate', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
combo_id: '51952891',
photo_url: 'https://yoursite.com/photo.jpg',
}),
});
const data = await response.json();
if (data.success) console.log(data.media_url);
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
combo_id: '51952891',
photo_url: 'https://yoursite.com/photo.jpg',
}),
});
const data = await response.json();
if (data.success) console.log(data.media_url);
import requests
response = requests.post(
'https://apiphotolab.me/api/generate',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'combo_id': '51952891',
'photo_url': 'https://yoursite.com/photo.jpg',
}
)
data = response.json()
if data['success']:
print(data['media_url'])
response = requests.post(
'https://apiphotolab.me/api/generate',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'combo_id': '51952891',
'photo_url': 'https://yoursite.com/photo.jpg',
}
)
data = response.json()
if data['success']:
print(data['media_url'])
Check Credits
<?php
$ch = curl_init('https://apiphotolab.me/api/credits');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
]);
$data = json_decode(curl_exec($ch), true);
echo 'Credits: ' . $data['credits'];
$ch = curl_init('https://apiphotolab.me/api/credits');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
]);
$data = json_decode(curl_exec($ch), true);
echo 'Credits: ' . $data['credits'];
curl https://apiphotolab.me/api/credits \
-H "Authorization: Bearer YOUR_API_KEY"
-H "Authorization: Bearer YOUR_API_KEY"
const res = await fetch('https://apiphotolab.me/api/credits', {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
const data = await res.json();
console.log('Credits:', data.credits);
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
const data = await res.json();
console.log('Credits:', data.credits);
import requests
r = requests.get(
'https://apiphotolab.me/api/credits',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
print(r.json()['credits'])
r = requests.get(
'https://apiphotolab.me/api/credits',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
print(r.json()['credits'])