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

# Create Folder Lock

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

To create a lock on a folder in Box you will need to provide our API with the
`id` of the folder for which the lock should be applied. Optionally you may
supply the specific `locked_operations` to be applied with the folder lock.

<Note>
  **Folder Locks**

  When using any folder lock API endpoints, you must be authenticated as the
  owner/co-owner of the folder you are trying to access.
</Note>

<CodeGroup>
  ```sh cURL theme={null}
  curl -i -X POST "https://api.box.com/2.0/folder_locks" \
       -H "authorization: Bearer <ACCESS_TOKEN>" \
       -H "content-type: application/json" \
       -d '{
         "folder": {
           "type": "folder",
           "id": "33552487093"
         },
         "locked_operations": {
           "move": true,
           "delete": true
         }
       }'
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.folderLocks.createFolderLock({
    folder: {
      id: folder.id,
      type: 'folder',
    } satisfies CreateFolderLockRequestBodyFolderField,
    lockedOperations: {
      move: true,
      delete: true,
    } satisfies CreateFolderLockRequestBodyLockedOperationsField,
  } satisfies CreateFolderLockRequestBody);
  ```

  ```python Python v10 theme={null}
  client.folder_locks.create_folder_lock(
      CreateFolderLockFolder(id=folder.id, type="folder"),
      locked_operations=CreateFolderLockLockedOperations(move=True, delete=True),
  )
  ```

  ```cs .NET v10 theme={null}
  await client.FolderLocks.CreateFolderLockAsync(requestBody: new CreateFolderLockRequestBody(folder: new CreateFolderLockRequestBodyFolderField(id: folder.Id, type: "folder")) { LockedOperations = new CreateFolderLockRequestBodyLockedOperationsField(move: true, delete: true) });
  ```

  ```swift Swift v10 theme={null}
  try await client.folderLocks.createFolderLock(requestBody: CreateFolderLockRequestBody(folder: CreateFolderLockRequestBodyFolderField(id: folder.id, type: "folder"), lockedOperations: CreateFolderLockRequestBodyLockedOperationsField(move: true, delete: true)))
  ```

  ```java Java v10 theme={null}
  client.getFolderLocks().createFolderLock(new CreateFolderLockRequestBody.Builder(new CreateFolderLockRequestBodyFolderField("folder", folder.getId())).lockedOperations(new CreateFolderLockRequestBodyLockedOperationsField(true, true)).build())
  ```
</CodeGroup>

<Warning>
  **Setting Locked Operations**

  If the `locked_operations` object is included with a folder lock request,
  both `move` and `delete` need to be set to `true`. Supplying only one lock
  operation in the object, or setting the values of both to something other
  than `true` will produce an error. These options are in place to allow
  for additional operations in the future.
</Warning>

## Lock Operations

There are two possible lock operations that may be applied to a folder, `move`
and `delete`.

The `move` lock will prevent the folder from being moved to a new location or
owner while the lock is still applied.

The `delete` lock will prevent the folder from being deleted while the lock is
still applied.

<RelatedLinks
  title="RELATED APIS"
  items={[
{ label: translate("Create folder lock"), href: "/reference/post-folder-locks", badge: "POST" }
]}
/>

<RelatedLinks
  title="RELATED GUIDES"
  items={[
{ label: translate("Get Folder Lock"), href: "/guides/folders/single/get-locks", badge: "GUIDE" },
{ label: translate("Delete Folder Lock"), href: "/guides/folders/single/delete-lock", badge: "GUIDE" }
]}
/>
