Skip to main content
POST
/
api
/
chats
/
{chat_id}
/
messages
Create a message
curl --request POST \
  --url https://api.morphic.io/api/chats/{chat_id}/messages \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "role": "<string>",
  "content": "<string>",
  "attachments": {},
  "metadata": {}
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "role": "<string>",
  "content": "<string>",
  "chat_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "attachments": {},
  "metadata": {}
}

Authorizations

X-API-Key
string
header
required

API key (sk_xxx) from Developer Settings. No X-Account-ID needed.

Headers

x-account-id
string | null

Path Parameters

chat_id
string<uuid>
required

Body

application/json
role
string
required

Message role: 'user', 'assistant', or 'system'

content
string
required

Message content

Minimum string length: 1
attachments
Attachments · object

File attachments metadata

metadata
Metadata · object

Response

Successful Response

id
string<uuid>
required
created_at
string<date-time>
required
updated_at
string<date-time>
required
role
string
required

Message role: 'user', 'assistant', or 'system'

content
string
required

Message content

Minimum string length: 1
chat_id
string<uuid>
required
attachments
Attachments · object

File attachments metadata

metadata
Metadata · object