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": "Hello, I have a question about the solar system."
  }'

Response

{
    "id": "mdb_msg_7a74bc341b194af1ab8228e57a85d462",
    "assistant_id": null,
    "attachments": null,
    "completed_at": null,
    "content": [
        {
            "text": {
                "annotations": [],
                "value": "Hello, I have a question about the solar system."
            },
            "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" \
  -H "Content-Type: application/json"

Response

{
    "data": [
        {
            "id": "mdb_msg_7a74bc341b194af1ab8228e57a85d462",
            "assistant_id": null,
            "attachments": null,
            "completed_at": null,
            "content": [
                {
                    "text": {
                        "annotations": [],
                        "value": "Hello, I have a question about the solar system."
                    },
                    "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?