Skip to main content
Base path: /v1/ai/generate These endpoints support the content side of your AI visibility workflow — creating and improving pages that help AI models mention and cite your brand. For visibility reporting, see AI visibility endpoints.

POST /text

Generate content from a prompt. Use this to create pages targeting prompts from your visibility report. Body:
FieldTypeRequiredDescription
textstringYesPrompt / user message
modelstringYesModel ID (OpenAI, Anthropic, or Gemini family)
systemPromptstringNoCustom system instructions
brandVoiceIdstringNoApply a saved brand voice
brandVoicebooleanNoEnable brand voice context
filestringNoAttachment reference for context
useWorkerbooleanNoQueue async job instead of synchronous response
jobTypestringNoWorker job name when useWorker is true (default: ai_tool_content)
optionsobjectNoExtra options passed to the worker
Sync response (200):
{
  "message": "Generated AI successfully.",
  "data": "Generated text content..."
}
Async response (202) when useWorker: true:
{
  "message": "Content generation queued",
  "jobId": "12345"
}
Example:
curl -X POST https://api.krastie.ai/v1/ai/generate/text \
  -H "Content-Type: application/json" \
  -H "api-key: krastie_YOUR_KEY" \
  -d '{
    "text": "Write an FAQ page answering: What are the best tools for AI search visibility?",
    "model": "gpt-4o",
    "brandVoiceId": "BRAND_VOICE_ID"
  }'

POST /chat

Conversational AI with workspace visibility context. Enable useWorkspaceContext to include your latest visibility scores, traffic data, and documents. Body:
FieldTypeRequiredDescription
textstringYesUser message
modelstringYesModel ID
sessionIdstringNoExisting chat session (created if omitted)
systemPromptstringNoCustom system prompt
useWorkspaceContextbooleanNoInclude visibility and workspace data (default: true)
brandVoiceIdstringNoBrand voice context
webpageContextstringNoRaw page text for context
webSearchbooleanNoEnable web search (OpenAI models only)
Response (200):
{
  "message": "Generated AI successfully.",
  "sessionId": "abc123",
  "data": {
    "content": "Assistant reply...",
    "title": "User message"
  },
  "contextSources": []
}

POST /calculate-seo-score

Score content for SEO before publishing visibility-optimized pages. Body:
FieldTypeRequiredDescription
contentstringYesBody text to analyze
titlestringNoPage title
keywordsstring[]NoTarget keywords from your visibility report
autoExtractKeywordsbooleanNoExtract keywords when none provided (default: true)

POST /improve-content-simple

Single-pass AI content improvement with before/after SEO scores. Use on existing pages that underperform in visibility reports. Body:
FieldTypeRequiredDescription
contentstringYesContent to improve
improvePromptstringYesImprovement instructions
metricTypestringNoMetric label (default: general)

POST /improve-content-with-validation

Iterative content improvement with validation. Requires a paid plan.

POST /process-blog-post-with-images

Process a blog post and generate associated images.

POST /image

Generate an image. Body:
FieldTypeRequiredDescription
textstringYesImage prompt
modelstringYesdall-e-3 or stability-ultra
sizestringYesDALL·E size (e.g. 1024x1024) or Stability aspect ratio
Response (200): Provider-specific image payload in data.

Brand voice (generate routes)

Create brand voices that keep visibility-optimized content on-brand.
MethodEndpointDescription
POST/brand-voice/websiteGenerate brand voice from a website URL
POST/brand-voice/textGenerate brand voice from sample text
POST/brand-voice/fileGenerate brand voice from an uploaded file
Manage saved voices via Brand voice library.

POST /feedback

Submit feedback on AI output quality.

GET /job/:jobId

Poll async job status (content, SEO, or AI queues). Response (200):
{
  "jobId": "12345",
  "name": "ai_tool_content",
  "state": "completed",
  "progress": 100,
  "result": {},
  "failedReason": null,
  "attemptsMade": 1,
  "processedOn": 1717776000000,
  "finishedOn": 1717776005000,
  "queue": "aiQueue"
}
Job states follow BullMQ conventions: waiting, active, completed, failed, etc.