> For the complete documentation index, see [llms.txt](https://apis.rightrev.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apis.rightrev.com/rightrev-rest-api/policy-sets/configuration/revenue-policies/revenue-rules.md).

# Revenue Rules

## Get Revenue Rules Policy

> To retrieve the Advanced (Rules Builder) and By Product Revenue Rules created in the system.<br>

```json
{"openapi":"3.1.0","info":{"title":"RightRev API(s)","version":"1.0.0"},"servers":[{"description":"RightRev APP Server","url":"https://{realm}.{env}.rightrev.cloud/","variables":{"env":{"default":"{env}"},"realm":{"default":"{realm}"}}},{"description":"RightRev Auth Server","url":"https://authn.{env}.rightrev.cloud/auth/realms/{realm}/protocol/openid-connect/","variables":{"env":{"default":"{env}"},"realm":{"default":"{realm}"}}}],"security":[],"paths":{"/apis/policy-sets/v1/policy/revenue-rules":{"get":{"description":"To retrieve the Advanced (Rules Builder) and By Product Revenue Rules created in the system.\n","responses":{"200":{"description":"Get Revenue Rules Policy","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"compliance_id":{"type":"string","description":"A system-generated compliance ID to retrieve the Revenue Rules Policies"},"compliance_name":{"type":"string","description":"Name of the policy fetched by the system."},"compliance_spec":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"array","items":{"type":"object","properties":{"active":{"type":"boolean","description":"A boolean field indicating whether the policy is Active or not. If set to True, the policy is Active; if false, it's Inactive."},"can_delete":{"type":"boolean","description":"A boolean field indicating whether the policy can be deleted or not. If set to True, the user is allowed to delete the policy; if False, deletion is not permitted."},"created_at":{"type":"integer","description":"Timestamp of the policy created by the user. This is a unix Epoch timestamp format."},"created_by":{"type":"string","description":"ID of the user who created the policy. Example: username@rightrev.com"},"distribution_date_method":{"type":"string","description":"It's method of distribution of prior period revenue. It could be CATCHUP, CONDENSED, SLIDING."},"distribution_method":{"type":"string","description":"It's method of revenue distribution. It could be POINTINTIME or PRORATE"},"hybrid_rules":{"type":"null","description":"Is it a Hybrid Revenue Rule? If Yes, need to provide these details -  distribution_date_method, distribution_method , formula, prorate_method, revenue account, revenue_trigger"},"is_user_defined":{"type":"boolean","description":"A boolean field indicating whether the policy is defined by the user or not. If set to True, the user is allowed to define the policy; if False, defining the policy is not permitted."},"name":{"type":"string","description":"Name of the Revenue Rule policy"},"pob_type":{"type":"string","description":"Is this performance obligation DISTINCT or NON-DISTINCT"},"prorate_method":{"type":"null","description":"Is it Days in Calendar Period or PRORATE. User need to configure this in Tenant level under functionality controls."},"revenue_trigger":{"type":"string","description":"The is revenue release trigger. Values can Booking, Billing, User Defined Events, Manual or Hybrid."},"rule_type":{"type":"string","description":"Is it Advance (Rules Builder) or By Product Rule"},"sequence_no":{"type":"integer","description":"A system assigned numeric value that represents the order in which a revenue rule policy was created, with higher numbers indicating more recently created policies."},"updated_at":{"type":"integer","description":"Timestamp of the policy updated by the user. This is a unix Epoch timestamp format"},"updated_by":{"type":"string","description":"ID of the user who updated the policy. Example: username@rightrev.com"},"user_defined_event":{"type":"null","description":"Name of the Event policy assigned to Revenue Rule to release the revenue."},"when":{"type":"array","description":"This is the criteria on the basis of which Revenue Rule should get applied."}},"required":["active","can_delete","created_at","created_by","distribution_date_method","distribution_method","hybrid_rules","is_user_defined","name","pob_type","prorate_method","revenue_trigger","rule_type","sequence_no","updated_at","updated_by","user_defined_event","when"]},"description":"This is description of the revenue rule"}},"required":["rule"]},"description":"Defines the specific rules and standards where a system must process adhering to the compliant."},"created_by":{"type":"string","description":"ID of the user who created the policy. Example: username@rightrev.com"},"created_on":{"type":"integer","description":"Timestamp of the policy created by the user. This is a unix Epoch timestamp format"},"last_modified_by":{"type":"string","description":"ID of the user last modified by"},"last_modified_on":{"type":"integer","description":"Timestamp of the policy last modified on. This is a unix Epoch timestamp format"},"last_used":{"type":"null","description":"When the policy used. Value here should be Null"},"policy_type":{"type":"string","description":"Represents the type of policy"},"status":{"type":"string","description":"Represents the status of the policy"},"unique_key":{"type":"string","description":"Name of the Policy"},"version_id":{"type":"string","description":"Unique alpha-numeric number generated by the system"}},"required":["compliance_id","compliance_name","compliance_spec","created_by","created_on","last_modified_by","last_modified_on","last_used","policy_type","status","unique_key","version_id"]}}}}}},"tags":["Policy Sets"],"summary":"Get Revenue Rules Policy","operationId":"get_revenue_rules_policy_apis_policy_sets_v1_policy_revenue_rules_get"}}}}
```

## Patch Revenue Rules Policy

> To create new Revenue Rule or to update existing Revenue Rule.<br>

```json
{"openapi":"3.1.0","info":{"title":"RightRev API(s)","version":"1.0.0"},"servers":[{"description":"RightRev APP Server","url":"https://{realm}.{env}.rightrev.cloud/","variables":{"env":{"default":"{env}"},"realm":{"default":"{realm}"}}},{"description":"RightRev Auth Server","url":"https://authn.{env}.rightrev.cloud/auth/realms/{realm}/protocol/openid-connect/","variables":{"env":{"default":"{env}"},"realm":{"default":"{realm}"}}}],"security":[],"paths":{"/apis/policy-sets/v1/policy/revenue-rules/{compliance_id}":{"patch":{"description":"To create new Revenue Rule or to update existing Revenue Rule.\n","parameters":[{"name":"compliance_id","in":"path","required":true,"schema":{"type":"string","title":"Compliance Id"},"description":"A system-generated compliance ID to edit the revenue rule policy\n"}],"responses":{"200":{"description":"Update Revenue Rules Policy","content":{"application/json":{"schema":{"type":"object","properties":{"compliance_details":{"type":"array","items":{"type":"object","properties":{"error":{"type":"array","description":"Displays information about problems that occurred while handling the request. Commonly used to report validation errors, missing or invalid parameters, or other issues related to API processing."},"message":{"type":"string","description":"Displays the outcome of the action. It is commonly used to provide success confirmations, error details, or other informational responses from the API after the operation is executed."},"unique_key":{"type":"string","description":"Name of the Revenue Rule policy created/updated."}},"required":["error","message","unique_key"]},"description":"Displays the details of specific rules and standards processed by the system."},"compliance_id":{"type":"string","description":"A system-generated compliance ID to create or edit the event policy."},"error":{"type":"array","description":"Displays information about problems that occurred while handling the request. Commonly used to report validation errors, missing or invalid parameters, or other issues related to API processing."}},"required":["compliance_details","compliance_id","error"]}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"compliance_spec":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Name of the Revenue Rule to be created."},"pob_type":{"type":"string","description":"User has to provide whether performance obligation is DISTINCT or NON-DISTINCT"},"prorate_method":{"type":"null","description":"User has to provide whether it is Days in Calendar Period or PRORATE."},"sequence_no":{"type":"integer","description":"User has to assigned numeric value that represents the order in which a revenue rule policy is getting created."},"active":{"type":"boolean","description":"A boolean field indicating whether the policy is Active or not. If set to True, the policy is Active; if false, it's Inactive."},"distribution_date_method":{"type":"string","description":"User has to provide a method of distribution of prior period revenue. It could be CATCHUP, CONDENSED, SLIDING."},"distribution_method":{"type":"string","description":"User has to provide a method of revenue distribution. It could be POINTINTIME or PRORATE"},"rule_type":{"type":"string","description":"User has to provide whether it is Advance (Rules Builder) or By Product Rule"},"user_defined_event":{"type":"null","description":"User has to provide a name of the Event policy assigned to Revenue Rule where revenue trigger is upon USER DEFINED EVENTS to release the revenue."},"revenue_trigger":{"type":"string","description":"User has to provide what is revenue release trigger. Values can Booking, Billing, User Defined Events, Manual or Hybrid"},"when":{"type":"array","items":{"type":"object","properties":{"field_name":{"type":"string","description":"Name of the field on which Revenue Rule should get assigned. For e.g. Product Name or Product ID"},"operator":{"type":"string","description":"A set of comparison conditions used to evaluate field values in a revenue rule policy, allowing users to filter or match data using equality, inequality, relational comparisons (>, <, >=, <=), list based checks (in, not in), text pattern matching (contains, not contains, starts with, ends with), and null/empty validations (null, not null)."},"value":{"type":"string","description":"Value on which Revenue Rule should get applied. For e.g. If Filed Name is Product ID then Value could be Hardware or Software"}},"required":["field_name","operator","value"]},"description":"This is the criteria on the basis of which Revenue Rule should get applied."},"is_user_defined":{"type":"boolean","description":"A boolean field indicating whether the policy is defined by the user or not. If set to True, the user has created the policy; if False, created by system and not by user."},"can_delete":{"type":"boolean","description":"A boolean field indicating whether the policy can be deleted or not. If set to True, the user is allowed to delete the policy; if False, deletion is not permitted"}},"required":["active","can_delete","distribution_date_method","distribution_method","is_user_defined","name","pob_type","prorate_method","revenue_trigger","rule_type","sequence_no","user_defined_event","when"]},"description":"This is description of the revenue rule"}},"required":["rule"]},"description":"Defines the specific rules and standards where a system must process adhering to the compliant."},"format_type":{"type":"string","description":"Format type of the request code used to collect data - For e.g. JSON "},"compliance_name":{"type":"string","description":"Name of the Revenue Rule Policy either By Product or Advance"},"unique_key":{"type":"string","description":"Name of the Revenue Rule Policy"}},"required":["compliance_name","compliance_spec","format_type","unique_key"]}}},"required":true},"tags":["Policy Sets"],"summary":"Patch Revenue Rules Policy","operationId":"patch_revenue_rules_policy_apis_policy_sets_v1_policy_revenue_rules__compliance_id__patch"}}}}
```

## Delete Revenue Rules Policy

> To delete the Revenue Rule policies from system. User can delete only those policies which are not consumed.<br>

```json
{"openapi":"3.1.0","info":{"title":"RightRev API(s)","version":"1.0.0"},"servers":[{"description":"RightRev APP Server","url":"https://{realm}.{env}.rightrev.cloud/","variables":{"env":{"default":"{env}"},"realm":{"default":"{realm}"}}},{"description":"RightRev Auth Server","url":"https://authn.{env}.rightrev.cloud/auth/realms/{realm}/protocol/openid-connect/","variables":{"env":{"default":"{env}"},"realm":{"default":"{realm}"}}}],"security":[],"paths":{"/apis/policy-sets/v1/policy/revenue-rules/{compliance_id}/{object_unique_value}":{"delete":{"description":"To delete the Revenue Rule policies from system. User can delete only those policies which are not consumed.\n","parameters":[{"name":"compliance_id","in":"path","required":true,"schema":{"type":"string","title":"Compliance Id"},"description":"User has to provide compliance id to delete the policy\n"},{"name":"object_unique_value","in":"path","required":true,"schema":{"type":"string","title":"Object Unique Value"},"description":"Name of the Revenue Rule policy to be deleted.\n"}],"responses":{"200":{"description":"Delete Revenue Rules Policy","content":{"application/json":{"schema":{"type":"object","properties":{"compliance_details":{"type":"array","description":"Displays the details of specific rules and standards processed by the system"},"compliance_id":{"type":"string","description":"Displays a system-generated compliance ID associated with revenue rule policy to be deleted"},"error":{"type":"array","description":"Displays information about problems that occurred while handling the request. Commonly used to report validation errors, missing or invalid parameters, or other issues related to API processing."}},"required":["compliance_details","compliance_id","error"]}}}}},"tags":["Policy Sets"],"summary":"Delete Revenue Rules Policy","operationId":"delete_revenue_rules_policy_apis_policy_sets_v1_policy_revenue_rules__compliance_id___object_unique_value__delete"}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://apis.rightrev.com/rightrev-rest-api/policy-sets/configuration/revenue-policies/revenue-rules.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
