---
title: "Branch"
description: "Optimize policy statements with the branch condition, matched by ID, title, or alias using regex. (Gitana 4.0)"
product: "Gitana"
version: "4.0"
url: "/documentation/gitana/4.0/engine/access-policies/conditions/branch"
---

# Branch

The `branch` condition allows you to constrain a policy statement so that it applies to nodes and/or associations that are on a matching branch. The branch can be matched using its ID (`_doc`), `title` or `alias`.

This condition supports regular expressions, allowing you to focus in on a single value or wildcard expressions for matches.

## Configuration

To match a branch by ID:

```
{
    "type": "branch",
    "config": {
        "id": "{value regex}"
    }
}
```

To match a branch by Title:

```
{
    "type": "branch",
    "config": {
        "title": "{value regex}"
    }
}
```

To match a branch by Alias:

```
{
    "type": "branch",
    "config": {
        "alias": "{value regex}"
    }
}
```

## Samples

This policy document grants the Consumer role to a specific piece of content if it resides within the branch with ID `46ba5e0d79b83aac97ec`.

```
{
    "title": "My Sample Policy",
    "statements": [{
        "action": "grant",
        "roles": ["consumer"],
        "conditions": [{
            "type": "branch",
            "config": {
                "id": "46ba5e0d79b83aac97ec"
            }
        }]
    }]
}
```
