# Prediction

## Send message to flow and get AI response

> 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.<br>

```json
{"tags":[{"name":"prediction"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"Prediction":{"type":"object","properties":{"question":{"type":"string","description":"The question/message to send to the flow"},"form":{"type":"object","description":"The form object to send to the flow (alternative to question for Agentflow V2)","additionalProperties":true},"streaming":{"type":"boolean","description":"Enable streaming responses for real-time output","default":false},"overrideConfig":{"type":"object","description":"Override flow configuration and pass variables at runtime","additionalProperties":true},"history":{"type":"array","description":"Previous conversation messages for context","items":{"type":"object","properties":{"role":{"type":"string","enum":["apiMessage","userMessage"],"description":"The role of the message"},"content":{"type":"string","description":"The content of the message"}}}},"uploads":{"type":"array","description":"Files to upload (images, audio, documents, etc.)","items":{"type":"object","properties":{"type":{"type":"string","enum":["audio","url","file","file:rag","file:full"],"description":"The type of file upload"},"name":{"type":"string","description":"The name of the file or resource"},"data":{"type":"string","description":"The base64-encoded data or URL for the resource"},"mime":{"type":"string","description":"The MIME type of the file or resource","enum":["image/png","image/jpeg","image/jpg","image/gif","image/webp","audio/mp4","audio/webm","audio/wav","audio/mpeg","audio/ogg","audio/aac"]}}}},"humanInput":{"type":"object","description":"Return human feedback and resume execution from a stopped checkpoint","properties":{"type":{"type":"string","enum":["proceed","reject"],"description":"Type of human input response"},"feedback":{"type":"string","description":"Feedback to the last output"}}}}},"Document":{"type":"object","properties":{"pageContent":{"type":"string"},"metadata":{"type":"object","additionalProperties":{"type":"string"}}}},"UsedTool":{"type":"object","properties":{"tool":{"type":"string"},"toolInput":{"type":"object","additionalProperties":{"type":"string"}},"toolOutput":{"type":"string"}}}}},"paths":{"/prediction/{id}":{"post":{"tags":["prediction"],"operationId":"createPrediction","summary":"Send message to flow and get AI response","description":"Send a message to your flow and receive an AI-generated response. This is the primary endpoint for interacting with your flows and assistants.\n**Authentication**: API key may be required depending on flow settings.\n","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"Flow ID - the unique identifier of your flow"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prediction"}},"multipart/form-data":{"schema":{"type":"object","properties":{"question":{"type":"string","description":"Question/message to send to the flow"},"files":{"type":"array","items":{"type":"string","format":"binary"},"description":"Files to be uploaded (images, audio, documents, etc.)"},"streaming":{"type":"boolean","description":"Enable streaming responses","default":false},"overrideConfig":{"type":"string","description":"JSON string of configuration overrides"},"history":{"type":"string","description":"JSON string of conversation history"},"humanInput":{"type":"string","description":"JSON string of human input for resuming execution"}},"required":["question"]}}},"required":true},"responses":{"200":{"description":"Successful prediction response","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","description":"The AI-generated response text"},"json":{"type":"object","description":"The result in JSON format if available (for structured outputs)","nullable":true},"question":{"type":"string","description":"The original question/message sent to the flow"},"chatId":{"type":"string","description":"Unique identifier for the chat session"},"chatMessageId":{"type":"string","description":"Unique identifier for this specific message"},"sessionId":{"type":"string","description":"Session identifier for conversation continuity","nullable":true},"memoryType":{"type":"string","description":"Type of memory used for conversation context","nullable":true},"sourceDocuments":{"type":"array","description":"Documents retrieved from vector store (if RAG is enabled)","items":{"$ref":"#/components/schemas/Document"},"nullable":true},"usedTools":{"type":"array","description":"Tools that were invoked during the response generation","items":{"$ref":"#/components/schemas/UsedTool"},"nullable":true}}}}}},"400":{"description":"Bad Request - Invalid input provided or request format is incorrect","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"401":{"description":"Unauthorized - API key required or invalid","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"404":{"description":"Not Found - Chatflow with specified ID does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"413":{"description":"Payload Too Large - Request payload exceeds size limits","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"422":{"description":"Validation Error - Request validation failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"500":{"description":"Internal Server Error - Flow configuration or execution error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flowiseai.com/api-reference/prediction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
