{"versionId":"ba4d2cf9-96a8-409e-e348-08df2fdd4352","articleId":"61a2f789-6a87-4554-6738-08df2fdd4355","title":"Send messages and manage conversations using APIs","tags":["API","Automation","All articles"],"content":"<html><head></head><body><p>Use Theta Assist’s APIs to send requests to an assistant from an external application or automation. Choose the Messages API for a one-off request, or the Conversations API when follow-up messages need the context of earlier messages.</p>\n<p>This guide is for people building integrations. Use the downloadable OpenAPI definitions for exact request fields, response formats and attachment requirements.</p>\n<div class=\"mce-toc\">\n<h2>Quick links</h2>\n<ul>\n<li><a href=\"#quick-links\">Choose an API</a></li>\n<li><a href=\"#before-you-start\">Before you start</a></li>\n<li><a href=\"#authenticate-your-requests\">Authenticate your requests</a></li>\n<li><a href=\"#send-a-one-off-message\">Send a one-off message</a></li>\n<li><a href=\"#start-and-continue-a-conversation\">Start and continue a conversation</a>\n<ul>\n<li><a href=\"#start-a-conversation\">Start a conversation</a></li>\n<li><a href=\"#send-a-follow-up-message\">Send a follow-up message</a></li>\n</ul>\n</li>\n<li><a href=\"#handle-tool-approvals\">Handle tool approvals</a></li>\n<li><a href=\"#read-or-delete-a-conversation\">Read or delete a conversation</a>\n<ul>\n<li><a href=\"#read-the-transcript\">Read the transcript</a></li>\n<li><a href=\"#delete-a-conversation\">Delete a conversation</a></li>\n</ul>\n</li>\n<li><a href=\"#manage-expiry-and-concurrent-requests\">Manage expiry and concurrent requests</a>\n<ul>\n<li><a href=\"#conversation-expiry\">Conversation expiry</a></li>\n<li><a href=\"#concurrent-requests\">Concurrent requests</a></li>\n</ul>\n</li>\n<li><a href=\"#troubleshoot-requests\">Troubleshoot requests</a>\n<ul>\n<li><a href=\"#a-message-returns-http-409\">A message returns HTTP 409</a></li>\n<li><a href=\"#a-personal-access-token-stops-working\">A personal access token stops working</a></li>\n<li><a href=\"#a-conversation-has-expired\">A conversation has expired</a></li>\n</ul>\n</li>\n<li><a href=\"#publishing-checks\">Publishing checks</a></li>\n<li><a href=\"#references\">References</a></li>\n</ul>\n</div>\n<h2 id=\"quick-links\">Choose an API</h2>\n<table style=\"border-collapse: collapse;\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #ccc; text-align: left; vertical-align: top; padding: 2px;\">Your task</th>\n<th style=\"border: 1px solid #ccc; text-align: left; vertical-align: top; padding: 2px;\">API to use</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #ccc; text-align: left; vertical-align: top; padding: 2px;\">Send a standalone request that does not need earlier messages as context.</td>\n<td style=\"border: 1px solid #ccc; text-align: left; vertical-align: top; padding: 2px;\"><strong>Messages API</strong></td>\n</tr>\n<tr>\n<td style=\"border: 1px solid #ccc; text-align: left; vertical-align: top; padding: 2px;\">Send follow-up messages that build on earlier messages.</td>\n<td style=\"border: 1px solid #ccc; text-align: left; vertical-align: top; padding: 2px;\"><strong>Conversations API</strong></td>\n</tr>\n</tbody>\n</table>\n<p>The Messages API creates a temporary conversation for each request. The Conversations API keeps conversation history between requests.</p>\n<h2 id=\"before-you-start\">Before you start</h2>\n<ol>\n<li>Open the assistant for editing.</li>\n<li>Under <strong>Automation &amp; API</strong>, select <strong>API Keys</strong>.</li>\n<li>Find the <strong>Assistant ID</strong> and <strong>Base URL</strong> under <strong>API Essential Information</strong>.</li>\n<li>Select <strong>Download OpenAPI Definition</strong> under <strong>Messages API</strong> or <strong>Conversations API</strong>, depending on your task.</li>\n<li>Prepare the credentials your integration will use.</li>\n</ol>\n<p>If your requests use a personal access token and need an external service, such as Microsoft 365, sign in to that service through the assistant’s tools in Theta Assist before using the API.</p>\n<h2 id=\"authenticate-your-requests\">Authenticate your requests</h2>\n<p>The Conversations API uses the same integration API key as the Messages API. Send the key in the <code>Api-Key</code> header.</p>\n<p>The Conversations API also accepts a personal access token in that header. When you use a personal access token, the conversation runs as the token owner, using their connected accounts.</p>\n<p>For a personal access token to work:</p>\n<ul>\n<li>The token must include the assistant.</li>\n<li>The token owner must still have access to the assistant.</li>\n<li>The assistant must allow personal access tokens.</li>\n<li>The token must not have expired or been revoked.</li>\n</ul>\n<p>See <a href=\"https://help.thetaassist.ai/article/create-and-manage-personal-access-tokens\">Create and manage personal access tokens</a> for token instructions.</p>\n<p>Keep credentials private. Do not put real keys or tokens in prompts, shared examples, screenshots or support requests.</p>\n<h2 id=\"send-a-one-off-message\">Send a one-off message</h2>\n<p>Use the Messages API when you need a response to a standalone request.</p>\n<ol>\n<li>Open the Messages API OpenAPI definition.</li>\n<li>Build a request using the documented message fields.</li>\n<li>Include any optional attachments in the format specified by the definition.</li>\n<li>Send the request to the documented endpoint, using your base URL and credentials.</li>\n<li>Read the assistant’s response.</li>\n</ol>\n<p>The API creates a temporary conversation, processes the request and returns the assistant’s response.</p>\n<p>Use the Conversations API instead if your next request needs earlier messages as context.</p>\n<h2 id=\"start-and-continue-a-conversation\">Start and continue a conversation</h2>\n<p>Replace <code>{assistantId}</code> and <code>{conversationId}</code> in the paths below with the relevant IDs. Use your base URL before each path.</p>\n<h3 id=\"start-a-conversation\">Start a conversation</h3>\n<ol>\n<li>Send a <code>POST</code> request to:<br><code>/api/assistants/{assistantId}/conversations</code></li>\n<li>Include a message to run the first turn, or send an empty JSON object (<code>{}</code>) to create a conversation without a message.</li>\n<li>Keep the conversation ID returned by the API for subsequent requests.</li>\n<li>Check the response for <code>pendingApprovals</code> and <code>expiresAtUtc</code>.</li>\n</ol>\n<p>Use the OpenAPI definition for the exact message structure and the response field containing the conversation ID.</p>\n<h3 id=\"send-a-follow-up-message\">Send a follow-up message</h3>\n<ol>\n<li>Send a <code>POST</code> request to:<br><code>/api/assistants/{assistantId}/conversations/{conversationId}/messages</code></li>\n<li>Include your next message using the documented request format.</li>\n<li>Read the response and check for pending approvals.</li>\n</ol>\n<p>The assistant uses earlier messages in that conversation as context. You do not need to start a new conversation for each follow-up.</p>\n<h2 id=\"handle-tool-approvals\">Handle tool approvals</h2>\n<p>Some MCP tools require approval before they can run.</p>\n<p>When the assistant requests one of these tools, the turn pauses and the response lists the tool call in <code>pendingApprovals</code>.</p>\n<ol>\n<li>Check the response for pending approvals.</li>\n<li>Review each tool call and decide whether to approve or deny it.</li>\n<li>Send your decision to:<br><code>/api/assistants/{assistantId}/conversations/{conversationId}/approvals</code><br>using the <code>POST</code> method.</li>\n<li>Pass the same <code>modelSettings</code> as the message request.</li>\n<li>Check the continued response for any further pending approvals.</li>\n</ol>\n<p>Use the OpenAPI definition for the approval identifiers and decision fields.</p>\n<p><strong>Do not send another message while approvals are pending.</strong> New messages are rejected with HTTP <code>409</code> until none remain.</p>\n<h2 id=\"read-or-delete-a-conversation\">Read or delete a conversation</h2>\n<h3 id=\"read-the-transcript\">Read the transcript</h3>\n<p>Send a <code>GET</code> request to:</p>\n<p><code>/api/assistants/{assistantId}/conversations/{conversationId}</code></p>\n<p>This returns the transcript so far, with user and assistant turns as text.</p>\n<p>Reading the transcript does not extend the conversation’s expiry.</p>\n<h3 id=\"delete-a-conversation\">Delete a conversation</h3>\n<p>Send a <code>DELETE</code> request to:</p>\n<p><code>/api/assistants/{assistantId}/conversations/{conversationId}</code></p>\n<p>This ends the conversation and deletes its messages, files and generated artefacts. Save anything your integration needs before deleting it.</p>\n<h2 id=\"manage-expiry-and-concurrent-requests\">Manage expiry and concurrent requests</h2>\n<h3 id=\"conversation-expiry\">Conversation expiry</h3>\n<p>A conversation expires after <strong>24 hours without a message</strong>.</p>\n<ul>\n<li>Every message extends the expiry.</li>\n<li>The response returns the current expiry as <code>expiresAtUtc</code>.</li>\n<li>Reading the transcript does not extend the expiry.</li>\n<li>Expired conversations are deleted, along with files they produced.</li>\n</ul>\n<p>Use <code>expiresAtUtc</code> to track the current expiry rather than assuming it remains unchanged.</p>\n<h3 id=\"concurrent-requests\">Concurrent requests</h3>\n<p>Only one message can be in progress in a conversation at a time.</p>\n<p>Wait for the current message to finish before sending another message to the same conversation. A second concurrent message is rejected with HTTP <code>409</code>.</p>\n<h2 id=\"troubleshoot-requests\">Troubleshoot requests</h2>\n<h3 id=\"a-message-returns-http-409\">A message returns HTTP 409</h3>\n<p>Check whether:</p>\n<ul>\n<li>Another message is still being processed in the same conversation.</li>\n<li>The conversation has pending tool approvals.</li>\n</ul>\n<p>Wait for processing to finish, or resolve the pending approvals, before sending another message.</p>\n<h3 id=\"a-personal-access-token-stops-working\">A personal access token stops working</h3>\n<p>Check that the token has not expired or been revoked, still includes the assistant, and its owner retains access.</p>\n<p>Also check that <strong>Allow personal access tokens</strong> remains turned on for the assistant. Turning it off immediately blocks personal access tokens from calling that assistant.</p>\n<h3 id=\"a-conversation-has-expired\">A conversation has expired</h3>\n<p>Start a new conversation. Do not rely on an expired conversation to retain earlier messages or generated files.</p>\n<p>&nbsp;</p></body></html>","description":"Choose the Messages API for one-off requests or the Conversations API for follow-up messages. Learn how to authenticate requests, handle tool approvals, read and delete conversations, and manage expiry.","isMarkdown":false,"publishedOnUtc":"2026-10-28T23:54:52.5248562","modifiedOnUtc":"2026-10-28T23:10:09.0003924"}