Skip to main content
POST
/
conversations
Iniciar conversación IA
curl --request POST \
  --url https://api.linahealthcareplatform.com/api/v1/conversations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "patientId": "<string>",
  "context": "<string>"
}
'
import requests

url = "https://api.linahealthcareplatform.com/api/v1/conversations"

payload = {
"patientId": "<string>",
"context": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({patientId: '<string>', context: '<string>'})
};

fetch('https://api.linahealthcareplatform.com/api/v1/conversations', 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.linahealthcareplatform.com/api/v1/conversations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'patientId' => '<string>',
'context' => '<string>'
]),
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.linahealthcareplatform.com/api/v1/conversations"

payload := strings.NewReader("{\n \"patientId\": \"<string>\",\n \"context\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", 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.post("https://api.linahealthcareplatform.com/api/v1/conversations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"patientId\": \"<string>\",\n \"context\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.linahealthcareplatform.com/api/v1/conversations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"patientId\": \"<string>\",\n \"context\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "conv_abc123",
  "patientId": "pat_xyz789",
  "context": "Seguimiento post-operatorio. Preguntar por dolor, movilidad y estado general.",
  "language": "es",
  "status": "active",
  "messages": [
    {
      "id": "msg_001",
      "role": "assistant",
      "content": "Hola María, soy LINA, tu asistente de salud. ¿Cómo te encuentras hoy?",
      "createdAt": "2026-05-14T10:00:00Z"
    }
  ],
  "creditsConsumed": 10,
  "createdAt": "2026-05-14T10:00:00Z"
}

Body

patientId
string
required
ID del paciente con quien iniciar la conversación.
context
string
required
Contexto e instrucciones para la IA. Define el propósito de la conversación, tono y límites.
language
string
default:"es"
Idioma de la conversación. Valores: es (español), en (inglés), ca (catalán).
Iniciar una conversación consume 10 créditos. Cada mensaje posterior consume 1 crédito.
{
  "id": "conv_abc123",
  "patientId": "pat_xyz789",
  "context": "Seguimiento post-operatorio. Preguntar por dolor, movilidad y estado general.",
  "language": "es",
  "status": "active",
  "messages": [
    {
      "id": "msg_001",
      "role": "assistant",
      "content": "Hola María, soy LINA, tu asistente de salud. ¿Cómo te encuentras hoy?",
      "createdAt": "2026-05-14T10:00:00Z"
    }
  ],
  "creditsConsumed": 10,
  "createdAt": "2026-05-14T10:00:00Z"
}
id
string
Identificador único de la conversación con prefijo conv_.
status
string
Estado de la conversación: active o ended.
messages
array
Mensajes de la conversación. Al inicio contiene el primer mensaje de bienvenida de la IA.

Authorizations

Authorization
string
header
required

Token JWT obtenido via POST /auth/token

Body

application/json
patientId
string
required
context
string
language
enum<string>
Available options:
es,
en,
ca

Response

201 - application/json

Conversación iniciada

id
string
patientId
string
status
string
messages
object[]
createdAt
string<date-time>