# 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="https://1605753490-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbBzLrA6555E5Ze2GMYf%2Fuploads%2FJPeGmNKmt8CbTXkSzYYq%2FCleanShot%202025-10-29%20at%2015.10.06%402x.png?alt=media&#x26;token=a7a8d955-b056-42f2-bc2d-8117cc80f0b0" 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:

![](https://content.gitbook.com/content/IbBzLrA6555E5Ze2GMYf/blobs/Hxbi5m3BEw2JKn5UrO2L/image.png)

### 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.](https://docs.autentique.com.br/api/mutations/criando-um-documento)\
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**](https://docs.autentique.com.br/api/mutations/movendo-documento-para-pasta).
{% 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**](https://docs.autentique.com.br/api/integration-basics/altair).
{% 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="<https://content.gitbook.com/content/IbBzLrA6555E5Ze2GMYf/blobs/UYhF3Z8hbSdJj5dx0FvZ/Autentique%20v2.postman_collection.json>" %}
Para importar e usar no Postman
{% endfile %}
