> ## Documentation Index
> Fetch the complete documentation index at: https://developers.leadwaycrm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Folder

> Creates a new folder in the media storage

Creates a new folder in the media storage

```http theme={null}
POST https://services.leadconnectorhq.com/medias/folder
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Body

<ParamField body="altId" type="string" required default="sx6wyHhbFdRXh302LLNR">
  Account Id
</ParamField>

<ParamField body="altType" type="string" required default="account">
  Type of entity (account only) Posibles valores: 'account'
</ParamField>

<ParamField body="name" type="string" required default="New Folder">
  Name of the folder to be created
</ParamField>

<ParamField body="parentId" type="string" default="64af50c42d567a3b4f5989e0">
  ID of the parent folder (optional)
</ParamField>

## Respuestas

<Accordion title="200 - Returns the newly created folder object">
  <ResponseField name="altId" type="string" required default="sx6wyHhbFdRXh302LLNR">
    Account identifier that owns this folder
  </ResponseField>

  <ResponseField name="altType" type="string" required default="account">
    Type of entity that owns the folder Posibles valores: 'account'
  </ResponseField>

  <ResponseField name="name" type="string" required default="New Folder">
    Name of the folder
  </ResponseField>

  <ResponseField name="parentId" type="string" default="64af50c42d567a3b4f5989e0">
    ID of the parent folder (null for root folders)
  </ResponseField>

  <ResponseField name="type" type="string" required default="folder">
    Type of the object (always 'folder' for folders)
  </ResponseField>

  <ResponseField name="deleted" type="boolean" default="False">
    Whether the folder has been deleted
  </ResponseField>

  <ResponseField name="pendingUpload" type="boolean" default="False">
    Whether there are pending uploads to this folder
  </ResponseField>

  <ResponseField name="category" type="string" default="image">
    Primary category of content stored in the folder
  </ResponseField>

  <ResponseField name="subCategory" type="string" default="logo">
    Sub-category of content stored in the folder
  </ResponseField>

  <ResponseField name="isPrivate" type="boolean" default="False">
    Whether the folder is private and not publicly accessible
  </ResponseField>

  <ResponseField name="relocatedFolder" type="boolean" default="False">
    Whether the folder has been moved from its original account
  </ResponseField>

  <ResponseField name="migrationCompleted" type="boolean" default="True">
    Whether the data migration process has been completed for this folder
  </ResponseField>

  <ResponseField name="appFolder" type="boolean" default="False">
    Whether this is a system-generated application folder
  </ResponseField>

  <ResponseField name="isEssential" type="boolean" default="False">
    Whether the folder is essential and should not be deleted
  </ResponseField>

  <ResponseField name="status" type="string">
    Current status of the folder
  </ResponseField>

  <ResponseField name="lastUpdatedBy" type="string" default="user-uuid-123">
    ID of the user who last updated the folder
  </ResponseField>

  ```json theme={null}
  {
    "altId": "sx6wyHhbFdRXh302LLNR",
    "altType": "account",
    "name": "New Folder",
    "parentId": "64af50c42d567a3b4f5989e0",
    "type": "folder",
    "deleted": false,
    "pendingUpload": false,
    "category": "image",
    "subCategory": "logo",
    "isPrivate": false,
    "relocatedFolder": false,
    "migrationCompleted": true,
    "appFolder": false,
    "isEssential": false,
    "status": "string",
    "lastUpdatedBy": "user-uuid-123"
  }
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://services.leadconnectorhq.com/medias/folder' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "altId": "sx6wyHhbFdRXh302LLNR",
    "altType": "account",
    "name": "New Folder",
    "parentId": "64af50c42d567a3b4f5989e0"
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/medias/folder', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"altId": "sx6wyHhbFdRXh302LLNR", "altType": "account", "name": "New Folder", "parentId": "64af50c42d567a3b4f5989e0"}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/medias/folder',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"altId": "sx6wyHhbFdRXh302LLNR", "altType": "account", "name": "New Folder", "parentId": "64af50c42d567a3b4f5989e0"},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/medias/folder');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode({'altId': 'sx6wyHhbFdRXh302LLNR', 'altType': 'account', 'name': 'New Folder', 'parentId': '64af50c42d567a3b4f5989e0'}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
