Introducing our new Monitoring feature Learn more

Documentation

Async jobs

Poll queued AI generation jobs with GET /v1/ai/generate/job/:jobId.

Async jobs

Some generate endpoints can enqueue work and return immediately. Poll the job until it finishes.

Get job status

GET /v1/ai/generate/job/:jobId

curl https://api.krastie.ai/v1/ai/generate/job/123 \
  -H "api-key: YOUR_KEY"

Success (200)

{
  "jobId": "123",
  "name": "ai_tool_content",
  "state": "completed",
  "progress": 100,
  "result": {},
  "failedReason": null,
  "attemptsMade": 1,
  "processedOn": 1710000000000,
  "finishedOn": 1710000005000,
  "data": {},
  "queue": "aiQueue"
}
FieldDescription
stateQueue state such as waiting, active, completed, failed
progressProgress value when available
resultJob return value when completed
failedReasonFailure message when the job failed
queueWhich internal queue held the job (aiQueue, seoQueue, or contentQueue)

Not found (404)

{ "message": "Job not found", "jobId": "123" }

Queuing text generation

curl https://api.krastie.ai/v1/ai/generate/text \
  -H "api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "text": "Draft a landing page outline.",
    "useWorker": true
  }'

Response (202):

{
  "message": "Content generation queued",
  "jobId": "123"
}

Poll until state is completed or failed. Respect rate limits if you poll frequently.