Guardar la conversación entera al terminar un turno
curl --request PUT \
--url https://api.ugps.io/api/assistant/conversations/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"id": "msg_8f3a",
"parts": [
{
"type": "text"
}
],
"createdAt": "2026-11-02T12:00:00.000Z"
}
]
}
'import requests
url = "https://api.ugps.io/api/assistant/conversations/{id}"
payload = { "messages": [
{
"id": "msg_8f3a",
"parts": [{ "type": "text" }],
"createdAt": "2026-11-02T12:00:00.000Z"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [
{id: 'msg_8f3a', parts: [{type: 'text'}], createdAt: '2026-11-02T12:00:00.000Z'}
]
})
};
fetch('https://api.ugps.io/api/assistant/conversations/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ugps.io/api/assistant/conversations/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'messages' => [
[
'id' => 'msg_8f3a',
'parts' => [
[
'type' => 'text'
]
],
'createdAt' => '2026-11-02T12:00:00.000Z'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ugps.io/api/assistant/conversations/{id}"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"id\": \"msg_8f3a\",\n \"parts\": [\n {\n \"type\": \"text\"\n }\n ],\n \"createdAt\": \"2026-11-02T12:00:00.000Z\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.ugps.io/api/assistant/conversations/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"id\": \"msg_8f3a\",\n \"parts\": [\n {\n \"type\": \"text\"\n }\n ],\n \"createdAt\": \"2026-11-02T12:00:00.000Z\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/assistant/conversations/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"id\": \"msg_8f3a\",\n \"parts\": [\n {\n \"type\": \"text\"\n }\n ],\n \"createdAt\": \"2026-11-02T12:00:00.000Z\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "27b7d741-4d0e-4f7e-9c2a-3f1b2c4d5e6f",
"title": "¿Qué activos no reportan hoy?",
"preview": "Tres activos llevan más de un día sin reportar.",
"lastMessageAt": "2026-11-02T12:00:30.000Z",
"messageCount": 2
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"error": "No tiene permisos para realizar esta acción"
}{
"status": "failed",
"code": "ASSISTANT_CONVERSATION_NOT_FOUND",
"message": "La conversación no existe o ya se borró."
}{
"status": "failed",
"code": "ASSISTANT_CONVERSATION_NOT_FOUND",
"message": "La conversación no existe o ya se borró."
}{
"message": "Error interno del servidor"
}Asistente
Guardar la conversación entera al terminar un turno
La llama el servidor del Asistente (@atlas/mcp) con el bearer de la persona: upsert por el
id (UUID v4) que generó la web al arrancar la conversación. Quien abre el panel y no
pregunta no deja nada en Mongo.
Comportamiento:
titlese fija al crearla con la primera pregunta recortada a 60 caracteres;preview(la última respuesta, 160 caracteres) ylastMessageAt(hora del último mensaje) se recalculan en cada guardado.- Los mensajes son
UIMessagedel AI SDK ya validados por el mcp, concreatedAtpor mensaje y el título de cada herramienta en su parte. 409 ASSISTANT_CONVERSATION_FULLsi supera los 200 mensajes: la web ofrece una conversación nueva. Un id que ya es de otra persona responde404.
PUT
/
api
/
assistant
/
conversations
/
{id}
Guardar la conversación entera al terminar un turno
curl --request PUT \
--url https://api.ugps.io/api/assistant/conversations/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"id": "msg_8f3a",
"parts": [
{
"type": "text"
}
],
"createdAt": "2026-11-02T12:00:00.000Z"
}
]
}
'import requests
url = "https://api.ugps.io/api/assistant/conversations/{id}"
payload = { "messages": [
{
"id": "msg_8f3a",
"parts": [{ "type": "text" }],
"createdAt": "2026-11-02T12:00:00.000Z"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [
{id: 'msg_8f3a', parts: [{type: 'text'}], createdAt: '2026-11-02T12:00:00.000Z'}
]
})
};
fetch('https://api.ugps.io/api/assistant/conversations/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ugps.io/api/assistant/conversations/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'messages' => [
[
'id' => 'msg_8f3a',
'parts' => [
[
'type' => 'text'
]
],
'createdAt' => '2026-11-02T12:00:00.000Z'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ugps.io/api/assistant/conversations/{id}"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"id\": \"msg_8f3a\",\n \"parts\": [\n {\n \"type\": \"text\"\n }\n ],\n \"createdAt\": \"2026-11-02T12:00:00.000Z\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.ugps.io/api/assistant/conversations/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"id\": \"msg_8f3a\",\n \"parts\": [\n {\n \"type\": \"text\"\n }\n ],\n \"createdAt\": \"2026-11-02T12:00:00.000Z\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/assistant/conversations/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"id\": \"msg_8f3a\",\n \"parts\": [\n {\n \"type\": \"text\"\n }\n ],\n \"createdAt\": \"2026-11-02T12:00:00.000Z\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "27b7d741-4d0e-4f7e-9c2a-3f1b2c4d5e6f",
"title": "¿Qué activos no reportan hoy?",
"preview": "Tres activos llevan más de un día sin reportar.",
"lastMessageAt": "2026-11-02T12:00:30.000Z",
"messageCount": 2
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"error": "No tiene permisos para realizar esta acción"
}{
"status": "failed",
"code": "ASSISTANT_CONVERSATION_NOT_FOUND",
"message": "La conversación no existe o ya se borró."
}{
"status": "failed",
"code": "ASSISTANT_CONVERSATION_NOT_FOUND",
"message": "La conversación no existe o ya se borró."
}{
"message": "Error interno del servidor"
}Authorizations
Token de sesión Better Auth o API token (atk_...) en el header Authorization: Bearer <token>. Los JWT legacy ya no son válidos.
Path Parameters
UUID v4 generado por la web al arrancar la conversación
Body
application/json
Required array length:
1 - 200 elementsShow child attributes
Show child attributes
Response
Resumen de lo guardado
Example:
"27b7d741-4d0e-4f7e-9c2a-3f1b2c4d5e6f"
La primera pregunta, recortada a 60 caracteres
Example:
"¿Qué activos no reportan hoy?"
La última respuesta del Asistente, recortada a 160 caracteres
Example:
"Tres activos llevan más de un día sin reportar."
Example:
"2026-11-02T12:00:30.000Z"
Example:
2

