Skip to main content

Chat API

Ask question over multiple related documents in a chat session.

Endpoint/md/chat
URLhttps://us-central.unstract.com/api/v1/md/chat
MethodPOST
HeadersAuthorization: Bearer <platform_key>

Request Body Form Data

FieldTypeDescription
email(text)User email
doc_ids(text, repeated)OPTIONAL document IDs to be included in the chat
search_tags(text, repeated)Tags for metadata search over indexed files
chat_session_id(text)OPTIONAL session ID of ongoing chat
question(text)Question to be asked over chat session
explain(text)OPTIONAL Enable tracing [true

Success Response

  • Status: 200

  • Content-Type: application/json

  • Body:

    {
    "response": "",
    "reason": {},
    "follow_up": "",
    "session_id": ""
    }
  • Example:

    {
    "response": "The quarter with the highest revenue was Q4 2021, with a revenue of $5,778 million.",
    "reason": {},
    "follow_up": "",
    "session_id": "b46b61c4-3e41-441c-9ec3-95c3bd60c9fc"
    }

Error Response

  • Status: 4xx or 5xx

  • Content-Type: application/json

  • Body:

    {
    "description": "",
    "status": 0,
    "message": ""
    }
  • Example:

    {
    "description": "Unauthorized",
    "status": 401,
    "message": "Invalid API Key or Email. Please check user and the active key under platform settings."
    }