Skip to main content

Why Status Polling Exists

Generation does not complete in the initial create request. You poll the status endpoint using the request_id returned from the original generation call. This keeps the API predictable for long-running content jobs.

Request

GET https://api.writerzroom.com/v1/generate/status/{request_id}
Authorization: Bearer YOUR_API_KEY

Response — In Progress

{
  "request_id": "req_xyz789",
  "status": "processing",
  "stage": "writer",
  "progress": 60
}

Response — Completed

{
  "request_id": "req_xyz789",
  "status": "completed",
  "content": {
    "id": "cnt_abc123",
    "title": "The Future of AI in Content Marketing",
    "body": "...",
    "word_count": 1842,
    "created_at": "2026-03-10T20:03:42Z"
  }
}

Response — Failed

{
  "request_id": "req_xyz789",
  "status": "failed",
  "error": "Missing required input field: audience"
}

How to Poll

async function pollStatus(requestId, apiKey) {
  const maxAttempts = 30;
  const intervalMs = 8000;

  for (let i = 0; i < maxAttempts; i++) {
    const res = await fetch(
      `https://api.writerzroom.com/v1/generate/status/${requestId}`,
      { headers: { Authorization: `Bearer ${apiKey}` } }
    );
    const data = await res.json();

    if (data.status === 'completed') return data.content;
    if (data.status === 'failed') throw new Error(data.error);

    await new Promise(r => setTimeout(r, intervalMs));
  }
  throw new Error('Generation timed out');
}
Poll every 5–10 seconds with a maximum of 20–30 attempts covering ~3 minutes. If status is still processing after that, log the request_id and contact support.
Last modified on March 11, 2026