Customer

Returns the advanced rules currently available to a customer because of the customer segments they belong to.

Changed on

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".

get/v1/pvt/Customer/{id}/segmentrules

Request

  • Base URL
    https://api.bonifiq.com.br
  • Auth
    HTTP basic

Path parameters

idstring required

Id from the client`s store, usually email address

Response

Customer found; returns the available rules, which may be an empty list.

ErrorMessagestring nullable

Error message returned when the request fails validation or processing. For warnings and successful responses, consumers should usually inspect Result, Code and Severity first.

ErrorCodeinteger nullable

Legacy numeric error code derived from internal API errors when available. This field is relevant only for error flows that use ApiResponseErrorDescription.

Codestring nullable

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.

CodeNamestring nullable

Symbolic enum name associated with Code, such as CheckoutNotFound.

Severity0 | 1 | 2

0 = Success 1 = Warning 2 = Error

HasWarningboolean

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.

HasErrorboolean

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.

Changes