Use threads when you want history and follow‑ups. Use interactions to send a new turn into a thread. Use the chat endpoint for single‑turn requests.
Basic request and response
Create a thread interaction withPOST /api/v1/app/thread/{threadID}/interaction. Send exactly one new user message; the server adds thread history. The response is 200 SSE with an initial interaction event and message events ending in done.
Endpoint parameters
Endpoint parameters
interaction event for the persisted interaction ID, then process message events until done.
Example stream
Example stream
Interaction response fields
Null fields may be omitted. Nested message fields follow Messages; account fields follow Workspace Members.Selecting artifacts
Useartifacts on interaction and wrapped chat requests. It contains optional document, connector, skill, and agent_flow arrays. Each array contains selections by organization or project scope.
Endpoint parameters
Endpoint parameters
all_artifacts: true with a nonempty artifacts_ids array. Each category may contain at most one entry per scope. A project selection uses the thread project or the wrapped chat project_id; without project context, all_artifacts for that scope selects nothing. Top-level artifact_ids and all_artifacts are not the current selection model.
organization entry. To exclude that default for a category, send an explicit organization entry with all_artifacts: false and artifacts_ids: []. Available files produced by previous turns in the same thread also remain usable.
Adding media to the chat
If the selected model supports multimodal input, you can send media inpgpt.messages[].content[] (the same request shape used by both thread interactions and one-shot chat).
You can mix multiple content blocks in one message. Supported block types in the schema:
start_timestamp, stop_timestamp, and _meta are optional on all blocks.
Example content blocks
Example content blocks
Endpoint parameters
Endpoint parameters
system.citations.enabled: asks the model to include citation references when available.thinking.enabled: enables deep thinking mode; responses can take longer but are typically better reasoned.
Create or list threads
Create a new thread in a project:Endpoint parameters
Endpoint parameters
Endpoint parameters
Endpoint parameters
Example response
Example response
Thread response fields
Create, detail, update and delete return this thread model with200. Project lists wrap it in the shared pagination envelope. Nullable fields may be omitted; thread responses have no created_at field. Account details follow the Workspace member account model.
Reading
GET /app/thread/{threadID}/interaction advances the current account checkpoint through completed assistant responses in the returned page, or at least the thread creation time when none are returned. Reading thread details alone does not mark the conversation read. Read state is per account.
Create a thread and first interaction in one request:
Endpoint parameters
Endpoint parameters
200 SSE with the new interaction and thread IDs in the initial interaction event, followed by message events and done. name and visibility belong to the separate thread-create body and do not replace thread_name, thread_visibility, or pgpt here.
Get a thread
Endpoint parameters
Endpoint parameters
include relations are available on the project list, not this detail endpoint.
Update or delete a thread
Endpoint parameters
Endpoint parameters
state: "Deleted". Both return 200 JSON.
List or fetch interactions
List interactions for a thread:Endpoint parameters
Endpoint parameters
Delete or stream an interaction
Cancel a running interaction:interaction event for the persisted interaction ID, then process message events until done.
Example stream
Example stream
Thread files
Thread file endpoints use the thread as the session scope. Upload and raw PUT store bytes; conversion exports or imports MDX artifact content. Sendx-org and an API token on every request. Upload, PUT and export from an artifact require permission to update the thread.
Upload a file
Endpoint parameters
Endpoint parameters
200 with file metadata. Missing multipart file returns 400.
Put raw file bytes
Endpoint parameters
Endpoint parameters
200 with file metadata. Parent directories are created and an existing key is overwritten.
Download a thread file
Endpoint parameters
Endpoint parameters
200 with raw file bytes, inferred MIME type and Content-Disposition; it does not return a presigned URL. Organization settings can deny the download with 403: outputs require generated-resource downloads, uploads require uploaded-resource downloads, and unrecognized paths require both settings.
Convert a thread file to an artifact
Endpoint parameters
Endpoint parameters
200 with the created or updated artifact model. The content must be valid artifact MDX; its projection metadata determines the artifact type and properties. Missing both selectors, non-MDX paths or invalid MDX fail. Normal artifact creation/update permissions apply.
Convert an artifact to a thread file
Endpoint parameters
Endpoint parameters
200 with file metadata for the MDX export. Requires artifact read permission and passes the same content-download checks as downloading the artifact; disabled downloads return 403.
File metadata response
Upload, PUT and export-from-artifact share this response. Nullable fields may be omitted.Example response
Example response
One-shot chat
The current endpoint returns200 with Content-Type: text/event-stream, including when pgpt.stream is false. It creates no persisted thread or interaction. Send the wrapped body to select a project or artifacts. A legacy flat Messages request is still accepted for an organization-only chat.
Endpoint parameters
Endpoint parameters
done; there is no persisted interaction event for this operation. Disconnecting cancels the active request. See Messages for nested request and response fields.
Example stream
Example stream
Validate a chat request
Endpoint parameters
Endpoint parameters
200 with valid: true, or 400 with valid: false and the validation result. Invalid bodies or failures before a result is available return a standard API error. Nullable result fields may be omitted. This checks the Messages body; wrapped project context, artifact selections and Workspace permissions are checked when executing the chat.
Example response
Example response
Available tools
Only Zylon-defined tools are accepted inpgpt.tools; custom client tools are not supported by these Workspace chat routes. Use the tool declarations and examples. Workspace knowledge tools also include get_knowledge_base_files (list_files_v1), get_artifact_structure (get_file_structure_v1), get_artifact_content (get_content_v1), analyze_artifact (analyze_artifact_v1), summarize_artifact (summarize_artifact_v1), and create_document (process_content_v1).
Errors and edge cases
- 400: invalid message schema, invalid artifact selectors, or a request without exactly one user message (use
/chat/validate). - 403: insufficient project access or downloads disabled by organization policy.
- Handle SSE
errorevents and terminaldoneafter the HTTP stream begins. - 404: thread or interaction not found.
- 409: interaction already completed when canceling.