Skip to main content
POST
/
api
/
v1
/
prediction
/
{id}
Execute Agentflow
curl --request POST \
  --url https://api.example.com/api/v1/prediction/{id} \
  --header 'Content-Type: application/json' \
  --data '
{
  "question": "<string>",
  "chatId": "<string>",
  "streaming": true,
  "history": [
    {}
  ],
  "overrideConfig": {}
}
'
{
  "400": {},
  "401": {},
  "404": {},
  "500": {},
  "text": "<string>",
  "chatId": "<string>",
  "chatMessageId": "<string>",
  "sourceDocuments": [
    {}
  ],
  "usedTools": [
    {}
  ],
  "agentReasoning": [
    {}
  ],
  "artifacts": [
    {}
  ]
}
Executes an agentflow with the provided input and returns the agent’s response. This endpoint processes the user’s message through the configured agent workflow.

Path Parameters

id
string
required
The unique identifier of the agentflow to execute

Request Body

question
string
required
The user’s input message or query to send to the agent
chatId
string
Optional chat session identifier to maintain conversation context
streaming
boolean
Enable streaming responses. Defaults to false
history
array
Array of previous messages for conversation context
overrideConfig
object
Override specific node configurations for this execution

Response

text
string
The agent’s response text
chatId
string
The chat session identifier
chatMessageId
string
Unique identifier for this message in the conversation
sourceDocuments
array
Array of source documents used by the agent (if applicable)
usedTools
array
Array of tools used by the agent during execution
agentReasoning
array
Step-by-step reasoning process of the agent
artifacts
array
Any artifacts generated during execution

Example Request

curl -X POST \
  'https://your-flowise-instance.com/api/v1/prediction/abc123-def456-ghi789' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "question": "Help me troubleshoot my login issue",
    "chatId": "session-xyz",
    "streaming": false
  }'

Example Response

{
  "text": "I can help you troubleshoot your login issue. Let me gather some information first...",
  "chatId": "session-xyz",
  "chatMessageId": "msg-789",
  "usedTools": [
    {
      "tool": "knowledge_base",
      "query": "login troubleshooting steps"
    }
  ],
  "agentReasoning": [
    {
      "action": "search",
      "thought": "I need to find relevant troubleshooting steps"
    }
  ]
}

Streaming Response

When streaming is set to true, the response is sent as Server-Sent Events (SSE):
curl -X POST \
  'https://your-flowise-instance.com/api/v1/prediction/abc123-def456-ghi789' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "question": "Help me troubleshoot my login issue",
    "streaming": true
  }'

Error Responses

400
error
Bad Request - Missing required question field or invalid input format
401
error
Unauthorized - Invalid or missing API key
404
error
Not Found - Agentflow with the specified ID does not exist
500
error
Internal Server Error - Error during agentflow execution

Build docs developers (and LLMs) love