Chat & AI API

Send messages to the AI assistant and generate content for entity fields.

3 min read

Chat & AI API

Interact with the WISEROWS AI assistant programmatically and generate content for entity fields using AI.

Send Chat Message

POST /api/v1/chat

Send a message to the AI assistant. Supports multi-turn conversations by passing a conversationId.

Request Body

messagestringrequired
The message to send to the AI assistant.
conversationIdstring
ID of an existing conversation to continue. Omit to start a new conversation.
contextobject
Optional context object to give the AI relevant information about what the user is working on.
context.entityIdstring
Entity ID to provide as context. The AI will have access to the entity's fields and metadata.
context.entityTypeIdstring
Entity type ID for broader context about the data schema.
context.bucketIdstring
Content bucket ID for SEO and publishing context.

Response

data.responsestring
The AI assistant's response text.
data.conversationIdstring
Conversation ID for continuing this thread in subsequent requests.
data.tokensUsednumber
Total tokens consumed by this request (input + output).
Tip
Pass `context` with an `entityId` to give the AI access to the entity's fields and data. This makes responses significantly more relevant -- for example, the AI can reference your entity's title, content, and SEO score when making suggestions.

Generate Content

POST /api/v1/generate

Generate content for specific fields on an entity using AI. This is the programmatic equivalent of clicking "Generate" on a field in the UI.

Request Body

entityIdstringrequired
The entity to generate content for.
fieldsstring[]required
Array of field slugs to generate content for (e.g., `["meta_description", "summary"]`).
promptstring
Optional custom prompt to override the default generation prompt configured on the entity type.
modelstring
Optional AI model override (e.g., `"gemini-flash-latest"`, `"gpt-4o"`). Defaults to the project's configured model.

Response

data.generatedobject
Object mapping field slugs to their generated values.
data.modelstring
The AI model that was used for generation.
data.tokensUsednumber
Total tokens consumed by this generation request.
Note
Generated content is returned but **not automatically saved** to the entity. Use the [Entities API](/docs/api-entities) `PATCH` endpoint to persist the generated values after reviewing them.
Warning
Token usage counts toward your project's monthly AI quota. Monitor usage in **Settings > Usage** to avoid hitting limits.
Was this helpful?

Command Palette

Search for a command to run...