# TaggableSections

## Introduction

`TaggableSections` define the different areas or modules in the system where tags can be assigned and managed. They are used to restrict, group, or organize tags for specific use cases.

A `TaggableSection` can have restrictions on which [Tags](/api-reference/tags/tags.md) or [TagGroups](/api-reference/tags/tag-groups.md) are allowed, and can define a default [TagGroup](/api-reference/tags/tag-groups.md) to use when creating [Tags](/api-reference/tags/tags.md) for that section.

## Model Definition

### Alias

`taggableSection`

### Relations

| Key                   | Relation                                      | Type          | Relation Field(s)                                                                                  |
| --------------------- | --------------------------------------------- | ------------- | -------------------------------------------------------------------------------------------------- |
| `defaultTagGroup`     | [TagGroup](/api-reference/tags/tag-groups.md) | Belongs to    | `default_tag_group_id`                                                                             |
| `restrictedTags`      | [Tag](/api-reference/tags/tags.md)            | Morph to many | `taggable_section_restrictbale.restrictable_type`, `taggable_section_restrictbale.restrictable_id` |
| `restrictedTagGroups` | [TagGroup](/api-reference/tags/tag-groups.md) | Morph to many | `taggable_section_restrictbale.restrictable_type`, `taggable_section_restrictbale.restrictable_id` |

### Available Sections

* `departments` - The allowed [Tags](/api-reference/tags/tags.md) for [Departments](/api-reference/departments.md).
* `infoboard` - The allowed [Tags](/api-reference/tags/tags.md) for [InfoboardPosts](/api-reference/infoboard/infoboard-posts.md).
* `manual` - The allowed [Tags](/api-reference/tags/tags.md) for [ManualChapters](/api-reference/manual/manual-chapters.md) and [ManualEntries](/api-reference/manual/manual-entries.md).
* `roles` - The allowed [Tags](/api-reference/tags/tags.md) for [Roles](/api-reference/roles.md).

## List

Get a list of all `TaggableSections` the current authenticated [User](/api-reference/users.md) is allowed to view.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/tags/sections`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/tags/sections', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    "id": "departments",
    "allow_all": true,
    "default_tag_group_id": null,
    "created_at": "2019-06-15 12:00:00",
    "updated_at": "2019-06-15 12:00:00"
  },
  {
    "id": "infoboard",
    "allow_all": true,
    "default_tag_group_id": null,
    "created_at": "2019-06-15 12:00:00",
    "updated_at": "2019-06-15 12:00:00"
  },
  {
    "id": "manual",
    "allow_all": true,
    "default_tag_group_id": null,
    "created_at": "2019-06-15 12:00:00",
    "updated_at": "2019-06-15 12:00:00"
  },
  {
    "id": "roles",
    "allow_all": true,
    "default_tag_group_id": null,
    "created_at": "2019-06-15 12:00:00",
    "updated_at": "2019-06-15 12:00:00"
  }
]
```

## Show

Show a single `TaggableSection` by `id`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/tags/sections/{taggableSection}`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/tags/sections/infoboard', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "id": "infoboard",
  "allow_all": true,
  "default_tag_group_id": null,
  "created_at": "2019-06-15 12:00:00",
  "updated_at": "2019-06-15 12:00:00"
}
```

## \[Adm.] List

Get a list of all `TaggableSections`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/administration/tags/sections`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/administration/tags/sections', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    "id": "departments",
    "allow_all": true,
    "default_tag_group_id": null,
    "created_at": "2019-06-15 12:00:00",
    "updated_at": "2019-06-15 12:00:00"
  },
  {
    "id": "infoboard",
    "allow_all": true,
    "default_tag_group_id": null,
    "created_at": "2019-06-15 12:00:00",
    "updated_at": "2019-06-15 12:00:00"
  },
  {
    "id": "manual",
    "allow_all": true,
    "default_tag_group_id": null,
    "created_at": "2019-06-15 12:00:00",
    "updated_at": "2019-06-15 12:00:00"
  },
  {
    "id": "roles",
    "allow_all": true,
    "default_tag_group_id": null,
    "created_at": "2019-06-15 12:00:00",
    "updated_at": "2019-06-15 12:00:00"
  }
]
```

## \[Adm.] Show

Get a single `TaggableSection` by `id`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/administration/tags/sections/{taggableSection}`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/administration/tags/sections/departments', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "id": "departments",
  "allow_all": true,
  "default_tag_group_id": null,
  "created_at": "2019-06-15 12:00:00",
  "updated_at": "2019-06-15 12:00:00"
}
```

## Update

Update a `TaggableSection` by `id`.

**Definition**

<mark style="color:blue;">`PUT`</mark> `/api/administration/tags/sections/{taggableSection}`

**Request Keys**

| Key                        | Type    | Description                                                                                                                     |
| -------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `allow_all`                | boolean | Whether all [Tags](/api-reference/tags/tags.md) are allowed for this section.                                                   |
| `default_tag_group_id`     | integer | The ID of the default [TagGroup](/api-reference/tags/tag-groups.md) for this section.                                           |
| `restricted_tag_ids`       | array   | Array of [Tag](/api-reference/tags/tags.md) IDs to restrict to this section.                                                    |
| `restricted_tag_group_ids` | array   | Array of objects with `id` ([TagGroup](/api-reference/tags/tag-groups.md) ID) and `recursive` (boolean) for group restrictions. |

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/administration/tags/sections/infoboard', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'allow_all' => false,
        'default_tag_group_id' => 2,
        'restricted_tag_ids' => [1, 2],
        'restricted_tag_group_ids' => [
            ['id' => 2, 'recursive' => true]
        ]
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": "infoboard",
    "allow_all": false,
    "default_tag_group_id": 2,
    "created_at": "2019-06-15 12:00:00",
    "updated_at": "2019-06-15 12:30:00"
  }
}
```


---

# Agent Instructions: 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:

```
GET https://docs.api.intratool.de/api-reference/tags/taggable-sections.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
