Generate
Base path: /v1/ai/generate
All endpoints require the api-key header. See Authentication.
Generate text
POST /v1/ai/generate/text
curl https://api.krastie.ai/v1/ai/generate/text \
-H "api-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o","text":"Write a short product intro."}'
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model to use |
text | string | Yes | Prompt |
useWorker | boolean | No | Queue the job instead of running inline |
options | object | No | Options for the worker payload |
jobType | string | No | Job name when queuing (default ai_tool_content) |
When useWorker is true, the API returns 202:
{ "message": "Content generation queued", "jobId": "123" }
Poll with Async jobs.
Generate chat message
POST /v1/ai/generate/chat
| Field | Type | Description |
|---|---|---|
model | string | Model to use |
text | string | User message |
sessionId | string | Existing chat session id (when continuing a thread) |
Session CRUD lives under Chat.
Assistant workspace context
GET /v1/ai/generate/assistant/context
Returns a summary of workspace context available to the assistant (visibility, traffic, documents, and related signals).
AI traffic stats (generate alias)
GET /v1/ai/generate/ai-traffic
Convenience alias for traffic stats. Prefer the dedicated AI traffic routes for site management.
Generate image
POST /v1/ai/generate/image
| Field | Type | Description |
|---|---|---|
text | string | Image prompt |
size | string | Size string accepted by the selected model |
model | string | dall-e-3 or stability-ultra |
curl https://api.krastie.ai/v1/ai/generate/image \
-H "api-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"dall-e-3","text":"Minimal product hero illustration","size":"1024x1024"}'
Brand voice from website
POST /v1/ai/generate/brand-voice/website
| Field | Type | Description |
|---|---|---|
websiteurl | string | HTTPS URL to analyze |
name | string | Optional display name |
fetchInterval | string | Optional refresh interval |
scope | string | team (default) or personal |
{
"message": "Brand voice created successfully.",
"data": {
"id": "...",
"name": "Brand Voice - 7/9/2026",
"url": "https://example.com",
"contentLength": 12000,
"type": "website"
}
}
Brand voice from text
POST /v1/ai/generate/brand-voice/text
| Field | Type | Description |
|---|---|---|
content | string | Source text |
name | string | Optional name |
scope | string | team or personal |
Brand voice from file URL
POST /v1/ai/generate/brand-voice/file
| Field | Type | Description |
|---|---|---|
file | string | URL to a .md, .txt, .html, or .json file |
name | string | Optional name |
scope | string | team or personal |
Manage existing voices with Brand voice.
SEO visibility report
Visibility report endpoints are documented on AI visibility:
POST /v1/ai/generate/seo-site-reportPOST /v1/ai/generate/seo-site-report/prefillGET /v1/ai/generate/seo-site-reportGET /v1/ai/generate/seo-site-report/history
Calculate SEO score
POST /v1/ai/generate/calculate-seo-score
| Field | Type | Description |
|---|---|---|
content | string | Required body text |
title | string | Optional title |
keywords | string[] | Optional keywords |
autoExtractKeywords | boolean | Extract keywords when none are provided (default true) |
Process blog post with images
POST /v1/ai/generate/process-blog-post-with-images
Processes blog content and associated images through the content pipeline. Send the same payload fields your app uses for blog processing (content, image references, and options).
Improve content
POST /v1/ai/generate/improve-content-with-validation — improve content and return validation/SEO signals.
POST /v1/ai/generate/improve-content-simple
| Field | Type | Description |
|---|---|---|
content | string | Original content |
improvePrompt | string | Instructions for the improvement |
metricType | string | Optional metric label |
Feedback
POST /v1/ai/generate/feedback
Submit feedback on a generation result (used by the product UI; include the identifiers your client already sends).