Skip to content
FacilydevelopersDashboard
Build with Facily
DocsREST APIsCreate Revenue Rule
Search the full API reference Esc to close

Create Revenue Rule

Pricing & rates · REST API reference

Get support
POST/v1/facilities/{facility_id}/revenue-rules
Create a rule and apply it now: every facility it covers is recomputed in the same transaction.

Authentication

Bearer API key or Facily session, subject to permissions and facility scope.

Authentication and scope

Request example

Replace bracketed path values with real IDs from your environment. The body, where shown, is generated from the schema and uses illustrative values.

cURL
curl --request POST \
  --url 'https://api.staging.facily.ai/v1/facilities/<FACILITY_ID>/revenue-rules' \
  --header "Authorization: Bearer $FACILY_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "string",
  "rule_type": "street",
  "trigger_kind": "always",
  "adjust_amount": 0,
  "adjust_direction": "increase",
  "adjust_unit": "percent",
  "facility_ids": [
    "00000000-0000-4000-8000-000000000001"
  ],
  "promotion_id": "00000000-0000-4000-8000-000000000001",
  "repeats_yearly": false,
  "scope_feature_name": "string",
  "scope_group_ids": [
    "00000000-0000-4000-8000-000000000001"
  ],
  "scope_kind": "all"
}'
An example for building your request, not an executed call. Check required fields, allowed values, and environment configuration before sending.

Parameters

facility_idpath · stringrequired

Format: uuid

Request body

application/json · Required

adjust_amountnumber | string | null

Size of the adjustment: a percentage of at most 50, or a dollar amount.

Pattern: ^(?!^[-+.]*$)[+-]?0*(?:\d{0,8}|(?=[\d.]{1,11}0*$)\d{0,8}\.\d{0,2}0*$)

Show adjust_amount schema
number | string | null

Size of the adjustment: a percentage of at most 50, or a dollar amount.

Variant 1: number
number
Variant 2: string
string
Variant 3: null
null
adjust_directionstring | null

Raise or lower the rate (price rules only).

Values: "increase", "decrease"

Show adjust_direction schema
string | null

Raise or lower the rate (price rules only).

Variant 1: string
string

Values: "increase", "decrease"

Variant 2: null
null
adjust_unitstring | null

percent or dollar; web rules take percent only.

Values: "percent", "dollar"

Show adjust_unit schema
string | null

percent or dollar; web rules take percent only.

Variant 1: string
string

Values: "percent", "dollar"

Variant 2: null
null
facility_idsstring[] | null

Facilities the rule covers. Omitted means the facility in the path; an empty list means every facility.

Show facility_ids schema
string[] | null

Facilities the rule covers. Omitted means the facility in the path; an empty list means every facility.

Variant 1: string[]
string[]
Variant 2: null
null
namestringrequired

What the rule is called.

Min length: 1 · Max length: 100

promotion_idstring | null

The promotion a promotion rule switches on.

Format: uuid

Show promotion_id schema
string | null

The promotion a promotion rule switches on.

Variant 1: string
string
Variant 2: null
null
repeats_yearlyboolean

Repeat the date window every year by month and day.

Default: false

rule_typestringrequired

street and seasonal rules adjust the street rate, web rules the online discount; a promotion rule switches a promotion on. competitive is reserved and refused.

Values: "street", "seasonal", "web", "promotion", "competitive"

scope_feature_namestring | null

The characteristic, for the characteristic scope. Case and spacing are ignored.

Max length: 100

Show scope_feature_name schema
string | null

The characteristic, for the characteristic scope. Case and spacing are ignored.

Variant 1: string
string
Variant 2: null
null
scope_group_idsstring[] | null

The unit groups, for the groups scope.

Show scope_group_ids schema
string[] | null

The unit groups, for the groups scope.

Variant 1: string[]
string[]
Variant 2: null
null
scope_kindstring

Which unit groups the rule considers: all, the listed groups, or a characteristic.

Default: "all" · Values: "all", "groups", "characteristic"

statusstring

active applies the rule; paused keeps it without applying it.

Default: "active" · Values: "active", "paused"

threshold_pctnumber | string | null

Occupancy percentage, for the occupancy triggers.

Pattern: ^(?!^[-+.]*$)[+-]?0*(?:\d{0,3}|(?=[\d.]{1,6}0*$)\d{0,3}\.\d{0,2}0*$)

Show threshold_pct schema
number | string | null

Occupancy percentage, for the occupancy triggers.

Variant 1: number
number
Variant 2: string
string
Variant 3: null
null
trigger_kindstringrequired

When the rule applies: always, while occupancy is below or above a threshold, or in a date window.

Values: "always", "occupancy_below", "occupancy_above", "date_window"

window_endstring | null

Last day of the date window, inclusive.

Format: date

Show window_end schema
string | null

Last day of the date window, inclusive.

Variant 1: string
string
Variant 2: null
null
window_startstring | null

First day of the date window, inclusive.

Format: date

Show window_start schema
string | null

First day of the date window, inclusive.

Variant 1: string
string
Variant 2: null
null

Responses

Expand a status to inspect its schema. Generated examples show structure and synthetic values.

201Successful Response
JSON · generated example
{
  "data": {
    "active_group_count": 0,
    "active_groups": [
      {
        "code": "string",
        "facility_id": "00000000-0000-4000-8000-000000000001",
        "id": "00000000-0000-4000-8000-000000000001",
        "name": "string"
      }
    ],
    "adjust_amount": "<VALUE_MATCHING_PATTERN>",
    "adjust_direction": "string",
    "adjust_unit": "string",
    "created_at": "2026-10-29T12:00:00Z",
    "created_by": "00000000-0000-4000-8000-000000000001",
    "display_status": "Active",
    "facility_ids": [
      "00000000-0000-4000-8000-000000000001"
    ],
    "id": "00000000-0000-4000-8000-000000000001",
    "last_activated_at": "2026-10-29T12:00:00Z",
    "name": "string",
    "promotion_id": "00000000-0000-4000-8000-000000000001",
    "promotion_name": "string",
    "repeats_yearly": false,
    "rule_type": "string",
    "scope_feature_name": "string",
    "scope_group_ids": [
      "00000000-0000-4000-8000-000000000001"
    ],
    "scope_kind": "string",
    "status": "string",
    "threshold_pct": "<VALUE_MATCHING_PATTERN>",
    "trigger_kind": "string",
    "updated_at": "2026-10-29T12:00:00Z",
    "window_end": "2026-10-29",
    "window_start": "2026-10-29"
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

dataRevenueRuleResponserequired

One pricing or promotion rule, with the unit groups it applies to now.

Show data schema
active_group_countintegerrequired

How many unit groups the rule applies to now.

active_groupsRevenueRuleActiveGroup[]required

The unit groups the rule applies to now.

Show active_groups schema
codestring | nullrequired

The group's code, where it has one.

Show code schema
string | null

The group's code, where it has one.

Variant 1: string
string
Variant 2: null
null
facility_idstringrequired

The facility the group belongs to.

Format: uuid

idstringrequired

The unit group's id.

Format: uuid

namestringrequired

The group's name.

adjust_amountstring | nullrequired

Size of the adjustment, for price rules.

Pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$

Show adjust_amount schema
string | null

Size of the adjustment, for price rules.

Variant 1: string
string
Variant 2: null
null
adjust_directionstring | nullrequired

increase or decrease, for price rules.

Show adjust_direction schema
string | null

increase or decrease, for price rules.

Variant 1: string
string
Variant 2: null
null
adjust_unitstring | nullrequired

percent or dollar, for price rules.

Show adjust_unit schema
string | null

percent or dollar, for price rules.

Variant 1: string
string
Variant 2: null
null
created_atstringrequired

When the rule was created.

Format: date-time

created_bystringrequired

Who created the rule.

Format: uuid

display_statusstringrequired

Active, Paused, or Expired once a one-off date window has ended.

Values: "Active", "Paused", "Expired"

facility_idsstring[]required

Facilities the rule covers; empty means every facility.

Show facility_ids schema
string
idstringrequired

The rule's id.

Format: uuid

last_activated_atstring | nullrequired

When the rule last started applying to a unit group.

Format: date-time

Show last_activated_at schema
string | null

When the rule last started applying to a unit group.

Variant 1: string
string
Variant 2: null
null
namestringrequired

What the rule is called.

promotion_idstring | nullrequired

The promotion a promotion rule switches on.

Format: uuid

Show promotion_id schema
string | null

The promotion a promotion rule switches on.

Variant 1: string
string
Variant 2: null
null
promotion_namestring | nullrequired

That promotion's name.

Show promotion_name schema
string | null

That promotion's name.

Variant 1: string
string
Variant 2: null
null
repeats_yearlybooleanrequired

Whether the date window repeats every year.

rule_typestringrequired

street, seasonal, web or promotion.

scope_feature_namestring | nullrequired

The characteristic, for the characteristic scope.

Show scope_feature_name schema
string | null

The characteristic, for the characteristic scope.

Variant 1: string
string
Variant 2: null
null
scope_group_idsstring[] | nullrequired

The unit groups, for the groups scope.

Show scope_group_ids schema
string[] | null

The unit groups, for the groups scope.

Variant 1: string[]
string[]
Variant 2: null
null
scope_kindstringrequired

all, groups or characteristic.

statusstringrequired

active or paused.

threshold_pctstring | nullrequired

Occupancy percentage, for the occupancy triggers.

Pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$

Show threshold_pct schema
string | null

Occupancy percentage, for the occupancy triggers.

Variant 1: string
string
Variant 2: null
null
trigger_kindstringrequired

always, occupancy_below, occupancy_above or date_window.

updated_atstringrequired

When the rule last changed.

Format: date-time

window_endstring | nullrequired

Last day of the date window.

Format: date

Show window_end schema
string | null

Last day of the date window.

Variant 1: string
string
Variant 2: null
null
window_startstring | nullrequired

First day of the date window.

Format: date

Show window_start schema
string | null

First day of the date window.

Variant 1: string
string
Variant 2: null
null
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
400Validation error
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
401Unauthenticated
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
403Permission denied
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
404Not found
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
409Business logic error
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
503Temporary failure
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
Build something that works beautifully.

Facily API · Contract v1.200 · Reviewed October 29, 2026

Create Revenue Rule | Facily Developers