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

ParameterTypeRequiredDescription
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
}

Check Credits

GET /api/credits

Returns the remaining and used credits for the authenticated API key.

Success Response

{
  "success": true,
  "credits": 49,
  "used": 1
}

Error Codes

HTTP CodeReasonDescription
401API key missingNo Authorization header sent
401Invalid API keyAPI key not found in our system
403Insufficient creditsYour credits are 0 — request more
422combo_id and photo_url are requiredMissing parameters
422combo_id must be numericInvalid combo_id format
422photo_url must be a valid URLInvalid URL format
422Invalid combo ID or Photolab could not process itCombo doesn't exist or Photolab rejected it
429Too many requestsRate 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'];
}
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"
  }'
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);
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'])

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'];
curl https://apiphotolab.me/api/credits \
  -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);
import requests
r = requests.get(
  'https://apiphotolab.me/api/credits',
  headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
print(r.json()['credits'])