Skip to main content

MongoDB RAG Server API (1.0.0)

Download OpenAPI specification:Download

License: Apache 2.0

The MongoDB RAG Server API is a RESTful API that allows you to create and manage conversations. The API is designed to be used by the MongoDB RAG UI frontend, but can also be used by other clients.

NOTE: The default configuration requires capturing user IP address and a header Origin: some_string. You can override this. Refer to the server configuration documentation for more information.

Start new conversation

Authorizations:
ApiKeyAuth

Responses

Response samples

Content type
application/json
{
  • "_id": "string",
  • "messages": [
    ],
  • "createdAt": 0
}

Add message to the conversation

Add a message to the conversation and get a response back from chatbot.

Authorizations:
ApiKeyAuth
path Parameters
conversationId
required
string

The unique identifier for a conversation.

query Parameters
stream
boolean
Default: false

If true, the response will be streamed to the client. This is useful for long-running conversations.

Request Body schema: application/json
message
required
string <markdown>

Markdown-formatted message from the user.

Responses

Request samples

Content type
application/json
{
  • "message": "string"
}

Response samples

Content type
{
  • "id": "string",
  • "role": "user",
  • "content": "string",
  • "rating": true,
  • "userComment": "string",
  • "createdAt": 0,
  • "references": []
}

Get a conversation

Authorizations:
ApiKeyAuth
path Parameters
conversationId
required
string

The unique identifier for a conversation.

Responses

Response samples

Content type
application/json
{
  • "_id": "string",
  • "messages": [
    ],
  • "createdAt": 0
}

Rate message

Authorizations:
ApiKeyAuth
path Parameters
conversationId
required
string

The unique identifier for a conversation.

messageId
required
string

The unique identifier for a message.

Request Body schema: application/json
rating
boolean

Set to true if the user liked the message, false if the user didn't like the message.

Responses

Request samples

Content type
application/json
{
  • "rating": true
}

Response samples

Content type
application/json
{ }

Add comment to assistant message

Add a comment to an assistant message that clarifies a thumbs up/down rating.

You can only rate an an assistant message that has a thumbs up/down rating. You can only rate a message once. The server returns a 400 error response if the message is not from the assistant, is not rated, or has already been rated.

Authorizations:
ApiKeyAuth
path Parameters
conversationId
required
string

The unique identifier for a conversation.

messageId
required
string

The unique identifier for a message.

Request Body schema: application/json
comment
string

Comment from the user clarifying why they liked or disliked the message.

Responses

Request samples

Content type
application/json
{
  • "comment": "string"
}

Response samples

Content type
application/json
{ }