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

# Get Available Name

> Get an alternative filename when duplicates exist

## Overview

When a file with the same name already exists, this endpoint suggests an alternative filename by appending a counter (e.g., "file.txt" becomes "file (1).txt").

## Request Body

<ParamField body="name" type="string" required>
  Original filename that needs an alternative
</ParamField>

<ParamField body="parentId" type="integer">
  Parent folder ID where the file will be uploaded. Use `null` for root.
</ParamField>

<ParamField body="workspaceId" type="integer">
  Workspace ID
</ParamField>

## Response

<ResponseField name="name" type="string">
  Suggested alternative filename with counter
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://app.drime.cloud/api/v1/entry/getAvailableName \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "report.pdf",
      "parentId": null,
      "workspaceId": 0
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://app.drime.cloud/api/v1/entry/getAvailableName', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'report.pdf',
      parentId: null,
      workspaceId: 0
    })
  });

  const { name } = await response.json();
  console.log(`Use filename: ${name}`); // "report (1).pdf"
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://app.drime.cloud/api/v1/entry/getAvailableName',
      headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
      json={
          'name': 'report.pdf',
          'parentId': None,
          'workspaceId': 0
      }
  )

  new_name = response.json()['name']
  print(f'Use filename: {new_name}')  # "report (1).pdf"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - First duplicate theme={null}
  {
    "name": "report (1).pdf"
  }
  ```

  ```json 200 - Second duplicate theme={null}
  {
    "name": "report (2).pdf"
  }
  ```
</ResponseExample>

<Tip>
  Use this in conjunction with `/uploads/validate` to handle duplicate files gracefully.
</Tip>
