Create an offer
curl --request POST \
--url https://app.flextell.ai/api/v1/offers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Tenant: <x-tenant>' \
--data '
{
"currency_id": 123,
"exchange_rate": 1,
"valid_until": "2023-11-07T05:31:56Z",
"items": [
{
"itemable_id": 2,
"quantity": 1.0001,
"unit_price": 1,
"discount_amount": 1,
"discount_percentage": 50,
"sub_total": 1,
"total_discount": 1,
"total_tax": 1,
"total_price": 1,
"order": 1
}
],
"customer_id": 123,
"lead_id": 123,
"user_id": 123,
"notes": "<string>"
}
'import requests
url = "https://app.flextell.ai/api/v1/offers"
payload = {
"currency_id": 123,
"exchange_rate": 1,
"valid_until": "2023-11-07T05:31:56Z",
"items": [
{
"itemable_id": 2,
"quantity": 1.0001,
"unit_price": 1,
"discount_amount": 1,
"discount_percentage": 50,
"sub_total": 1,
"total_discount": 1,
"total_tax": 1,
"total_price": 1,
"order": 1
}
],
"customer_id": 123,
"lead_id": 123,
"user_id": 123,
"notes": "<string>"
}
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({
currency_id: 123,
exchange_rate: 1,
valid_until: '2023-11-07T05:31:56Z',
items: [
{
itemable_id: 2,
quantity: 1.0001,
unit_price: 1,
discount_amount: 1,
discount_percentage: 50,
sub_total: 1,
total_discount: 1,
total_tax: 1,
total_price: 1,
order: 1
}
],
customer_id: 123,
lead_id: 123,
user_id: 123,
notes: '<string>'
})
};
fetch('https://app.flextell.ai/api/v1/offers', 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/offers",
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([
'currency_id' => 123,
'exchange_rate' => 1,
'valid_until' => '2023-11-07T05:31:56Z',
'items' => [
[
'itemable_id' => 2,
'quantity' => 1.0001,
'unit_price' => 1,
'discount_amount' => 1,
'discount_percentage' => 50,
'sub_total' => 1,
'total_discount' => 1,
'total_tax' => 1,
'total_price' => 1,
'order' => 1
]
],
'customer_id' => 123,
'lead_id' => 123,
'user_id' => 123,
'notes' => '<string>'
]),
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/offers"
payload := strings.NewReader("{\n \"currency_id\": 123,\n \"exchange_rate\": 1,\n \"valid_until\": \"2023-11-07T05:31:56Z\",\n \"items\": [\n {\n \"itemable_id\": 2,\n \"quantity\": 1.0001,\n \"unit_price\": 1,\n \"discount_amount\": 1,\n \"discount_percentage\": 50,\n \"sub_total\": 1,\n \"total_discount\": 1,\n \"total_tax\": 1,\n \"total_price\": 1,\n \"order\": 1\n }\n ],\n \"customer_id\": 123,\n \"lead_id\": 123,\n \"user_id\": 123,\n \"notes\": \"<string>\"\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/offers")
.header("X-Tenant", "<x-tenant>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"currency_id\": 123,\n \"exchange_rate\": 1,\n \"valid_until\": \"2023-11-07T05:31:56Z\",\n \"items\": [\n {\n \"itemable_id\": 2,\n \"quantity\": 1.0001,\n \"unit_price\": 1,\n \"discount_amount\": 1,\n \"discount_percentage\": 50,\n \"sub_total\": 1,\n \"total_discount\": 1,\n \"total_tax\": 1,\n \"total_price\": 1,\n \"order\": 1\n }\n ],\n \"customer_id\": 123,\n \"lead_id\": 123,\n \"user_id\": 123,\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.flextell.ai/api/v1/offers")
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 \"currency_id\": 123,\n \"exchange_rate\": 1,\n \"valid_until\": \"2023-11-07T05:31:56Z\",\n \"items\": [\n {\n \"itemable_id\": 2,\n \"quantity\": 1.0001,\n \"unit_price\": 1,\n \"discount_amount\": 1,\n \"discount_percentage\": 50,\n \"sub_total\": 1,\n \"total_discount\": 1,\n \"total_tax\": 1,\n \"total_price\": 1,\n \"order\": 1\n }\n ],\n \"customer_id\": 123,\n \"lead_id\": 123,\n \"user_id\": 123,\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": "<string>",
"data": {
"id": 123,
"record_state": {
"is_read_only": true,
"reason_code": "<string>"
},
"tenant_id": 123,
"user_id": 123,
"customer_id": 123,
"sale_id": 123,
"currency_id": 123,
"exchange_rate": 123,
"valid_until": "2023-11-07T05:31:56Z",
"notes": "<string>",
"status": "<string>",
"is_locked": true,
"can_convert": true,
"total_price": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"customer": {
"id": 123,
"record_state": {
"is_read_only": true,
"reason_code": "<string>"
},
"first_name": "<string>",
"last_name": "<string>",
"phone_number": "<string>",
"email": "<string>",
"is_masked": true,
"is_lead_stage": true,
"lead_id": 123
},
"user": {
"id": 123,
"name": "<string>",
"avatar_url": "<string>"
},
"currency": {
"id": 123,
"code": "<string>",
"symbol": "<string>",
"name": "<string>"
},
"items": [
{
"id": 123,
"offer_id": 123,
"order": 123,
"itemable_type": "<string>",
"itemable_id": 123,
"quantity": 123,
"tax_rate": 123,
"unit_price": 123,
"discount_amount": 123,
"discount_percentage": 123,
"sub_total": 123,
"total_discount": 123,
"total_tax": 123,
"total_price": 123,
"itemable": {
"id": "<string>",
"name": "<string>"
}
}
]
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"success": false,
"error_code": "CUSTOMER_ERASED",
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"success": false,
"error_code": "SETUP_REQUIRED",
"message": "Complete the required setup steps to continue.",
"data": {
"next_step": "clinic_info"
}
}Satışlar ve teklifler
Create an offer
POST
/
v1
/
offers
Create an offer
curl --request POST \
--url https://app.flextell.ai/api/v1/offers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Tenant: <x-tenant>' \
--data '
{
"currency_id": 123,
"exchange_rate": 1,
"valid_until": "2023-11-07T05:31:56Z",
"items": [
{
"itemable_id": 2,
"quantity": 1.0001,
"unit_price": 1,
"discount_amount": 1,
"discount_percentage": 50,
"sub_total": 1,
"total_discount": 1,
"total_tax": 1,
"total_price": 1,
"order": 1
}
],
"customer_id": 123,
"lead_id": 123,
"user_id": 123,
"notes": "<string>"
}
'import requests
url = "https://app.flextell.ai/api/v1/offers"
payload = {
"currency_id": 123,
"exchange_rate": 1,
"valid_until": "2023-11-07T05:31:56Z",
"items": [
{
"itemable_id": 2,
"quantity": 1.0001,
"unit_price": 1,
"discount_amount": 1,
"discount_percentage": 50,
"sub_total": 1,
"total_discount": 1,
"total_tax": 1,
"total_price": 1,
"order": 1
}
],
"customer_id": 123,
"lead_id": 123,
"user_id": 123,
"notes": "<string>"
}
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({
currency_id: 123,
exchange_rate: 1,
valid_until: '2023-11-07T05:31:56Z',
items: [
{
itemable_id: 2,
quantity: 1.0001,
unit_price: 1,
discount_amount: 1,
discount_percentage: 50,
sub_total: 1,
total_discount: 1,
total_tax: 1,
total_price: 1,
order: 1
}
],
customer_id: 123,
lead_id: 123,
user_id: 123,
notes: '<string>'
})
};
fetch('https://app.flextell.ai/api/v1/offers', 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/offers",
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([
'currency_id' => 123,
'exchange_rate' => 1,
'valid_until' => '2023-11-07T05:31:56Z',
'items' => [
[
'itemable_id' => 2,
'quantity' => 1.0001,
'unit_price' => 1,
'discount_amount' => 1,
'discount_percentage' => 50,
'sub_total' => 1,
'total_discount' => 1,
'total_tax' => 1,
'total_price' => 1,
'order' => 1
]
],
'customer_id' => 123,
'lead_id' => 123,
'user_id' => 123,
'notes' => '<string>'
]),
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/offers"
payload := strings.NewReader("{\n \"currency_id\": 123,\n \"exchange_rate\": 1,\n \"valid_until\": \"2023-11-07T05:31:56Z\",\n \"items\": [\n {\n \"itemable_id\": 2,\n \"quantity\": 1.0001,\n \"unit_price\": 1,\n \"discount_amount\": 1,\n \"discount_percentage\": 50,\n \"sub_total\": 1,\n \"total_discount\": 1,\n \"total_tax\": 1,\n \"total_price\": 1,\n \"order\": 1\n }\n ],\n \"customer_id\": 123,\n \"lead_id\": 123,\n \"user_id\": 123,\n \"notes\": \"<string>\"\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/offers")
.header("X-Tenant", "<x-tenant>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"currency_id\": 123,\n \"exchange_rate\": 1,\n \"valid_until\": \"2023-11-07T05:31:56Z\",\n \"items\": [\n {\n \"itemable_id\": 2,\n \"quantity\": 1.0001,\n \"unit_price\": 1,\n \"discount_amount\": 1,\n \"discount_percentage\": 50,\n \"sub_total\": 1,\n \"total_discount\": 1,\n \"total_tax\": 1,\n \"total_price\": 1,\n \"order\": 1\n }\n ],\n \"customer_id\": 123,\n \"lead_id\": 123,\n \"user_id\": 123,\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.flextell.ai/api/v1/offers")
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 \"currency_id\": 123,\n \"exchange_rate\": 1,\n \"valid_until\": \"2023-11-07T05:31:56Z\",\n \"items\": [\n {\n \"itemable_id\": 2,\n \"quantity\": 1.0001,\n \"unit_price\": 1,\n \"discount_amount\": 1,\n \"discount_percentage\": 50,\n \"sub_total\": 1,\n \"total_discount\": 1,\n \"total_tax\": 1,\n \"total_price\": 1,\n \"order\": 1\n }\n ],\n \"customer_id\": 123,\n \"lead_id\": 123,\n \"user_id\": 123,\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": "<string>",
"data": {
"id": 123,
"record_state": {
"is_read_only": true,
"reason_code": "<string>"
},
"tenant_id": 123,
"user_id": 123,
"customer_id": 123,
"sale_id": 123,
"currency_id": 123,
"exchange_rate": 123,
"valid_until": "2023-11-07T05:31:56Z",
"notes": "<string>",
"status": "<string>",
"is_locked": true,
"can_convert": true,
"total_price": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"customer": {
"id": 123,
"record_state": {
"is_read_only": true,
"reason_code": "<string>"
},
"first_name": "<string>",
"last_name": "<string>",
"phone_number": "<string>",
"email": "<string>",
"is_masked": true,
"is_lead_stage": true,
"lead_id": 123
},
"user": {
"id": 123,
"name": "<string>",
"avatar_url": "<string>"
},
"currency": {
"id": 123,
"code": "<string>",
"symbol": "<string>",
"name": "<string>"
},
"items": [
{
"id": 123,
"offer_id": 123,
"order": 123,
"itemable_type": "<string>",
"itemable_id": 123,
"quantity": 123,
"tax_rate": 123,
"unit_price": 123,
"discount_amount": 123,
"discount_percentage": 123,
"sub_total": 123,
"total_discount": 123,
"total_tax": 123,
"total_price": 123,
"itemable": {
"id": "<string>",
"name": "<string>"
}
}
]
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"success": false,
"error_code": "CUSTOMER_ERASED",
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"success": false,
"error_code": "SETUP_REQUIRED",
"message": "Complete the required setup steps to continue.",
"data": {
"next_step": "clinic_info"
}
}Yetkilendirmeler
oauth2bearer
The access token received from the authorization server in the OAuth 2.0 flow.
Başlıklar
Tenant identifier. Send the Tenant ID in the X-Tenant header to scope API requests to a specific tenant.
Gövde
application/json
Currency ID.
Exchange rate (e.g. 1 or 34.5).
Gerekli aralık:
x >= 0Date until which the offer is valid.
Offer status: draft, sent, accepted, rejected.
Mevcut seçenekler:
draft, sent, accepted, rejected Offer line items. At least one item required.
Minimum array length:
1Show child attributes
Show child attributes
Customer ID. Must belong to current tenant.
Visible lead ID used as an alternative to customer_id.
User ID (optional, defaults to authenticated user).
Notes (optional).
Maximum string length:
65535