Pinter
ENID
Conversations
Lihat sebagai Markdown

Send Message to AI Agent (Supports SSE Streaming & Structured Blocks)

POST/api/conversations/{conversation_id}/send

Overview

Dispatches a user prompt to the AI Agent. Supports real-time Server-Sent Events (SSE) streaming as well as synchronous one-shot JSON responses.

Authentication & Headers

  • Auth: Bearer Token
  • Required Header: API-Version: 1
  • Optional Header: X-Pinter-Response-Format:
    • blocks: Receive structured chart, html, and followup artifact blocks via SSE or block items.
    • blocks,openui: Same as blocks, plus the model may emit ```openui-lang UI fences inside text deltas.
    • json: Guarantee a JSON response (application/json) without block prompt injection, acting like default mode while ensuring structured JSON output.
    • Without the header, the response stays plain SSE text deltas.

Parameters & Request Body Fields

  • conversation_id (path, string, required): The target conversation session UUID.
  • message (string, required): The text prompt or user query.
  • agent_id (string, optional): Specific agent UUID to route query to.
  • stream (boolean, optional, default: false): Set to true for SSE streaming mode (text/event-stream).
  • attachments (array of strings, optional): List of uploaded blob attachment paths for multimodal analysis.
  • approval_mode (string, optional, default: full-access): approval pauses risky tools (names starting with create_, update_, delete_, run_, or add_, and non-read-only query_snowflake calls) for human confirmation. full-access runs them without asking. When the field is omitted, tools run without confirmation, so API clients that want the gate must send approval. The chat UI always sends its own choice.

Parameter

Path

conversation_idstringwajib
Unique UUID of the conversation session / thread.

Header

x-pinter-response-formatstring
Comma-separated response mode tokens. `blocks`: structured rich response blocks (charts, html, images, followup). `blocks,openui`: same as `blocks` plus openui-lang UI fences inside text deltas. `json`: collected JSON response.

Body permintaan

application/json

messagestringwajib
agent_idstringwajib
api_key_idstring | null
attachmentsobject[]
attachments[].mime_typestringwajib
attachments[].data_base64stringwajib
attachments[].filenamestring
attachments[].urlstring | null
streamboolean
approval_modeenum
approvalfull-access
{
  "message": "string",
  "agent_id": "string",
  "api_key_id": "string",
  "attachments": [],
  "stream": false,
  "approval_mode": "full-access"
}

Respons

200 Agent response (JSON format or text/event-stream depending on stream parameter)

400 Bad Request - The request parameters or headers are invalid (e.g. unsupported API-Version).

401 Unauthorized - Missing, invalid, or expired JWT Bearer token.

403 Forbidden - Insufficient role permissions or resource access denied by RBAC policy.

404 Not Found - The requested resource ID was not found.

422 Validation Error

detailobject[]
detail[].locstring | integer[]wajib
detail[].msgstringwajib
detail[].typestringwajib
detail[].inputobject
detail[].ctxobject
{
  "detail": [
    {
      "loc": [
        null
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Contoh

curl -X POST "$PINTER_URL/api/conversations/018f3a55-234b-76b9-b8d1-561b34e2a101/send" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"message":"string","agent_id":"string","api_key_id":"string","attachments":[],"stream":false,"approval_mode":"full-access"}'