Skip to main content
GET
/
api
/
v2
/
generate
/
{generation_id}
Get Generation Status
curl --request GET \
  --url https://api.example.com/api/v2/generate/{generation_id}
Poll the status of a pending generation. Use for video, slow image models, and any generation where the initial response had status: "pending".
generation_id
integer
required
The integer ID returned from POST /api/v2/generate.

Request

curl https://neuralbox.top/api/v2/generate/18502 \
  -H "Authorization: Bearer nb_YOUR_API_KEY"

Responses

Pending:
{
  "id": 18502,
  "status": "pending",
  "model_slug": "kling-v2.1-pro",
  "result_url": null,
  "tokens_spent": 0
}
Completed:
{
  "id": 18502,
  "status": "completed",
  "model_slug": "kling-v2.1-pro",
  "result_url": "https://storage.neuralbox.top/generations/18502.mp4",
  "thumbnail_url": "https://storage.neuralbox.top/thumbnails/18502.jpg",
  "tokens_spent": 60,
  "processing_ms": 87420,
  "result_metadata": { "duration": 5, "width": 1920, "height": 1080 }
}
Failed (no tokens charged):
{
  "id": 18503,
  "status": "failed",
  "error": "Provider error: content policy violation",
  "tokens_spent": 0
}
import requests, time

def poll(gen_id: int, api_key: str, timeout=300) -> dict:
    headers = {"Authorization": f"Bearer {api_key}"}
    deadline = time.time() + timeout
    while time.time() < deadline:
        data = requests.get(
            f"https://neuralbox.top/api/v2/generate/{gen_id}",
            headers=headers
        ).json()
        if data["status"] in ("completed", "failed"):
            return data
        time.sleep(5)
    raise TimeoutError(f"Timed out after {timeout}s")