Skip to main content
GET
/
api
/
v2
/
user
/
history
Generation History
curl --request GET \
  --url https://api.example.com/api/v2/user/history

List Generation History

Returns a paginated list of your past generations.

Query Parameters

page
integer
default:"1"
Page number.
limit
integer
default:"20"
Items per page. Max 100.
type
string
Filter by generation type: text, image, video, tts, stt, audio, tool
model
string
Filter by model slug (e.g. gpt-5, dall-e-3).
status
string
Filter by status: completed, pending, failed

Request

curl "https://neuralbox.top/api/v2/user/history?type=image&limit=10" \
  -H "Authorization: Bearer nb_YOUR_API_KEY"

Response

{
  "items": [
    {
      "id": "gen_01j9x2img789",
      "type": "image",
      "model": "flux-1.1-pro",
      "status": "completed",
      "prompt": "Portrait of a CEO in a modern office",
      "url": "https://storage.neuralbox.top/generations/gen_01j9x2img789.webp",
      "tokens_used": 8,
      "created_at": "2026-03-08T12:02:30Z"
    },
    {
      "id": "gen_01j9x2img788",
      "type": "image",
      "model": "dall-e-3",
      "status": "completed",
      "prompt": "Minimalist product shot, white background",
      "url": "https://storage.neuralbox.top/generations/gen_01j9x2img788.webp",
      "tokens_used": 7,
      "created_at": "2026-03-08T11:50:00Z"
    }
  ],
  "total": 142,
  "page": 1,
  "limit": 10,
  "pages": 15
}

Check Generation Status

Poll the status of an async generation (video, slower image models).

Path Parameters

generation_id
string
required
The generation ID returned from the initial request.

Request

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

Response: Pending

{
  "id": "gen_01j9x2vid001",
  "status": "pending",
  "model": "kling-v2.1-pro",
  "progress": 45,
  "eta_seconds": 32,
  "created_at": "2026-03-08T12:05:00Z"
}

Response: Completed

{
  "id": "gen_01j9x2vid001",
  "status": "completed",
  "model": "kling-v2.1-pro",
  "url": "https://storage.neuralbox.top/generations/gen_01j9x2vid001.mp4",
  "duration": 5,
  "width": 1920,
  "height": 1080,
  "tokens_used": 60,
  "balance_remaining": 229,
  "created_at": "2026-03-08T12:05:00Z",
  "completed_at": "2026-03-08T12:06:02Z"
}

Response: Failed

{
  "id": "gen_01j9x2vid002",
  "status": "failed",
  "model": "kling-v2.1-pro",
  "error": "Provider error: content policy violation",
  "tokens_used": 0,
  "created_at": "2026-03-08T12:10:00Z"
}
When a generation fails, no tokens are charged.
import requests
import time

def wait_for_generation(gen_id: str, api_key: str, timeout: int = 300):
    """Poll until generation completes or times out."""
    headers = {"Authorization": f"Bearer {api_key}"}
    deadline = time.time() + timeout
    
    while time.time() < deadline:
        res = requests.get(
            f"https://neuralbox.top/api/v2/generate/status/{gen_id}",
            headers=headers
        )
        data = res.json()
        
        if data["status"] == "completed":
            return data
        elif data["status"] == "failed":
            raise Exception(f"Generation failed: {data.get('error')}")
        
        # Use eta_seconds hint if available
        wait = min(data.get("eta_seconds", 10), 10)
        time.sleep(wait)
    
    raise TimeoutError(f"Generation {gen_id} timed out after {timeout}s")

Storage Retention

Generated files are stored based on your plan:
PlanRetention
Starter7 days
Basic30 days
Pro90 days
VIP90 days
EliteUnlimited