Generate a treatment description with AI
curl --request POST \
--url https://app.flextell.ai/api/v1/treatments/generate-description \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Tenant: <x-tenant>' \
--data '
{
"name": "<string>",
"price": 1,
"currency_id": 123,
"extra_info": {},
"sessions": [
{
"session_order": 2,
"next_gap_days": 2,
"products": [
{
"min_quantity": 1.0001,
"product_id": 2
}
]
}
]
}
'import requests
url = "https://app.flextell.ai/api/v1/treatments/generate-description"
payload = {
"name": "<string>",
"price": 1,
"currency_id": 123,
"extra_info": {},
"sessions": [
{
"session_order": 2,
"next_gap_days": 2,
"products": [
{
"min_quantity": 1.0001,
"product_id": 2
}
]
}
]
}
headers = {
"X-Tenant": "<x-tenant>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Tenant': '<x-tenant>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
price: 1,
currency_id: 123,
extra_info: {},
sessions: [
{
session_order: 2,
next_gap_days: 2,
products: [{min_quantity: 1.0001, product_id: 2}]
}
]
})
};
fetch('https://app.flextell.ai/api/v1/treatments/generate-description', 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://app.flextell.ai/api/v1/treatments/generate-description",
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([
'name' => '<string>',
'price' => 1,
'currency_id' => 123,
'extra_info' => [
],
'sessions' => [
[
'session_order' => 2,
'next_gap_days' => 2,
'products' => [
[
'min_quantity' => 1.0001,
'product_id' => 2
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Tenant: <x-tenant>"
],
]);
$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://app.flextell.ai/api/v1/treatments/generate-description"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"price\": 1,\n \"currency_id\": 123,\n \"extra_info\": {},\n \"sessions\": [\n {\n \"session_order\": 2,\n \"next_gap_days\": 2,\n \"products\": [\n {\n \"min_quantity\": 1.0001,\n \"product_id\": 2\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tenant", "<x-tenant>")
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://app.flextell.ai/api/v1/treatments/generate-description")
.header("X-Tenant", "<x-tenant>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"price\": 1,\n \"currency_id\": 123,\n \"extra_info\": {},\n \"sessions\": [\n {\n \"session_order\": 2,\n \"next_gap_days\": 2,\n \"products\": [\n {\n \"min_quantity\": 1.0001,\n \"product_id\": 2\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.flextell.ai/api/v1/treatments/generate-description")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tenant"] = '<x-tenant>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"price\": 1,\n \"currency_id\": 123,\n \"extra_info\": {},\n \"sessions\": [\n {\n \"session_order\": 2,\n \"next_gap_days\": 2,\n \"products\": [\n {\n \"min_quantity\": 1.0001,\n \"product_id\": 2\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"text": "<string>",
"source": "<string>"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"success": true,
"error_code": "<string>",
"message": "<string>"
}Treatment
Generate a treatment description with AI
Drafts a description from the unsaved treatment form; nothing is stored. When the AI returns
no text, a description assembled from the given fields is returned with source: fallback.
POST
/
v1
/
treatments
/
generate-description
Generate a treatment description with AI
curl --request POST \
--url https://app.flextell.ai/api/v1/treatments/generate-description \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Tenant: <x-tenant>' \
--data '
{
"name": "<string>",
"price": 1,
"currency_id": 123,
"extra_info": {},
"sessions": [
{
"session_order": 2,
"next_gap_days": 2,
"products": [
{
"min_quantity": 1.0001,
"product_id": 2
}
]
}
]
}
'import requests
url = "https://app.flextell.ai/api/v1/treatments/generate-description"
payload = {
"name": "<string>",
"price": 1,
"currency_id": 123,
"extra_info": {},
"sessions": [
{
"session_order": 2,
"next_gap_days": 2,
"products": [
{
"min_quantity": 1.0001,
"product_id": 2
}
]
}
]
}
headers = {
"X-Tenant": "<x-tenant>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Tenant': '<x-tenant>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
price: 1,
currency_id: 123,
extra_info: {},
sessions: [
{
session_order: 2,
next_gap_days: 2,
products: [{min_quantity: 1.0001, product_id: 2}]
}
]
})
};
fetch('https://app.flextell.ai/api/v1/treatments/generate-description', 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://app.flextell.ai/api/v1/treatments/generate-description",
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([
'name' => '<string>',
'price' => 1,
'currency_id' => 123,
'extra_info' => [
],
'sessions' => [
[
'session_order' => 2,
'next_gap_days' => 2,
'products' => [
[
'min_quantity' => 1.0001,
'product_id' => 2
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Tenant: <x-tenant>"
],
]);
$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://app.flextell.ai/api/v1/treatments/generate-description"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"price\": 1,\n \"currency_id\": 123,\n \"extra_info\": {},\n \"sessions\": [\n {\n \"session_order\": 2,\n \"next_gap_days\": 2,\n \"products\": [\n {\n \"min_quantity\": 1.0001,\n \"product_id\": 2\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tenant", "<x-tenant>")
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://app.flextell.ai/api/v1/treatments/generate-description")
.header("X-Tenant", "<x-tenant>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"price\": 1,\n \"currency_id\": 123,\n \"extra_info\": {},\n \"sessions\": [\n {\n \"session_order\": 2,\n \"next_gap_days\": 2,\n \"products\": [\n {\n \"min_quantity\": 1.0001,\n \"product_id\": 2\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.flextell.ai/api/v1/treatments/generate-description")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tenant"] = '<x-tenant>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"price\": 1,\n \"currency_id\": 123,\n \"extra_info\": {},\n \"sessions\": [\n {\n \"session_order\": 2,\n \"next_gap_days\": 2,\n \"products\": [\n {\n \"min_quantity\": 1.0001,\n \"product_id\": 2\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"text": "<string>",
"source": "<string>"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"success": true,
"error_code": "<string>",
"message": "<string>"
}Yetkilendirmeler
oauth2bearer
Başlıklar
Gövde
application/json