> ## 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.

# Mark file as Box Doc Gen template

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>;
};

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = href;
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

You can mark an existing document as a Box Doc Gen template and use it to generate documents.

## Before you start

Before you start using Box Doc Gen API, follow the steps listed in the <Link href="/guides/docgen/docgen-getting-started">get started with Box Doc Gen</Link> guide to create a platform app and a Box Doc Gen template.

## Send a request

To send a request containing your question,
use the `POST /2.0/docgen_templates` endpoint and
provide the mandatory parameters.

### Parameters

To make a call you need to pass the following parameters.
Mandatory parameters are in **bold**.

| Parameter       | Description                                                 | Example    |
| --------------- | ----------------------------------------------------------- | ---------- |
| **`file.id`**   | ID of the file to be marked as the Box Doc Gen template.    | `12345678` |
| **`file.type`** | The type of provided input. The value is always **`file`**. | `file`     |

## Use cases

### Mark a file as Box Doc Gen template

The following sample show you how to mark a file to ensure it is recognized as a Box Doc Gen template.

<Note>
  The file must be in `.docx` format.
</Note>

<CodeGroup>
  ```sh cURL theme={null}
  curl -L 'https://api.box.com/2.0/docgen_templates' \
       -H 'box-version: 2025.0' \
       -H 'Authorization: Bearer <ACCESS_TOKEN>' \
       -H 'Content-Type: application/json' \
       -D '{
          "file": {
              "id": "12345678",
              "type": "file"
          }
  }'
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.docgenTemplate.createDocgenTemplateV2025R0({
    file: new FileReferenceV2025R0({ id: file.id }),
  } satisfies DocGenTemplateCreateRequestV2025R0);
  ```

  ```python Python v10 theme={null}
  client.docgen_template.create_docgen_template_v2025_r0(FileReferenceV2025R0(id=file.id))
  ```

  ```cs .NET v10 theme={null}
  await client.DocgenTemplate.CreateDocgenTemplateV2025R0Async(requestBody: new DocGenTemplateCreateRequestV2025R0(file: new FileReferenceV2025R0(id: file.Id)));
  ```

  ```swift Swift v10 theme={null}
  try await client.docgenTemplate.createDocgenTemplateV2025R0(requestBody: DocGenTemplateCreateRequestV2025R0(file: FileReferenceV2025R0(id: file.id)))
  ```

  ```java Java v10 theme={null}
  client.getDocgenTemplate().createDocgenTemplateV2025R0(new DocGenTemplateCreateRequestV2025R0(new FileReferenceV2025R0(file.getId())))
  ```
</CodeGroup>

### Remove Box Doc Gen template marking from a file

To make sure a file is no longer marked as a Box Doc Gen template,
use the `DELETE 2.0/docgen_templates/:template_id` request.

<CodeGroup>
  ```sh cURL theme={null}
  curl -L -X DELETE 'https://api.box.com/2.0/docgen_templates/12345678' \
       -H 'box-version: 2025.0' \
       -H 'Authorization: Bearer <ACCESS_TOKEN>'
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.docgenTemplate.deleteDocgenTemplateByIdV2025R0(
    createdDocgenTemplate.file!.id,
  );
  ```

  ```python Python v10 theme={null}
  client.docgen_template.delete_docgen_template_by_id_v2025_r0(
      created_docgen_template.file.id
  )
  ```

  ```cs .NET v10 theme={null}
  await client.DocgenTemplate.DeleteDocgenTemplateByIdV2025R0Async(templateId: NullableUtils.Unwrap(createdDocgenTemplate.File).Id);
  ```

  ```swift Swift v10 theme={null}
  try await client.docgenTemplate.deleteDocgenTemplateByIdV2025R0(templateId: createdDocgenTemplate.file!.id)
  ```

  ```java Java v10 theme={null}
  client.getDocgenTemplate().deleteDocgenTemplateByIdV2025R0(createdDocgenTemplate.getFile().getId())
  ```
</CodeGroup>

<RelatedLinks
  title="RELATED GUIDES"
  items={[
{ label: translate("Get started with Box Doc Gen"), href: "/guides/docgen/docgen-getting-started", badge: "GUIDE" },
{ label: translate("Box Doc Gen templates"), href: "/guides/docgen/docgen-templates", badge: "GUIDE" },
{ label: translate("Generate documents"), href: "/guides/docgen/generate-document", badge: "GUIDE" }
]}
/>
