get
https://api.unless.com/api/v1/ai/async/answer
Retrieve the result of an asynchronous AI query using the questionId returned from the async query endpoint.
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,
chatDatacontains the result - ERROR: Query failed,
errorcontains the error message
Example requests
curl -X GET "https://rest-endpoint.unless.com/api/v1/ai/async/answer?questionId=550e8400-e29b-41d4-a716-446655440000" \
-H "x-api-key: your-api-key-here"Example responses
Pending status
{
"questionId": "550e8400-e29b-41d4-a716-446655440000",
"status": "PENDING"
}Processing status
{
"questionId": "550e8400-e29b-41d4-a716-446655440000",
"status": "PROCESSING"
}Completed response
{
"questionId": "550e8400-e29b-41d4-a716-446655440000",
"status": "DONE",
"chatData": {
"history": [
{
"type": "message",
"sender": "user",
"message": "What does Unless do?",
"timestamp": 1687956110772
},
{
"type": "message",
"sender": "bot",
"message": "Unless helps companies create personalized experiences...",
"timestamp": 1687956112605,
"metadata": []
}
],
"conversationId": "async-550e8400-e29b-41d4-a716-446655440000",
"sessionId": "session-123"
}
}Error response
{
"questionId": "550e8400-e29b-41d4-a716-446655440000",
"status": "ERROR",
"error": "Timeout processing query"
}Usage flow
- First, submit a query using
/v1/ai/async/queryto get aquestionId - Poll this endpoint using the
questionIdto check the status - Continue polling until status changes to
DONEorERROR - When
DONE, the full AI response is available in thechatDataobject
Response headers
Access-Control-Allow-Origin: CORS header for browser requests