Attachments are temporary files the agent uses within a conversation: a spreadsheet with students, a PDF with a contract, a photo. They aren't part of the agent's knowledge; that's what documents are for.
Endpoint
POST https://csevfgnqeweymrgebayc.supabase.co/functions/v1/chat-attachmentsAuthorization: Bearer <TU_API_KEY>Content-Type: application/jsonUpload and use a file
Request an upload address
Send accion: "subir" with the file name. You receive ruta_storage, signed_url and content_type.
Upload the file
Make a PUT of the file to signed_url with the indicated Content-Type.
Process it
Send accion: "procesar" with its ruta_storage. Qaalia extracts its content only once.
Send it to the agent
Include adjuntos: [{ "ruta_storage": "…" }] in your request to the agents endpoint.
Full example
const API = "https://csevfgnqeweymrgebayc.supabase.co/functions/v1/chat-attachments"const headers = { Authorization: `Bearer ${process.env.QAALIA_API_KEY}`, "Content-Type": "application/json",}// 1. Pide una dirección de subidaconst subida = await fetch(API, { method: "POST", headers, body: JSON.stringify({ accion: "subir", filename: "alumnos.xlsx", tamano_bytes: archivo.size }),}).then((r) => r.json())// 2. Sube el archivoawait fetch(subida.signed_url, { method: "PUT", headers: { "Content-Type": subida.content_type }, body: archivo,})// 3. Procésalo una vezawait fetch(API, { method: "POST", headers, body: JSON.stringify({ accion: "procesar", ruta_storage: subida.ruta_storage }),})// 4. Envíalo al agenteawait fetch("https://csevfgnqeweymrgebayc.supabase.co/functions/v1/agent-chat", { method: "POST", headers, body: JSON.stringify({ mensaje: "Registra a todos los alumnos de este archivo", adjuntos: [{ ruta_storage: subida.ruta_storage }], }),})Actions
subiraction
Fields:
filename (required), mime_type and tamano_bytes. Responds with ruta_storage, token, signed_url and content_type.procesaraction
Fields:
ruta_storage (required) and filename. Extracts the content and returns the attachment's description.eliminaraction
Fields:
rutas, the list of files to delete before they expire.Formats and sizes
Attachments are deleted automatically after 24 hours, unless a task in progress still needs them.

