Overview
SketricGen provides a high-performance Public API service that enables AI-powered conversational workflows using custom agents you design in the Web App. This API provides endpoints for running AI workflows, managing conversations, and streaming real-time responses. Base URL:https://chat-v2.sketricgen.ai/api/v1
Authentication
All API requests require authentication via an API key in the request headers. Required Header:Endpoints
Run Workflow
POST/run-workflow
Execute an AI workflow using a specified agent to generate intelligent responses based on user input.
Request Headers
Header | Type | Required | Description |
---|---|---|---|
api-key | string | Yes | Your API authentication key |
Content-Type | string | Yes | Must be application/json |
Request Body
Field | Type | Required | Description | Constraints |
---|---|---|---|---|
agent_id | string | Yes | Unique identifier for the AI agent to use | - |
user_input | string | Yes | The user’s message or query to process | Max 10,000 characters |
conversation_id | string | No | ID of existing conversation to continue | If omitted, creates new conversation |
contact_id | string | No | External identifier to associate conversation with a contact | Max 255 characters |
stream | boolean | No | Enable real-time response streaming | Default: false |
Example Request
Response Formats
The endpoint supports two response modes.1. Standard Response (stream: false)
HTTP Status:201 Created
Response Body:
Field | Type | Description |
---|---|---|
agent_id | string | The agent that processed the request |
user_id | string | Identifier for the user account |
conversation_id | string | ID of the conversation (new or existing) |
contact_id | string | External contact identifier (if provided) |
response | string | The AI agent’s generated response |
owner | string | Owner of the agent |
error | boolean | Indicates if an error occurred |
2. Streaming Response (stream: true)
HTTP Status:200 OK
Content-Type: text/event-stream
When streaming is enabled, the endpoint returns real-time Server-Sent Events (SSE) as the AI processes the request.
Event Types:
Event Type | Description |
---|---|
RUN_STARTED | Workflow execution has begun |
TEXT_MESSAGE_START | AI has started generating a text response |
TEXT_MESSAGE_CONTENT | Incremental text content (streaming) |
TEXT_MESSAGE_END | AI has finished generating text response |
TOOL_CALL_START | AI has started using a tool/function |
TOOL_CALL_END | AI has finished using a tool/function |
RUN_FINISHED | Workflow execution completed successfully |
RUN_ERROR | An error occurred during execution |