# Creating folders

### Creating a regular folder

The mutation to create a folder in the authenticated user’s account (owner of the API token) is:

```graphql
mutation CreateFolderMutation($folder: FolderInput!) {
  createFolder(folder: $folder) {
    id
    name
    type
    created_at
  }
}
```

Define the variable values:

```javascript
{
  "folder": {
    "name": "Signed contracts"
  }
}
```

And testing this mutation in [Altair](https://altair.autentique.com.br):

<figure><img src="/files/18kLHE20uLhVVc0d3Qlr" alt=""><figcaption></figcaption></figure>

### Creating a shared folder

Compared to the mutation used to create folders, the only difference is the **`type`** parameter. So, by reusing almost the same mutation, just include the parameter:

```graphql
mutation SharedFolderMutation(
  $folder: FolderInput!,
  $type: FolderTypeEnum
) {
  createFolder(folder: $folder, type: $type) {
    id
    name
    type
    created_at
  }
}
```

And this time, by setting the value of the **`type`** parameter to **`ORGANIZATION`**:

```javascript
{
  "folder": {
    "name": "Shared contracts"
  },
  "type": "ORGANIZATION"
}
```

Then test it in [Altair](https://altair.autentique.com.br)  like this:

![](/files/-LzJDKOzS6K-7E7_KgGK)

### Creating a Folder/Subfolder

This mutation allows for the creation of a new folder. If a `parent_id` is provided, the folder will be created as a subfolder within the corresponding directory.

```graphql
mutation CreateSubfolder($parent_id: UUID, $folder: FolderInput!) {
  createFolder(parent_id: $parent_id, folder: $folder) {
    id
    name
    slug
    context
    path
    children_counter
    created_at
    updated_at
  }
}
```

{% hint style="warning" %}
There is a maximum limit of 5 subfolders per parent folder. Any attempt to create additional subfolders beyond this limit will result in a validation error.
{% endhint %}

{% hint style="info" %}
If you want to create a document inside a folder, use the **`folder_id`** attribute when [creating the document.](/api/mutations/criando-um-documento.md)\
If your goal is to add an existing document to another folder that has already been created, see how to [**move a document to a folder**](/api/mutations/movendo-documento-para-pasta.md).
{% endhint %}

{% hint style="info" %}
You can check what each of these parameters means directly in the full GraphQL API documentation, in the Docs menu of [Altair](https://altair.autentique.com.br/). If you're not sure how to do that, check out our tutorial on [**Using Altair**](/api/integration-basics/altair.md).
{% endhint %}

{% hint style="info" %}
If Altair doesn't help you integrate with the API, check out some examples of how to make these requests in other ways: <https://graphql.org/graphql-js/graphql-clients/>
{% endhint %}

{% file src="/files/-M03o9cE5QB3vLoPUlzJ" %}
Para importar e usar no Postman
{% endfile %}


---

# 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.autentique.com.br/api/mutations/criando-pastas.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.
