The chat endpoints allow you to interact with Mingleego assistants, send messages, receive responses, and upload files.
Creates a completion for the chat message.
POST https://mingleego.com/api/interactions/chat
| Header | Type | Required | Description |
|---|---|---|---|
x-api-key | string | Yes | Your API key. Get your API key from the API Keys page. |
Content-Type | string | Yes | Must be application/json. |
| Parameter | Type | Required | Description |
|---|---|---|---|
assistantId | string | Yes | The ID of the assistant to use for the completion. |
prompt | string | Yes | The message prompt to send to the assistant. |
fileIds | string[] | No | An array of file IDs to reference in the chat. These should be file IDs obtained from the file upload endpoint. |
Basic request:
1 2 3 4 5 6 7
Request with file references:
1 2 3 4 5 6 7 8
Returns the assistant's response to the chat message.
Status Code: 200 OK
The response body is a JSON object containing the completion text and an optional file URL.
| Field | Type | Description |
|---|---|---|
text | string | The text response generated by the assistant. |
fileUrl | string | null | If the assistant generated a file (e.g., an image or document), this field contains the URL to access it. Otherwise, it is null. |
Text-only response:
1 2 3 4
Response with generated file:
1 2 3 4
Response with file analysis:
1 2 3 4
Status Code: 400 Bad Request
1 2 3 4
Status Code: 400 Bad Request (invalid request body)
1 2 3 4
Status Code: 500 Internal Server Error
1 2 3 4
Creates a streaming completion for the chat message using Server-Sent Events (SSE). The response is streamed back as the model generates it, allowing for real-time updates.
POST https://mingleego.com/api/interactions/chat/sse
| Header | Type | Required | Description |
|---|---|---|---|
x-api-key | string | Yes | Your API key. Get your API key from the API Keys page. |
Content-Type | string | Yes | Must be application/json. |
| Parameter | Type | Required | Description |
|---|---|---|---|
assistantId | string | Yes | The ID of the assistant to use for the completion. |
prompt | string | Yes | The message prompt to send to the assistant. |
fileIds | string[] | No | An array of file IDs to reference in the chat. These should be file IDs obtained from the file upload endpoint. |
Basic request:
1 2 3 4 5 6 7
Request with file references:
1 2 3 4 5 6 7 8
Returns a Server-Sent Events (SSE) stream. The response is sent incrementally as the model generates the completion.
Status Code: 200 OK
Content-Type: text/event-stream
The response is streamed as SSE events. Each event contains a chunk of the completion text. The final response format is the same as the non-streaming endpoint, with text and fileUrl fields.
Note: The SSE endpoint accepts the same request parameters as the regular chat endpoint. The only difference is the response format (streaming vs. complete response).
To handle streaming responses in JavaScript, you can use the fetch API with streaming:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Use the streaming endpoint when:
Streaming is especially useful for chat interfaces where users expect to see text appear progressively rather than waiting for the complete response.
Uploads a file that can be used in chat interactions. The uploaded file will be processed and made available for the assistant to reference.
POST https://mingleego.com/api/interactions/chat/file
| Header | Type | Required | Description |
|---|---|---|---|
x-api-key | string | Yes | Your API key. Get your API key from the API Keys page. |
Authorization | string | No | Bearer token (optional, can be used in addition to x-api-key). |
Content-Type | string | Yes | Must be multipart/form-data. |
The request body must be sent as multipart/form-data.
| Parameter | Type | Required | Description |
|---|---|---|---|
file | file | Yes | The file to upload. Supported file types depend on your assistant configuration. |
1 2 3 4
Returns the ID of the uploaded file. This file ID can be used in subsequent chat requests.
Status Code: 200 OK
Response Body: The file ID as a plain text string.
input_1764951853973_it_services.pdf
The response is the file ID that was assigned to the uploaded file. Use this ID when you need to reference the file in chat interactions.
After uploading a file, you can reference it in your chat requests. The file will be available for the assistant to read and use in generating responses.
Note: The file ID format may vary, but it typically includes a timestamp and the original filename. Store this ID if you need to reference the file in future requests.