# Folders

## List

Get a list of all `Folders`.

**Definition**

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

**Example Request**

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

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

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    "id": 1,
    "parent_folder_id": null,
    "type": "form",
    "name": "Folder 1",
    "sort_number": 1,
    "created_at": "2019-01-25 10:56:16",
    "updated_at": "2019-01-25 10:56:16",
    "folder": null
  },
  {
    "id": 2,
    "parent_folder_id": null,
    "type": "form",
    "name": "Folder 2",
    "sort_number": 2,
    "created_at": "2019-01-25 10:56:18",
    "updated_at": "2019-01-25 10:56:18",
    "folder": null
  }
]
```

## List by type

Get a list of all `Folders` by `type`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/folders/{type}`

**Example Request**

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

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

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    "id": 1,
    "parent_folder_id": null,
    "type": "form",
    "name": "Folder 1",
    "sort_number": 1,
    "created_at": "2019-01-25 10:56:16",
    "updated_at": "2019-01-25 10:56:16",
    "folder": null
  },
  {
    "id": 2,
    "parent_folder_id": null,
    "type": "form",
    "name": "Folder 2",
    "sort_number": 2,
    "created_at": "2019-01-25 10:56:18",
    "updated_at": "2019-01-25 10:56:18",
    "folder": null
  }
]
```

## Create

Create a new `Folder`.

**Definition**

<mark style="color:yellow;">`POST`</mark> `/api/folders`

**Request Keys**

| Key                |   Type  | Default | Description                                 |
| ------------------ | :-----: | :-----: | ------------------------------------------- |
| `parent_folder_id` | integer |  `null` | Related parent `Folder`                     |
| `type` \*          |  string |    -    | Relation type of the `Folder` (e.g. `form`) |
| `name` \*          |  string |    -    | Name of the `Folder`                        |

Keys with `*` are required.

**Example Request**

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

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/folders', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'type' => 'form',
        'name' => 'Folder 3'
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "id": 3,
  "parent_folder_id": null,
  "type": "form",
  "name": "Folder 3",
  "sort_number": 3,
  "created_at": "2019-01-25 11:25:42",
  "updated_at": "2019-01-25 11:25:42",
  "folder": null
}
```

## Update

Update an existing `Folder` by `id`.

**Definition**

<mark style="color:blue;">`PUT`</mark> `/api/folders/{id}`

**Request Keys**

| Key                |   Type  | Description             |
| ------------------ | :-----: | ----------------------- |
| `parent_folder_id` | integer | Related parent `Folder` |
| `name`             |  string | Name of the `Folder`    |

**Example Request**

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

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

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "id": 3,
  "parent_folder_id": null,
  "type": "form",
  "name": "Folder3",
  "sort_number": 3,
  "created_at": "2019-01-25 11:25:42",
  "updated_at": "2019-01-25 11:26:05",
  "folder": null
}
```

## Delete

Delete an existing `Folder` by `id`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/folders/{id}`

**Example Request**

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

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

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": null
}
```


---

# 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/folders.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.
