POST/threads/{thread_id}/messages

Create Message

This endpoint creates a Message in a Thread.

Path Parameters

  • Name
    thread_id
    Type
    string
    Required
    Description

    Id of a Thread to post message.

Authorization

Request Body

  • Name
    role
    Type
    string
    Required
    Description

    Role used to send a Message.

  • Name
    content
    Type
    string
    Required
    Description

    A Message to be posted to a Thread.

Request

POST
/threads/{thread_id}/messages
curl -X POST "https://mdb.ai/threads/mdb_thread_cfa0fac64cd94faab3ae269d768c0cb0/messages" \
  -H "Authorization: Bearer MINDS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "role": "user",
      "content": "What data do you have access to?"
  }'

Response

{
    "id": "mdb_msg_7a74bc341b194af1ab8228e57a85d462",
    "assistant_id": null,
    "attachments": null,
    "completed_at": null,
    "content": [
        {
            "text": {
                "annotations": [],
                "value": "What data do you have access to?"
            },
            "type": "text"
        }
    ],
    "created_at": 1718885284.3509543,
    "incomplete_at": null,
    "incomplete_details": null,
    "metadata": null,
    "object": null,
    "role": "user",
    "run_id": null,
    "status": null,
    "thread_id": "mdb_thread_cfa0fac64cd94faab3ae269d768c0cb0"
}

GET/threads/{thread_id}/messages

List Messages

This endpoint gets Messages from a Thread.

Path Parameters

  • Name
    thread_id
    Type
    string
    Required
    Description

    Id of a Thread that stores messages.

Authorization

Request

GET
/threads/{thread_id}/messages
curl -X GET "https://mdb.ai/threads/mdb_thread_cfa0fac64cd94faab3ae269d768c0cb0/messages" \
  -H "Authorization: Bearer MINDS_API_KEY"

Response

{
    "data": [
        {
            "id": "mdb_msg_7a74bc341b194af1ab8228e57a85d462",
            "assistant_id": null,
            "attachments": null,
            "completed_at": null,
            "content": [
                {
                    "text": {
                        "annotations": [],
                        "value": "What data do you have access to?"
                    },
                    "type": "text"
                }
            ],
            "created_at": 1718885284.349052,
            "incomplete_at": null,
            "incomplete_details": null,
            "metadata": null,
            "object": "thread.message",
            "role": "user",
            "run_id": null,
            "status": "completed",
            "thread_id": "mdb_thread_cfa0fac64cd94faab3ae269d768c0cb0"
        }
    ],
    "object": "list",
    "first_id": "mdb_msg_7a74bc341b194af1ab8228e57a85d462",
    "last_id": "mdb_msg_7a74bc341b194af1ab8228e57a85d462",
    "has_more": false
}

Was this page helpful?