POST
/conversations/{conversationId}/messages
AuthorizationBearer <token>

In: header

Path Parameters

conversationIdstring

The unique identifier of the conversation to send the message to

Formatuuid
stream?boolean

If set to true, the model response data will be streamed to the client as it is generated using server-sent events. When streaming is enabled, the response will be sent as text/event-stream with incremental updates. When disabled, the complete response will be returned as application/json.

Defaultfalse
contentstring

The message content to send to the assistant. This is the user's input that will be processed by the AI.

Length1 <= length <= 10000
pageContext?object | null

Optional context information about the user's current page and interaction. This helps the assistant provide more relevant responses.

Response Body

curl -X POST "https://api.siteassist.io/v2/conversations/123e4567-e89b-12d3-a456-426614174000/messages" \  -H "Content-Type: application/json" \  -d '{    "content": "Hello! Can you help me understand how to use this feature?",    "stream": false,    "pageContext": {      "url": "https://example.com/help",      "title": "Help Center - Getting Started",      "content": "Welcome to our help center. Here you can find answers to common questions..."    }  }'

{
  "steps": [
    {
      "content": [
        {
          "type": "text",
          "text": "Hello! How can I assist you today?"
        }
      ],
      "finishReason": "stop",
      "usage": {
        "inputTokens": 2409,
        "outputTokens": 11,
        "totalTokens": 2420,
        "reasoningTokens": 0,
        "cachedInputTokens": 0
      }
    }
  ]
}
"Message sent"
{
  "error": {
    "message": "Invalid request body. Content is required.",
    "code": "INVALID_REQUEST_BODY",
    "details": {
      "field": "content"
    }
  }
}
{
  "error": {
    "message": "Authentication required",
    "code": "UNAUTHORIZED"
  }
}
{
  "error": {
    "message": "A higher pricing plan is required to access this feature",
    "code": "PAYMENT_REQUIRED",
    "details": {
      "currentPlan": "free",
      "requiredPlan": "pro",
      "feature": "advanced_ai_models"
    }
  }
}
{
  "error": {
    "message": "Access denied to this conversation",
    "code": "FORBIDDEN"
  }
}
{
  "error": {
    "message": "Conversation not found!",
    "code": "CONVERSATION_NOT_FOUND",
    "details": {
      "conversationId": "123e4567-e89b-12d3-a456-426614174000"
    }
  }
}
{
  "error": {
    "message": "Resource already exists",
    "code": "CONFLICT",
    "details": {
      "resource": "conversation",
      "conflictingField": "id"
    }
  }
}
{
  "error": {
    "message": "Validation failed",
    "code": "VALIDATION_ERROR",
    "details": {
      "field": "content",
      "reason": "Content exceeds maximum length of 10000 characters"
    }
  }
}
{
  "error": {
    "message": "Rate limit exceeded. Please try again later.",
    "code": "RATE_LIMIT_EXCEEDED",
    "details": {
      "retryAfter": 60
    }
  }
}
{
  "error": {
    "message": "An internal server error occurred",
    "code": "INTERNAL_SERVER_ERROR"
  }
}
{
  "error": {
    "message": "Service temporarily unavailable",
    "code": "BAD_GATEWAY",
    "details": {
      "service": "ai_model_service"
    }
  }
}
{
  "error": {
    "message": "Service temporarily unavailable",
    "code": "SERVICE_UNAVAILABLE",
    "details": {
      "retryAfter": 30
    }
  }
}