API

Message Export

Exporting Data

This endpoint allows you to export message data for a project through the API. Access must be enabled by contacting support.

POST /api.mendable.ai/v1/getMessagesData

Here is an example request using cURL:

curl -X POST https://api.mendable.ai/v1/getMessagesData \
  -H "Content-Type: application/json" \
  -d '{
        "api_key": "YOUR_API_KEY",
        "rating_value": 0,
        "start_date":"2023-09-20",
        "end_date":"2023-09-22"
      }'

or using Javascript:

const url = "https://api.mendable.ai/v1/getMessagesData";

const data = {
  api_key: "YOUR_API_KEY",
  rating_value: 1,
  start_date:"2023-09-20",
  end_date:"2023-09-22"
};

fetch(url, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
})
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

Body Parameters

ParameterTypeDescription
api_keystringThe API key associated with your project.
rating_valueint1 for good, -1 for bad, 0 for unrated. The rating value for the message.
start_datestringThe date to begin grabbing messages
end_datestringThe date to end grabbing messages

Response

[
  {
    "project_id": 1234,
    "message_id": 1234567,
    "conversation_id": 123456789,
    "timestamp": "2023-09-21T22:48:24.662",
    "human_query": "What is mendable?",
    "ai_response": "Mendable is..."
  },
  ..
]

Success

  • Status code: 200
  • Response body: "Message rating updated"

Errors

  • Status code: 400
    • Missing api_key parameter
    • Export messages not enabled
Previous
Message Rating