# Retrieve details for a business rule

`GET /api/business-rules/{id}`

- **Success:** `200 OK`
- **Products:** Operator (`FOH`)
- **Features:** Front of House Generic Access (`FOHGENERIC`)

HTML version: [Retrieve details for a business rule](https://support.gladstonesoftware.cloud/reference/bookings/retrieve-details-for-a-business-rule)

## Overview

Retrieves one business rule with its full configuration: the trigger that fires it, its actions, the conditions that select an action, and the results each action produces.

Read this alongside [List all business rules](list-all-business-rules.md), which gives you the ids but omits everything below `isActive`.

How a rule behaves at runtime, which is what the nested structure encodes: when the trigger fires for a member, the rule's **conditional** actions — those with `isDefault` false — are tested in ascending `priority`, then ascending id, and the first one whose conditions the member matches is picked. If none match, or the rule has no conditional actions, the **default** action is used instead. Exactly one action runs per rule per event, and then every entry in that action's `results` executes.

## Endpoint

`GET {base_url}/api/business-rules/{id}`

`{base_url}` is the environment URL issued to your integration. See [Authenticating with Gladstone APIs](../../guides/authenticating-with-gladstone-apis.md).

## Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer (int32) | Yes | The rule to retrieve, as returned in `[].id` by [List all business rules](list-all-business-rules.md). An id that does not exist returns `404`. |

## Sample request

```bash title="cURL"
curl -X GET '{base_url}/api/business-rules/{id}' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true'
```

## Response fields

| Field | Type | Description |
|-------|------|-------------|
| `id` | integer (int32) | The rule's identifier — the same value you sent in the path. |
| `description` | string | The rule's own description, as entered by whoever configured it. Rules have no separate name, so this is what identifies the rule to a human. |
| `isActive` | boolean | Whether the rule runs. Only active rules run when their trigger fires; an inactive rule is still returned in full here but its actions never execute. |
| `trigger` | object | The platform event that fires this rule. Exactly one per rule. Several rules may share a trigger, and when it fires every active one of them runs — they are not mutually exclusive. |
| `trigger.id` | integer (int32) | The trigger's identifier. Always a positive integer. |
| `trigger.name` | string | The trigger's name. This is the value the list endpoint returns as `[].name`, which is why that field looks like a rule name but is not one. |
| `trigger.description` | string | A longer description of the event, for display. |
| `actions` | array of object | The candidate responses to the trigger. Only **one** of them runs each time the rule fires — see the selection order in the Overview — so this array is a set of alternatives, not a list of steps. |
| `actions[].description` | string | The action's description. Always populated: it is a required field when a rule is created or updated. |
| `actions[].priority` | integer (int32) | The order in which conditional actions are tested, lowest first; ties are broken by the action's internal id. Ignored for the default action. |
| `actions[].isDefault` | boolean | `true` marks the fallback used when no conditional action matches the member, in which case `conditions` and `priority` carry no weight. `false` marks a conditional action, which runs only if the member matches all of its `conditions`. If several actions are flagged default, the one with the lowest internal id wins. |
| `actions[].conditions` | array of object | Tests the member must satisfy for this action to be chosen. Empty for a default action. Keep the count per action small — every conditional action adds a separate check each time the trigger fires. |
| `actions[].conditions[].fieldName` | string | The field tested, drawn from the platform's list of permitted condition fields. Arbitrary names cannot be used: only fields configured as condition fields are accepted. |
| `actions[].conditions[].tableName` | string | The table `fieldName` belongs to. Conditions can span member, booking and financial data, which is why a rule can test things far from the triggering event. |
| `actions[].conditions[].conditional` | string | The comparison operator. One of `=`, `<>`, `>`, `<`, `>=`, `<=`, `IN`, `NOT IN`, `LIKE`, `NOT LIKE` — anything else is rejected when the rule is saved. |
| `actions[].conditions[].value` | string | The value compared against, always carried as a string regardless of the field's underlying type. Never null: it is required when a rule is saved. |
| `actions[].results` | array of object | What the action actually does. Unlike `actions`, these are not alternatives — every result of the selected action runs. Never empty: an action must have at least one result to be saved. |
| `actions[].results[].type` | string | The kind of result. `email` and `webhook` are recognised, matched case-insensitively, and these determine which of `templates` and `webhooks` is populated. |
| `actions[].results[].templates` | array of integer | Ids of the email templates sent by this result. Populated only when `type` is `email`; **null** for any other type, not an empty array. |
| `actions[].results[].webhooks` | array of integer | Ids of the webhooks called by this result. Populated only when `type` is `webhook`; **null** for any other type, not an empty array. |
| `actions[].results[].description` | string | The description of the result's type, taken from the action-type configuration rather than entered per result. Two results of the same type therefore share a description. |

## Sample response

```json title="200 OK"
{
  "id": 12345,
  "description": "string",
  "isActive": true,
  "trigger": {
    "id": 12345,
    "name": "string",
    "description": "string"
  },
  "actions": [
    {
      "description": "string",
      "priority": 1,
      "isDefault": true,
      "conditions": [
        {
          "fieldName": "string",
          "tableName": "string",
          "conditional": "string",
          "value": "string"
        }
      ],
      "results": [
        {
          "type": "string",
          "templates": [
            1
          ],
          "webhooks": [
            1
          ],
          "description": "string"
        }
      ]
    }
  ]
}
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `404` | Not found | No rule with that id exists: `Business Rule Id {id} doesn't exist`. |
| `500` | Internal server error | An unexpected server-side failure while reading the rule. The response is a bare `500` with no body. A permissions problem also surfaces here rather than as a clearer error. |
