Ai Draft Requests Controller create
curl --request POST \
--url https://api.raul.ugps.io/api/v1/ai/draft-requests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"target": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"instructions": "<string>"
}
'import requests
url = "https://api.raul.ugps.io/api/v1/ai/draft-requests"
payload = {
"target": { "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" },
"instructions": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({target: {id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}, instructions: '<string>'})
};
fetch('https://api.raul.ugps.io/api/v1/ai/draft-requests', 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.raul.ugps.io/api/v1/ai/draft-requests",
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([
'target' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'instructions' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.raul.ugps.io/api/v1/ai/draft-requests"
payload := strings.NewReader("{\n \"target\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"instructions\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.raul.ugps.io/api/v1/ai/draft-requests")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"target\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"instructions\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.raul.ugps.io/api/v1/ai/draft-requests")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"target\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"instructions\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "QUEUED",
"version": 123,
"deadlineAt": "2023-11-07T05:31:56Z",
"target": {
"type": "thread",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"format": "email",
"failure": {
"code": "generation_unavailable",
"provider": "minimax",
"problem": "missing"
},
"draft": {
"body": "<string>",
"subject": "<string>",
"operatorNote": "<string>",
"reviewDecision": "INCOMPLETE",
"generationRunId": "<string>"
},
"metrics": {
"tokensPrompt": 123,
"tokensCompletion": 123,
"generationTimeMs": 123,
"costUsd": 123,
"modelUsed": "<string>",
"promptVersion": "<string>",
"verdict": "machine_verified"
}
}IA - Solicitudes de borrador
Ai Draft Requests Controller create
POST
/
api
/
v1
/
ai
/
draft-requests
Ai Draft Requests Controller create
curl --request POST \
--url https://api.raul.ugps.io/api/v1/ai/draft-requests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"target": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"instructions": "<string>"
}
'import requests
url = "https://api.raul.ugps.io/api/v1/ai/draft-requests"
payload = {
"target": { "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" },
"instructions": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({target: {id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}, instructions: '<string>'})
};
fetch('https://api.raul.ugps.io/api/v1/ai/draft-requests', 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.raul.ugps.io/api/v1/ai/draft-requests",
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([
'target' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'instructions' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.raul.ugps.io/api/v1/ai/draft-requests"
payload := strings.NewReader("{\n \"target\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"instructions\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.raul.ugps.io/api/v1/ai/draft-requests")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"target\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"instructions\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.raul.ugps.io/api/v1/ai/draft-requests")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"target\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"instructions\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "QUEUED",
"version": 123,
"deadlineAt": "2023-11-07T05:31:56Z",
"target": {
"type": "thread",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"format": "email",
"failure": {
"code": "generation_unavailable",
"provider": "minimax",
"problem": "missing"
},
"draft": {
"body": "<string>",
"subject": "<string>",
"operatorNote": "<string>",
"reviewDecision": "INCOMPLETE",
"generationRunId": "<string>"
},
"metrics": {
"tokensPrompt": 123,
"tokensCompletion": 123,
"generationTimeMs": 123,
"costUsd": 123,
"modelUsed": "<string>",
"promptVersion": "<string>",
"verdict": "machine_verified"
}
}Authorizations
Token de sesión Better Auth para rutas de backoffice; las rutas de portal usan su token propio.
Headers
UUID v4 estable por intención
Body
application/json
Show child attributes
Show child attributes
Formato de redacción
Available options:
email, whatsapp, internal Indicaciones propias del operador (contexto, tono)
Maximum string length:
4000Sólo con el formato internal: campo que llena el texto (nota, descripción, tarea, resultado de la tarea o motivo del cambio de etapa); sin él, una nota
Available options:
note, description, task, task_result, stage_reason Compositor o campo de la web que pide el borrador; sólo etiqueta la traza de IA (no cambia el texto ni la idempotencia). En una llamada delegada se ignora
Available options:
inbox_reply, inbox_note, email_composer, whatsapp_composer, quote_editor, ticket_conversation, activity_form, meeting_form, task_form, record_field Response
Available options:
QUEUED, PREPARING, DECIDING, COMPOSING, REVIEWING, DRAFT_READY, NEEDS_OPERATOR, FAILED, CANCELLED, STALE Límite de la solicitud en segundo plano
Show child attributes
Show child attributes
Available options:
email, whatsapp, internal Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes