Back to Home
REST API

API Documentation

Async API for Image Generation

Complete guide to CyberPhotoBooth API integration

Overview

Async API allows you to submit generation tasks to a queue and retrieve results later, avoiding long waits and timeouts.

Base URL
https://api.cyberphotobooth.ru/api
Authentication

An API key is required to access the API. Get it via Telegram bot

Authorization header:

Authorization: Bearer YOUR_API_KEY
Endpoints
POST/async/submit

1. Submit Task

Submits a generation task to the queue

The style field accepts either the style name or its style_id. For example: "SteamPunk" or 1029 — use whichever is more convenient.

Request body:

{
  "mode": "style_sdxl_zero",
  "style": "SteamPunk",
  "return_s3_link": false,
  "params": {
    "Sex": "man",
    "Face": "base64_image_data",
    "Fon": "base64_image_data"
  }
}

Response:

{
  "job_id": "uuid-of-task",
  "status": "queued",
  "estimated_wait_time_seconds": 30
}
GET/async/status/{job_id}

2. Check Status

Checks task status and returns result

Possible statuses:

queuedin queue
processingprocessing
completedcompleted
failedfailed
not_foundnot found / expired

Successful result:

{
  "job_id": "uuid",
  "status": "completed",
  "processing_time_ms": 15000,
  "results": {
    "images": ["base64_image_1", "base64_image_2"],
    "videos": []
  }
}
GET/public/styles

3. Get Styles List

Retrieves list of all available public styles (no authentication required)

Response:

[
  { "name": "GTA", "style_id": 1079 },
  { "name": "Mad Max", "style_id": 1046 },
  { "name": "Киберпанк", "style_id": 1009 },
  { "name": "Стимпанк", "style_id": 1029 },
  ...
]
Code Example (Python)Python
import httpx
import asyncio

async def generate_async():
    async with httpx.AsyncClient() as client:
        # 1. Submit task
        response = await client.post(
            "https://api.cyberphotobooth.ru/api/async/submit",
            headers={"Authorization": "Bearer YOUR_API_KEY"},
            json={
                "mode": "style_sdxl_zero",
                "style": "SteamPunk",
                "return_s3_link": False,
                "params": {"Sex": "man", "Face": "...", "Fon": "..."}
            }
        )

        job_data = response.json()
        job_id = job_data["job_id"]
        print(f"Task submitted: {job_id}")

        # 2. Wait for result
        while True:
            await asyncio.sleep(2)  # Check every 2 seconds

            status_response = await client.get(
                f"https://api.cyberphotobooth.ru/api/async/status/{job_id}"
            )

            result = status_response.json()
            status = result.get("status")

            if status == "completed":
                print("Done!")
                images = result["results"]["images"]
                return images
            elif status == "failed":
                print(f"Error: {result.get('error')}")
                break
            else:
                print(f"Status: {status}")

# Run
asyncio.run(generate_async())

Image fields (for example, Face and Fon) should be sent as a base64-encoded payload without the Data URI prefix (i.e., without data:image/png;base64,).

Available Resources
Loading...

Ready to Start?

Get an API key via Telegram bot and start integration