Overview
The SketricGen Runtime API executes agents that you created in SketricGen. Use it to send a message, continue a conversation, attach previously uploaded files, stream the response, or resume a Human Input pause. The customer-facing Runtime API intentionally exposes one programmatic execution endpoint. Teamspace and agent management belong to the Admin API, while conversational AI management belongs to the SketricGen MCP server. Base URL:https://chat-v2.sketricgen.ai/api/v1
When to use the Runtime API
Use the Runtime API when you want to call an existing SketricGen agent from your own product, backend, workflow runner, or custom UI. Common use cases:- Run AI Workforce agents from your own application
- Add SketricGen agents to an internal product experience
- Build a custom chat UI instead of using the hosted website widget
- Trigger an agent from backend jobs or server-side automations
- Keep conversation identity aligned with users or contacts in your own system
Authentication
Every Runtime API request requires a Teamspace API key with Run agents access. Current keys begin withsk_api_.
Create it from Teamspace settings → API keys → Create key. Enable Run agents, choose the narrowest Project and agent scope that supports the integration, and copy the plaintext key when it is shown once. You can also enable Manage resources if the same credential needs Admin API access.
Required Header:
Quick start
Endpoints
Run Workflow
POST/run-workflow
Execute an AI workflow using a specified agent to generate intelligent responses based on user input.
Request Headers
Request Body
Example Request
Contact ID and User Grouping
Usecontact_id when your product already knows who the end user or contact is. Conversations sent with the same agent_id and contact_id are grouped under the same contact in SketricGen.
This is useful when you want to:
- See all conversations from one customer or app user together
- Continue reviewing a user’s history across multiple sessions
- Connect SketricGen conversations back to your CRM, database, or product user record
- Keep a consistent mapping between SketricGen conversations and your own user records
Identity Fields by Deployment Method
contact_id is a Runtime API field. Browser embeds do not accept a caller-supplied contact identifier:
API example:
contact_id still work; they create conversations with no external user mapping.
Human-in-the-Loop Runs
Human-in-the-loop (HITL) lets an agent pause a Runtime API run and wait for a person to answer a question or approve an action. Use it when your custom application needs to render the request, collect a decision, and continue the same conversation. HITL is disabled by default for Runtime API calls. Setenable_hitl to true on every request where the agent should be allowed to pause, including a request that resumes an earlier pause.
Enabling HITL does not force every run to pause. The run pauses only when the agent reaches a configured HITL-capable tool, such as Human Input or a schedule approval.
1. Start a HITL-enabled run
Send the normal request withenable_hitl: true. HITL works with both non-streaming and streaming responses.
enable_hitl: true, HITL-capable tools do not pause the run through the Runtime API.
2. Detect a pause
For a non-streaming request, checkrun_paused_hitl. When it is true, use the accompanying hitl_request to render the requested decision.
conversation_id and hitl_request.request_id. Read action_requests to understand what paused, and use the corresponding review_configs.allowed_decisions entry to determine which decision types your interface can submit.
For a streaming request, handle these additional events:
After
RUN_PAUSED_HITL, close the stream and resume with a new POST /run-workflow request. Runtime API keys do not use the first-party stream attach or cancel path to resume HITL.
3. Submit a decision and resume
Resume through the samePOST /run-workflow endpoint. Send the original conversation_id, keep enable_hitl: true, and pass one decision for each pending action in the order returned by action_requests.
user_input when resuming. The decision continues the paused run on the existing conversation. A resumed run can pause again, which is why enable_hitl: true must also be present on the resume request.
Decision types
Use only a decision type returned inreview_configs.allowed_decisions.
If the pause contains multiple actions, submit the same number of decisions in the same order. Do not infer that
approve or reject is supported when the corresponding review configuration allows only respond.
Resume errors
Treat a resume as a single-use operation. Disable duplicate submission in your interface while the resume request is in progress.
Response Formats
The endpoint supports two response modes.1. Standard Response (stream: false)
HTTP Status:201 Created
Response Body:
The response does not echo
contact_id. Track the contact identifier you sent in your own system, or read it back from the conversation record.
Example Response:
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:
RUN_FINISHED, RUN_ERROR, RUN_PAUSED_HITL, and RUN_HALTED_OUT_OF_CREDITS are all terminal for the current turn. Treat any of them as the end of the stream rather than waiting for RUN_FINISHED alone.
Example Streaming Events:

