POST
/
chat
/
build
Chat build
curl --request POST \
  --url https://app.phonely.ai/api/chat/build \
  --header 'Content-Type: application/json' \
  --data '{
  "id": "<string>",
  "messages": [
    {
      "id": "<string>",
      "role": "<string>",
      "parts": [
        {
          "type": "<string>",
          "text": "<string>"
        }
      ]
    }
  ],
  "userId": "<string>"
}'
{}
Provides AI-powered chat functionality for building and developing with Phonely. This endpoint uses advanced AI models with tool integration for enhanced assistance.

Request

Method: POST
Endpoint: /api/chat/build
Headers:
  • Content-Type: application/json
Request Body:
{
  "id": "string",
  "messages": [
    {
      "id": "string",
      "role": "string",
      "parts": [
        {
          "type": "text",
          "text": "string"
        }
      ]
    }
  ],
  "userId": "string"
}
Parameters:
  • id (string, required): Unique session identifier
  • messages (array, required): Array of chat messages
  • userId (string, optional): User identifier for tracking

Response

Success Response (200): Server-Sent Events (SSE) stream with AI responses Error Responses:
  • 400 Bad Request: Invalid request format
  • 500 Internal Server Error: Server error or AI processing error

Example

curl -X POST https://app.phonely.ai/api/chat/build \
  -H "Content-Type: application/json" \
  -d '{
    "id": "session123",
    "messages": [
      {
        "id": "msg1",
        "role": "user",
        "parts": [
          {
            "type": "text",
            "text": "How do I create a new agent?"
          }
        ]
      }
    ],
    "userId": "user123"
  }'

Notes

  • This endpoint provides streaming responses via Server-Sent Events
  • Maximum duration is 60 seconds
  • Includes advanced AI capabilities with tool integration
  • Supports conversation tracking and user identification
  • Uses Langfuse for observability and tracing

Body

application/json
id
string
required

Unique session identifier

messages
object[]
required
userId
string

User identifier for tracking

Response

Successful response

Server-Sent Events (SSE) stream with AI responses