Presets de relatórios
curl --request GET \
--url http://api.gu1.ai/report-presets \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--header 'X-Organization-ID: <x-organization-id>' \
--data '
{
"name": "<string>",
"description": "<string>",
"templateCode": "<string>",
"params": {},
"delivery": "<string>",
"recipientEmails": [
"<string>"
],
"format": "<string>"
}
'import requests
url = "http://api.gu1.ai/report-presets"
payload = {
"name": "<string>",
"description": "<string>",
"templateCode": "<string>",
"params": {},
"delivery": "<string>",
"recipientEmails": ["<string>"],
"format": "<string>"
}
headers = {
"Authorization": "<authorization>",
"X-Organization-ID": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
Authorization: '<authorization>',
'X-Organization-ID': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
description: '<string>',
templateCode: '<string>',
params: {},
delivery: '<string>',
recipientEmails: ['<string>'],
format: '<string>'
})
};
fetch('http://api.gu1.ai/report-presets', 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 => "http://api.gu1.ai/report-presets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'templateCode' => '<string>',
'params' => [
],
'delivery' => '<string>',
'recipientEmails' => [
'<string>'
],
'format' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"X-Organization-ID: <x-organization-id>"
],
]);
$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 := "http://api.gu1.ai/report-presets"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"templateCode\": \"<string>\",\n \"params\": {},\n \"delivery\": \"<string>\",\n \"recipientEmails\": [\n \"<string>\"\n ],\n \"format\": \"<string>\"\n}")
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("X-Organization-ID", "<x-organization-id>")
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.get("http://api.gu1.ai/report-presets")
.header("Authorization", "<authorization>")
.header("X-Organization-ID", "<x-organization-id>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"templateCode\": \"<string>\",\n \"params\": {},\n \"delivery\": \"<string>\",\n \"recipientEmails\": [\n \"<string>\"\n ],\n \"format\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/report-presets")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
request["X-Organization-ID"] = '<x-organization-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"templateCode\": \"<string>\",\n \"params\": {},\n \"delivery\": \"<string>\",\n \"recipientEmails\": [\n \"<string>\"\n ],\n \"format\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyPresets de relatórios
Salve configurações editáveis de modelos Gu1 por organização para download em um clique e automações send_report.
GET
/
report-presets
Presets de relatórios
curl --request GET \
--url http://api.gu1.ai/report-presets \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--header 'X-Organization-ID: <x-organization-id>' \
--data '
{
"name": "<string>",
"description": "<string>",
"templateCode": "<string>",
"params": {},
"delivery": "<string>",
"recipientEmails": [
"<string>"
],
"format": "<string>"
}
'import requests
url = "http://api.gu1.ai/report-presets"
payload = {
"name": "<string>",
"description": "<string>",
"templateCode": "<string>",
"params": {},
"delivery": "<string>",
"recipientEmails": ["<string>"],
"format": "<string>"
}
headers = {
"Authorization": "<authorization>",
"X-Organization-ID": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
Authorization: '<authorization>',
'X-Organization-ID': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
description: '<string>',
templateCode: '<string>',
params: {},
delivery: '<string>',
recipientEmails: ['<string>'],
format: '<string>'
})
};
fetch('http://api.gu1.ai/report-presets', 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 => "http://api.gu1.ai/report-presets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'templateCode' => '<string>',
'params' => [
],
'delivery' => '<string>',
'recipientEmails' => [
'<string>'
],
'format' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"X-Organization-ID: <x-organization-id>"
],
]);
$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 := "http://api.gu1.ai/report-presets"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"templateCode\": \"<string>\",\n \"params\": {},\n \"delivery\": \"<string>\",\n \"recipientEmails\": [\n \"<string>\"\n ],\n \"format\": \"<string>\"\n}")
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("X-Organization-ID", "<x-organization-id>")
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.get("http://api.gu1.ai/report-presets")
.header("Authorization", "<authorization>")
.header("X-Organization-ID", "<x-organization-id>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"templateCode\": \"<string>\",\n \"params\": {},\n \"delivery\": \"<string>\",\n \"recipientEmails\": [\n \"<string>\"\n ],\n \"format\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/report-presets")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
request["X-Organization-ID"] = '<x-organization-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"templateCode\": \"<string>\",\n \"params\": {},\n \"delivery\": \"<string>\",\n \"recipientEmails\": [\n \"<string>\"\n ],\n \"format\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyOverview
Um preset de relatório guarda uma configuração de modelo de relatório Gu1 para sua organização (name + templateCode + params). Após criar, você pode editar name, description e params; o templateCode fica fixo. Também pode listar, obter, executar ou excluir.
| Método | Path | Uso |
|---|---|---|
GET | /report-presets | Listar presets da org |
GET | /report-presets/{id} | Detalhe |
POST | /report-presets | Criar (nome + modelo + params) |
PATCH | /report-presets/{id} | Atualizar nome, descrição e/ou params |
DELETE | /report-presets/{id} | Exclusão definitiva |
POST | /report-presets/{id}/run | Executar com params salvos (download ou email) |
jobId). Baixe depois em Relatórios Downloads / Jobs de exportação de relatórios. Os params podem incluir emailLocale, format (csv / pdf / xlsx conforme o modelo) e outros campos (lookbackDays, ruleIds, filters).
Autenticação e tenant
string
required
Bearer YOUR_API_KEY — ver Autenticação.Permissões
| Endpoint | Permissão granular |
|---|---|
GET list / get | reports:read |
POST create / run, PATCH, DELETE | reports:export |
Criar
POST http://api.gu1.ai/report-presets
string
required
Nome visível (1–120 caracteres). Deve ser único na organização (sem distinguir maiúsculas).
string
Nota opcional para sua equipe (máx. 500 caracteres).
string
required
Código do catálogo Gu1 (por exemplo
alerts_by_rules).object
Params do modelo (
lookbackDays, ruleIds, emailLocale, format, filters, etc.). Validados contra o modelo.paramsSummary legível (nomes de regras, janela) para a UI. Ao executar, usam-se os UUIDs vivos de params; regras inexistentes são omitidas pelo runner.
Exemplo
{
"name": "Total contas CBU/CVU",
"description": "Revisão operacional mensal",
"templateCode": "alerts_by_rules",
"params": {
"lookbackDays": 30,
"ruleIds": ["aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"]
}
}
Resposta 201
{
"success": true,
"preset": {
"id": "…",
"organizationId": "…",
"name": "Total contas CBU/CVU",
"templateCode": "alerts_by_rules",
"params": { "lookbackDays": 30, "ruleIds": ["…"] },
"paramsSummary": {
"lookbackDays": 30,
"ruleLabels": ["Total de contas"],
"lines": ["Últimos 30 dias", "Regras: Total de contas"]
},
"createdAt": "2026-08-06T12:00:00.000Z"
}
}
Erros
| Código | Status | Significado |
|---|---|---|
REPORT_TEMPLATE_NOT_FOUND | 400 | templateCode desconhecido |
REPORT_PRESET_NAME_EXISTS | 409 | Nome duplicado na org |
REPORT_PRESET_LIMIT | 400 | Limite de 50 atingido |
REPORT_PRESET_NOT_FOUND | 404 | Id desconhecido para esta org |
Atualizar
PATCH http://api.gu1.ai/report-presets/{id}
name, description ou params é obrigatório. Não é possível alterar templateCode. Os params são revalidados contra o modelo existente.
string
Novo nome (1–120). Deve continuar único na org.
string
Nova descrição (máx. 500) ou
null para limpar.object
Params completos a persistir (substituição, não merge parcial de chaves omitidas).
Executar
POST http://api.gu1.ai/report-presets/{id}/run
POST /report-templates/{code}/run com os params salvos.
string
download (default) ou email.string[]
Obrigatório quando
delivery é email.string
Opcional:
csv, xlsx ou pdf (deve ser suportado pelo modelo). Se omitido, usa params.format ou o default do modelo.presetId). Sempre enfileira um job em segundo plano. Consulte ou baixe via Jobs de exportação de relatórios.
Automações
Em Relatórios, Agendar abre o builder comreportPresetId (canônico). Use a ação send_report / Gerar relatório com reportPresetId e opcionalmente sendEmail + recipientEmails; o legado reportTemplateCode + params continua funcionando.Was this page helpful?