Skip to content

Retrieving an answer (async)

GET
/api/v1/ai/async/answer

Retrieve the result of an asynchronous AI query using the questionId returned from /v1/ai/async/query. This endpoint returns the current processing status and the full ChatData response when complete.

Status values

  • PENDING: Query is queued for processing
  • PROCESSING: Query is currently being processed
  • DONE: Query completed successfully, chatData contains the result
  • ERROR: Query failed, error contains the error message

Usage flow

  1. First, submit a query using /v1/ai/async/query to get a questionId
  2. Poll this endpoint using the questionId to check the status
  3. Continue polling until status changes to DONE or ERROR
  4. When DONE, the full AI response is available in the chatData object
x-api-key
required
string

Your API key from account settings.

questionId
required
string format: uuid

The questionId returned from /v1/ai/async/query.

Current status and, when complete, the chat data.

object
questionId
required
string format: uuid
status
required

PENDING — queued, PROCESSING — actively running, DONE — completed (chatData present), ERROR — failed (error present).

string
Allowed values: PENDING PROCESSING DONE ERROR
chatData

Conversation state object returned by query endpoints.

object
history

Array of conversation turns.

Array<object>
object
type
string
timestamp
integer
0
uuid
string
hidden
boolean
default: true
sender
string
message
string
metadata
Array<object>
object
languageCode
string
showMetadata
boolean
default: true
canGetFeedback
boolean
default: true
feedback
string
metadata

Arbitrary metadata associated with the conversation.

object
toolsetName
string
nullable
personalizationId
string
sessionId
string
conversationName
string
nullable
conversationId
string
Example
{
"history": [
{
"type": "message",
"timestamp": 1687956110772,
"uuid": "57c1968c-1b49-48d5-a484-ed299e609b8a",
"hidden": false,
"sender": "user",
"message": "What does Unless do?",
"metadata": [],
"languageCode": "en",
"showMetadata": false,
"canGetFeedback": false,
"feedback": ""
},
{
"type": "message",
"timestamp": 1687956112605,
"uuid": "5aa331df-1e6d-4ee2-b6aa-93176e521469",
"hidden": false,
"sender": "bot",
"canGetFeedback": true,
"message": "Unless is a tool that allows companies to create highly personalized and compelling landing pages to highlight their benefits compared to competitors. It also offers AI training to become an expert in a company's product and provides conversational UI components.",
"metadata": [
{
"title": "Rapid experimentation",
"isPublic": true,
"isUsedForAnswer": true,
"source": "https://unless.com/en/blog/customer-cases/rapid-experimentation-at-prenatal/",
"documentId": "4c0cbe48-bd8b-403e-bbad-3d16a9c679c9",
"stableId": "c37310599c08a2a2d5295fbd98c42a34",
"trainingDataId": "1e61e2e6-8b3f-4b90-8703-a40aa6d7783f"
}
],
"showMetadata": false,
"feedback": ""
}
],
"metadata": {},
"toolsetName": null,
"personalizationId": "",
"sessionId": "23d1b8d1-64f5-4dd2-8122-73e56d0c78ff",
"conversationName": null,
"conversationId": "e796d388-ddb3-4ab6-9891-06f2e4dd16cb"
}
error
string
Examples

Pending status

{
"questionId": "550e8400-e29b-41d4-a716-446655440000",
"status": "PENDING"
}