Prediction
Send a message to your flow and receive an AI-generated response. This is the primary endpoint for interacting with your flows and assistants.Authentication: API key may be required depending on flow settings.
Authorizations
Path parameters
idstringRequiredExample:
Flow ID - the unique identifier of your flow
your-flow-id
Body
questionstringOptionalExample:
The question/message to send to the flow
What is artificial intelligence?
streamingbooleanOptionalDefault:
Enable streaming responses for real-time output
false
Example: false
Responses
200
Successful prediction response
application/json
400
Bad Request - Invalid input provided or request format is incorrect
application/json
401
Unauthorized - API key required or invalid
application/json
404
Not Found - Chatflow with specified ID does not exist
application/json
413
Payload Too Large - Request payload exceeds size limits
application/json
422
Validation Error - Request validation failed
application/json
500
Internal Server Error - Flow configuration or execution error
application/json
post
POST /prediction/{id} HTTP/1.1
Host:
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 628
{
"question": "What is artificial intelligence?",
"form": {
"title": "Example",
"count": 1
},
"streaming": false,
"overrideConfig": {
"sessionId": "user-session-123",
"temperature": 0.7,
"maxTokens": 500,
"vars": {
"user_name": "Alice"
}
},
"history": [
{
"role": "apiMessage",
"content": "Hello! I'm an AI assistant. How can I help you today?"
},
{
"role": "userMessage",
"content": "Hi, my name is Sarah and I'm learning about AI"
}
],
"uploads": [
{
"type": "file",
"name": "example.png",
"data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABjElEQVRIS+2Vv0oDQRDG",
"mime": "image/png"
}
],
"humanInput": {
"type": "reject",
"feedback": "Include more emoji"
}
}
{
"text": "Artificial intelligence (AI) is a branch of computer science that focuses on creating systems capable of performing tasks that typically require human intelligence.",
"json": {},
"question": "What is artificial intelligence?",
"chatId": "chat-12345",
"chatMessageId": "msg-67890",
"sessionId": "user-session-123",
"memoryType": "Buffer Memory",
"sourceDocuments": [
{
"pageContent": "This is the content of the page.",
"metadata": {
"author": "John Doe",
"date": "2024-08-24"
}
}
],
"usedTools": [
{
"tool": "Name of the tool",
"toolInput": {
"input": "search query"
},
"toolOutput": "text"
}
]
}
Last updated