Conversations

Add a message to a conversation

Creates a document from the message text and attaches it to the conversation at the given position. If position is omitted, it is appended at the end.

post/v1/projects/{project_id}/conversations/{conversation_id}/messages

Request

  • Base URL: https://api.naturali.ai
  • URL: https://api.naturali.ai/v1/projects/{project_id}/conversations/{conversation_id}/messages
  • Auth: one of:
    • HTTP bearer
    • OAuth 2 (authorization code, authorization URL https://api.naturali.ai/authorize, token URL https://api.naturali.ai/token, scopes: mcp:access)

Path parameters

conversation_idstring required
Example:conv_V1StGXR8Z5jdHi6B

Conversation ID

Request body

messagestring required

Message text content to add to the conversation

role'user' | 'assistant' required

Role of the message sender

actor_idstring nullable

Optional actor ID to associate with this message (user identity)

positioninteger

Zero-based position. Defaults to MAX+1 (append).

metadataNullableMetadataBag nullable

A MetadataBag on a request field where null is meaningful: a full-replacement update that clears the bag. A record whose bag is unset leaves the field out.

Example request

{
  "message": "Hello, how can I help you?",
  "role": "user",
  "actor_id": "actor_V1StGXR8Z5jdHi6B",
  "metadata": {
    "author": "John",
    "revision": 2
  }
}

Response

Message added

document_idstring

Document ID

role'user' | 'assistant' | 'system'

Role of the message sender

actor_idstring nullable

Optional actor ID associated with this message

agent_idstring nullable

Optional agent ID that generated this message (set for assistant messages produced by generate)

positioninteger

Zero-based position in the conversation

metadataMetadataBag

Caller-owned annotations on a resource, stored as the object they were written as: the types a value was written with are the types a read returns, so a filter can ask an ordering question about a number. Unlike other body fields, keys are stored and returned verbatim in the casing supplied — they are not converted between snake_case and camelCase.

No key is reserved, and that is the point: every piece of state the platform owns lives in its own typed column, so nothing written here reaches platform state. The platform never reads the bag — it is not an IAM context, not a policy input and not part of a prompt — which is what separates it from a tag bag.

contentstring nullable

Full text content of the message

idempotency_keystring nullable

The idempotency key the message was posted with, null when none was sent. A channel that posts each inbound message under its provider's message id finds the transcript row for that message by this key.

Example response

{
  "document_id": "doc_V1StGXR8Z5jdHi6B",
  "role": "user",
  "actor_id": "actor_V1StGXR8Z5jdHi6B",
  "agent_id": "agent_V1StGXR8Z5jdHi6B",
  "metadata": {
    "author": "John",
    "revision": 2
  },
  "idempotency_key": "wamid.HBgLNTUxMTk4..."
}

Changes

No recorded changes to this operation across all 1 revision of this API.