Skip to main content
POST
/
ask-ai-chat
Chat with AskAI
curl --request POST \
  --url https://myaskai.com/api/1.1/wf/ask-ai-chat \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": "<string>",
  "api_key": "<string>",
  "messages": [
    {
      "role": "<string>",
      "content": "<string>"
    }
  ]
}
'
{
  "answer": "<string>",
  "references": [
    {
      "content": "<string>",
      "link": "<string>",
      "score": 123,
      "title": "<string>"
    }
  ]
}
Our Chat API allows a user to have a conversation with your AI agent via a simple API call. The messages array should contain the conversation between the user and the AI agent. You can send the entire conversation within the API request. Each message object has a role (user or assistant) and content. In the example below you can see a short conversation between a user and an AI agent. The message from the user has the role: user and all replies from the My AskAI have the role: assistant.
If your AI agent doesn’t know the answer, the API will also return an additional field to confirm an answer wasn’t found as well as 3 suggested questions the user can retry (these have a very high likelihood of being answered correctly): "unknown_answer": "yes","suggestedQuestions": ["Example question", ...]
You can also pass in "insights": true to generate insights in your Dashboard from any API usage. When Insights is enabled in the API a conversation_id is also returned with each request. This can be included in subsequent API requests to keep the requests link to 1 conversation. However, you still need to always pass in the message history as the API is stateless.
If human handover guidance is triggered the API response will include: "human_handover": true

Body

application/json
id
string
required

AskAI ID

api_key
string
required

AskAI API Key

messages
object[]
required

Response

200 - application/json

Successful response

answer
string

Answer from AskAI

references
object[]