Chat API

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 AskAI have the role: assistant.

Chat with AskAI

post
Body
idstringRequired

AskAI ID

api_keystringRequired

AskAI API Key

Responses
200
Successful response
application/json
post
POST /api/1.1/wf/ask-ai-chat HTTP/1.1
Host: myaskai.com
Content-Type: application/json
Accept: */*
Content-Length: 76

{
  "id": "text",
  "api_key": "text",
  "messages": [
    {
      "role": "text",
      "content": "text"
    }
  ]
}
200

Successful response

{
  "answer": "text",
  "references": [
    {
      "content": "text",
      "link": "https://example.com",
      "score": 1,
      "title": "text"
    }
  ]
}

If human handover guidance is triggered the API response will include: "human_handover": true

Last updated

Was this helpful?