Skip to main content

Create a bot instance

Available since MicroStrategy ONE (March 2024)

caution

This API is planned for future retirement. Therefore, MicroStrategy recommends that you transition to the Question with Bot Routing API for bot-related workflows.

Using the Question with Bot Routing API:

  • You do not need to manually create or manage bot instances. The API automatically creates and manages bot instances.
  • It offers ongoing support and updates, ensuring compatibility with new bot-related features.
  • It provides enhanced functionality, such as intelligent bot selection and flexible bot routing.

This workflow sample demonstrates how to create a bot instance.

info

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

Create a bot instance

Endpoint: POST /api/bots/{botId}/instances

note

Replace {botId} in POST /api/bots/{botId}/instances with the chatbot ID in your environment.

Sample Request Header:

"X-MSTR-AuthToken": "evvk84kcucn8abon6c1qfbud7"
"X-MSTR-ProjectID": "B7CA92F04B9FAE8D941C3E9B7E0CD754"

Sample Request Body:

{
"context": {
"type": "new"
}
}

Sample Curl:

curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/bots/6C6D314E4C881C01BFD79084DD5B2D42/instances' \
-X 'POST'
--header 'X-MSTR-AuthToken: t40ltbk411923ipk85r8r0tace' \
--header 'X-MSTR-ProjectID: FCC1924411EAABC39C6C0080EFA54501' \
--header 'Content-Type: application/json' \
--data '{
"context": {
"type": "new"
}
}'

Sample Response:

Response CodeStatus
200Successfully create the bot instance
400Error in creating the bot isntance
401Authorization failed
404Bot does not exist

Sample Response Body on success:

{
"id": "5B1EB48585F04384A97F3D831D7C7416"
}