Skip to main content

Ask a question with bot routing

Available since MicroStrategy ONE (June 2024)

Use this API to identify the most suitable bot to answer your question based on the application, content group, and specific bots.

info

Obtain the authorization token needed to execute the request using POST /api/auth/login.

Ask a question with bot routing

Endpoint: POST /api/questions

Sample Request Headers:

HeaderRequiredDescriptionSample Value
X-MSTR-AuthTokenYesAuthorization Tokent40ltbk411923ipk85r8r0tace
PreferYesThe response mode, which must be respond-async.respond-async
Content-TypeYesType of content being sentapplication/json

Sample Request Query Strings:

Query StringRequiredDescriptionSample Value
applicationIdNoApplication ID. If not specified, the default is used.CDC07694B5F844EC0DA0073EAD71928E
botIdsNoBot IDs, split by commasFF50752ED8CA586C641492F29DF4D6E7,075D0CD44EEB6B82B3B9EF03F6ED705B
contentGroupIdsNoContent Group IDs, split by commas820E261D28705ED6494D200D98457626,0791486376B37445DEB502AF6951072B
useHistoryNoUse history or start a new chatfalse

Sample Request Body:

FieldRequiredDescriptionSample Value
textYesThe question textWhich customer has the highest revenue?
answers.imagesNoOptional. If not specified, the image is not generated. Supports one image.[{"width": 200, "height": 300}]
quotesNoOptional. The content of the question quote. The type of quotes can be message or answer.[{"text":"There are 10000 distinct customers identified based on the purchasing behavior.", "type":"message"}]
{
"text": "Which customer has the highest revenue?",
"answers.images": [
{
"width": 720,
"height": 405
}
],
"quotes": [
{
"id": "24EBB7209BA649B0BACF8DC4A12037E3",
"question": "How many distinct customers are identified based on the purchasing behavior?",
"text": "There are 10000 distinct customers identified based on the purchasing behavior.",
"type": "answer"
}
]
}

Sample Curl:

curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/questions' \
-X 'POST' \
--header 'X-MSTR-AuthToken: t40ltbk411923ipk85r8r0tace' \
--header 'X-MSTR-ProjectID: FCC1924411EAABC39C6C0080EFA54501' \
--header 'Prefer: respond-async' \
--header 'Content-Type: application/json' \
--data '{
"text": "Which customer has the highest revenue?",
"answers.images": [
{
"width": 720,
"height": 405
}
],
"quotes": [
{
"id": "24EBB7209BA649B0BACF8DC4A12037E3",
"question": "How many distinct customers are identified based on the purchasing behavior?",
"text": "There are 10000 distinct customers identified based on the purchasing behavior.",
"type": "answer"
}
]
}'

Sample Response:

Response CodeStatus
202Successfully accepted the question
400Error in accepting the question
401Authorization failed
404No bot found

Sample Response Body on success:

{
"id": "9161386651E84054A6230796C84E12C5:68696ADB633946B4B430ABD959433B3B:FCC1C28296014AB19ABD877E60590890"
}