curl --request GET \
--url https://api.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules', 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.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"ErrorMessage": "<string>",
"ErrorCode": 123,
"Result": [
{
"Id": 123,
"Name": "<string>",
"Description": "<string>",
"RewardType": 0,
"RewardValue": 123,
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z",
"PurchaseAmount": {
"MinimumAmount": 123,
"MaximumAmount": 123
},
"MinimumOrderValue": 123,
"DaysToGrantPoints": 123,
"ExpirationDays": 123,
"ShowOnWidgetAndLandingPage": true,
"CardTitle": "<string>",
"CardDescription": "<string>",
"IconUrl": "<string>",
"ActionButtonText": "<string>",
"ActionButtonUrl": "<string>",
"Segments": [
{
"Name": "<string>",
"Tag": "<string>"
}
]
}
],
"Code": "<string>",
"CodeName": "<string>",
"Severity": 0,
"HasWarning": true,
"HasError": true
}Returns the advanced rules currently available to a customer because of the customer segments they belong to.
Use this endpoint to show a customer the benefits and campaigns targeted at their profile, such as on a landing page.
It is a dedicated lookup: the customer data endpoint (GET /v1/pvt/Customer/{id}) keeps returning only the customer’s segments, not their rules.
Which rules are returned
A rule is listed only when all of the following are true:
- the rule is active and the current date is within its validity period (
StartDate/EndDate); - the rule is restricted to customer segments, and the customer belongs to at least one of those segments;
- that segment is active;
- the rule still has participations left, when it has a participation limit.
Draft, paused, scheduled and completed rules are never returned. Rules that are not restricted to segments are not returned either, since they apply to every customer.
Empty list
A customer that does not belong to any active segment, or whose segments have no rule available right now, returns HTTP 200 with an empty result list.
The list is also empty when the store’s plan does not include advanced rules.
Order conditions
A listed rule is available to the customer, but each order must still meet the rule’s own conditions to be rewarded.
purchaseAmount (amount spent) and minimumOrderValue are returned; the other conditions (such as products, brands, categories, stores, payment methods and sales channels) are not part of this response.
Response
Rules are ordered from the oldest to the newest. Each rule lists in segments only the customer’s segments that made it available, with the same name and tag returned by the customer data endpoint.
cardTitle and cardDescription replicate the rule’s name and description, as the BonifiQ widget does.
If the customer is not found, returns HTTP 404 with hasError: true and errorMessage: "Customer not found".
curl --request GET \
--url https://api.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules', 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.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bonifiq.com.br/v1/pvt/Customer/{id}/segmentrules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"ErrorMessage": "<string>",
"ErrorCode": 123,
"Result": [
{
"Id": 123,
"Name": "<string>",
"Description": "<string>",
"RewardType": 0,
"RewardValue": 123,
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z",
"PurchaseAmount": {
"MinimumAmount": 123,
"MaximumAmount": 123
},
"MinimumOrderValue": 123,
"DaysToGrantPoints": 123,
"ExpirationDays": 123,
"ShowOnWidgetAndLandingPage": true,
"CardTitle": "<string>",
"CardDescription": "<string>",
"IconUrl": "<string>",
"ActionButtonText": "<string>",
"ActionButtonUrl": "<string>",
"Segments": [
{
"Name": "<string>",
"Tag": "<string>"
}
]
}
],
"Code": "<string>",
"CodeName": "<string>",
"Severity": 0,
"HasWarning": true,
"HasError": true
}Authorizations
Use API Basic Auth Keys
Path Parameters
Id from the client`s store, usually email address
Response
Customer found; returns the available rules, which may be an empty list.
Standard response envelope used by the External API.
Error message returned when the request fails validation or processing.
For warnings and successful responses, consumers should usually inspect Result, Code and Severity first.
Legacy numeric error code derived from internal API errors when available.
This field is relevant only for error flows that use ApiResponseErrorDescription.
Business payload returned by the endpoint.
Show child attributes
Show child attributes
Endpoint-specific business code formatted as a two-digit string, such as 03 or 07.
This field is available for success, warning and error outcomes.
Symbolic enum name associated with Code, such as CheckoutNotFound.
Final severity of the response.
Success means the action completed as expected, Warning means the request was valid but the business outcome is informational or non-ideal, and Error means the request should be treated as a failure.
0, 1, 2 Convenience flag that is true when Severity is Warning.
Warnings are valid 200 OK business outcomes and should not be handled as transport or validation errors.
Indicates whether the request failed and should be handled as an error response.
This flag is reserved for real API errors; warnings must keep this property as false.
Was this page helpful?