Skip to main content
GET
/
spec-status
/
{specId}
Get Spec Status
curl --request GET \
  --url https://api.pre.dev/spec-status/{specId} \
  --header 'Authorization: Bearer <token>'
{
  "_id": "<string>",
  "created": "2023-11-07T05:31:56Z",
  "endpoint": "fast_spec",
  "input": "<string>",
  "status": "pending",
  "success": true,
  "uploadedFileShortUrl": "<string>",
  "uploadedFileName": "<string>",
  "output": "<any>",
  "outputFormat": "url",
  "outputFileUrl": "<string>",
  "executionTime": 123,
  "predevUrl": "<string>",
  "lovableUrl": "<string>",
  "cursorUrl": "<string>",
  "v0Url": "<string>",
  "boltUrl": "<string>",
  "errorMessage": "<string>",
  "progress": "<string>"
}

GET /api/spec-status/:specId

Check the status of an asynchronous specification processing request.

Overview

When you make an async request ("async": true), use this endpoint to poll for completion status.

Endpoint

GET https://api.pre.dev/spec-status/:specId

Parameters

ParameterLocationRequiredDescription
specIdPathSpec ID returned from async spec processing

Example Request

curl https://api.pre.dev/spec-status/507f1f77bcf86cd799439011 \
  -H "Authorization: Bearer YOUR_API_KEY"
The specId in the URL is the value returned as specId from the async spec generation request.

Response

Pending

{
  "_id": "507f1f77bcf86cd799439011",
  "created": "2025-10-03T10:00:00Z",
  "endpoint": "fast_spec",
  "input": "Build a SaaS project management tool...",
  "status": "pending",
  "success": false,
  "outputFormat": "url",
  "progress": "Initializing..."
}

Processing

{
  "_id": "507f1f77bcf86cd799439011",
  "created": "2025-10-03T10:00:00Z",
  "endpoint": "fast_spec",
  "input": "Build a SaaS project management tool...",
  "status": "processing",
  "success": false,
  "outputFormat": "url",
  "progress": "Generating specification..."
}

Completed

{
  "_id": "507f1f77bcf86cd799439011",
  "created": "2025-10-03T10:00:00Z",
  "endpoint": "fast_spec",
  "input": "Build a SaaS project management tool...",
  "status": "completed",
  "success": true,
  "output": "https://api.pre.dev/s/a6hFJRV6",
  "outputFormat": "url",
  "outputFileUrl": "https://api.pre.dev/s/a6hFJRV6",
  "executionTime": 38500,
  "predevUrl": "https://pre.dev/projects/abc123",
  "lovableUrl": "https://lovable.dev/?autosubmit=true#prompt=First%20download%20https%3A%2F%2Fapi.pre.dev%2Fs%2Fa6hFJRV6%2C%20then%20save%20it%20to%20a%20file%20called%20%22spec.md%22%20and%20then%20parse%20it%20and%20implement%20it%20step%20by%20step",
  "cursorUrl": "cursor://anysphere.cursor-deeplink/prompt?text=First+download+https%3A%2F%2Fapi.pre.dev%2Fs%2Fa6hFJRV6%2C+then+save+it+to+a+file+called+%22spec.md%22+and+then+parse+it+and+implement+it+step+by+step",
  "v0Url": "https://v0.dev/chat?q=First%20download%20https%3A%2F%2Fapi.pre.dev%2Fs%2Fa6hFJRV6%2C%20then%20save%20it%20to%20a%20file%20called%20%22spec.md%22%20and%20then%20parse%20it%20and%20implement%20it%20step%20by%20step",
  "boltUrl": "https://bolt.new?prompt=First%20download%20https%3A%2F%2Fapi.pre.dev%2Fs%2Fa6hFJRV6%2C%20then%20save%20it%20to%20a%20file%20called%20%22spec.md%22%20and%20then%20parse%20it%20and%20implement%20it%20step%20by%20step",
  "progress": "Completed successfully"
}

Failed

{
  "_id": "507f1f77bcf86cd799439011",
  "created": "2025-10-03T10:00:00Z",
  "endpoint": "fast_spec",
  "input": "Build a SaaS project management tool...",
  "status": "failed",
  "success": false,
  "outputFormat": "url",
  "errorMessage": "Invalid input format",
  "executionTime": 5000,
  "progress": "Failed to generate specification"
}

Response Fields

FieldTypeDescription
_idstringMongoDB ObjectId of the spec request
createdstringISO timestamp when the request was created
endpointstringWhich endpoint was used: "fast_spec" or "deep_spec"
inputstringOriginal input text provided
statusstringCurrent status: "pending", "processing", "completed", or "failed"
successbooleanWhether the request succeeded
uploadedFileShortUrlstringShort URL for uploaded file (if file was uploaded)
uploadedFileNamestringName of uploaded file (if file was uploaded)
outputanyGenerated spec URL or markdown content (only when completed)
outputFormatstringFormat used: "url" or "markdown"
outputFileUrlstringURL where the spec file is hosted - downloadable markdown (only when completed)
executionTimenumberProcessing time in milliseconds (only when completed or failed)
predevUrlstringpre.dev project URL where you can view and edit the spec (only when completed)
lovableUrlstringDeep link to Lovable.dev with auto-submit prompt to implement the spec (only when completed)
cursorUrlstringDeep link to Cursor with prompt to download and implement the spec (only when completed)
v0UrlstringDeep link to Vercel v0 with prompt to implement the spec (only when completed)
boltUrlstringDeep link to Bolt.new with prompt to implement the spec (only when completed)
errorMessagestringError description (only when failed)
progressstringHuman-readable progress description

Polling Best Practices

Polling Interval

  • Recommended: Poll every 10-15 seconds
  • Minimum: Don’t poll more frequently than every 5 seconds
  • Maximum: No need to poll more than every 30 seconds

Example Polling Script

#!/bin/bash

SPEC_ID="507f1f77bcf86cd799439011"
API_KEY="YOUR_API_KEY"

while true; do
  RESPONSE=$(curl -s https://api.pre.dev/spec-status/$SPEC_ID \
    -H "Authorization: Bearer $API_KEY")

  STATUS=$(echo $RESPONSE | jq -r '.status')

  case $STATUS in
    "completed")
      echo "✅ Spec processing completed!"
      echo $RESPONSE | jq -r '.output'
      break
      ;;
    "failed")
      echo "❌ Spec processing failed:"
      echo $RESPONSE | jq -r '.errorMessage'
      break
      ;;
    "pending"|"processing")
      echo "$(date): $STATUS - $(echo $RESPONSE | jq -r '.progress')"
      sleep 10
      ;;
    *)
      echo "Unknown status: $STATUS"
      break
      ;;
  esac
done

Python Polling Example

import requests
import time
from typing import Dict, Any

def poll_spec_status(api_key: str, spec_id: str, poll_interval: int = 10) -> Dict[str, Any]:
    """Poll for spec processing completion."""
    while True:
        response = requests.get(
            f'https://api.pre.dev/spec-status/{spec_id}',
            headers={'Authorization': f'Bearer {api_key}'}
        )
        response.raise_for_status()

        data = response.json()
        status = data['status']

        if status == 'completed':
            print("✅ Spec processing completed!")
            return data
        elif status == 'failed':
            print(f"❌ Spec processing failed: {data.get('errorMessage')}")
            raise Exception(f"Processing failed: {data.get('errorMessage')}")
        else:
            print(f"⏳ {status}: {data.get('progress', 'Processing...')}")

        time.sleep(poll_interval)

# Usage
result = poll_spec_status("YOUR_API_KEY", "507f1f77bcf86cd799439011")
print(f"Spec URL: {result['output']}")

JavaScript Polling Example

async function pollSpecStatus(apiKey, specId, pollInterval = 10000) {
  while (true) {
    const response = await fetch(
      `https://api.pre.dev/spec-status/${specId}`,
      {
        headers: { 'Authorization': `Bearer ${apiKey}` }
      }
    );

    if (!response.ok) {
      throw new Error('Failed to check status');
    }

    const data = await response.json();
    const status = data.status;

    if (status === 'completed') {
      console.log('✅ Spec processing completed!');
      return data;
    } else if (status === 'failed') {
      console.error(`❌ Spec processing failed: ${data.errorMessage}`);
      throw new Error(`Processing failed: ${data.errorMessage}`);
    } else {
      console.log(`⏳ ${status}: ${data.progress || 'Processing...'}`);
      await new Promise(resolve => setTimeout(resolve, pollInterval));
    }
  }
}

// Usage
try {
  const result = await pollSpecStatus('YOUR_API_KEY', '507f1f77bcf86cd799439011');
  console.log(`Spec URL: ${result.output}`);
} catch (error) {
  console.error('Error:', error.message);
}

Expected Processing Times

Spec TypeTypical TimeMaximum Expected
Fast Spec30-40 seconds2 minutes
Deep Spec2-3 minutes5 minutes
Note: Times can vary based on input complexity and system load.

Error Handling

Common Issues

Spec ID Not Found:
{
  "error": "Request not found",
  "message": "No request found with ID: 507f1f77bcf86cd799439011"
}
Cause: Invalid spec ID or request expired Unauthorized:
{
  "error": "Unauthorized",
  "message": "Invalid API key"
}
Cause: Invalid or missing API key

Best Practices

User Experience

  • Show a loading indicator while polling
  • Display progress messages to users
  • Set a reasonable timeout (e.g., 30 minutes)
  • Provide a way to cancel or retry

Rate Limiting

  • Respect the polling interval recommendations
  • Implement exponential backoff for retries
  • Handle rate limit responses gracefully

Monitoring

  • Log polling attempts for debugging
  • Track completion times for performance monitoring
  • Alert on unusual failure rates

Back to API Reference

View all available API endpoints.

Authorizations

Authorization
string
header
default:YOUR_API_KEY
required

API key for authentication. Get your API key from https://pre.dev/projects/playground (Solo) or https://pre.dev/enterprise/dashboard?page=api (Enterprise). Use format: Bearer YOUR_API_KEY

Path Parameters

specId
string
required

The unique ID returned from an async spec generation request

Example:

"507f1f77bcf86cd799439011"

Response

Status retrieved successfully

_id
string

MongoDB ObjectId of the spec request

created
string<date-time>

ISO timestamp when the request was created

endpoint
enum<string>

Which endpoint was used

Available options:
fast_spec,
deep_spec
input
string

Original input text provided

status
enum<string>

Current status

Available options:
pending,
processing,
completed,
failed
success
boolean

Whether the request succeeded

uploadedFileShortUrl
string

Short URL for uploaded file (if file was uploaded)

uploadedFileName
string

Name of uploaded file (if file was uploaded)

output
any

Generated spec URL or markdown content (only when completed)

outputFormat
enum<string>

Format used

Available options:
url,
markdown
outputFileUrl
string<uri>

URL where the spec file is hosted (only when completed)

executionTime
integer

Processing time in milliseconds (only when completed or failed)

predevUrl
string<uri>

pre.dev project URL (only when completed)

lovableUrl
string<uri>

Deep link to Lovable.dev (only when completed)

cursorUrl
string

Deep link to Cursor (only when completed)

v0Url
string<uri>

Deep link to Vercel v0 (only when completed)

boltUrl
string<uri>

Deep link to Bolt.new (only when completed)

errorMessage
string

Error description (only when failed)

progress
string

Human-readable progress description

I