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

# Box Doc Genジョブ

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 = localizeLink(href);
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

Box Doc Genジョブは、ドキュメントを生成するリクエストを行うと実行されます。`POST`リクエスト内の`document_generation_data`パラメータは、ドキュメントを生成するためのBox Doc Genジョブの実行を表すエントリの配列です。

<CodeGroup>
  ```sh cURL theme={null}
  curl -L 'https://api.box.com/2.0/docgen_batches' \
       -H 'box-version: 2025.0' \
       -H 'Authorization: Bearer <ACCESS_TOKEN>' \
       -D '{
          "file": {
              "id": "12345678",
              "type": "file"
          },
          "input_source": "api",
          "destination_folder": {
              "id": "12345678",
              "type": "folder"
          },
          "output_type": "docx",
          "document_generation_data": [
              {
                  "generated_file_name": "Image test",
                  "user_input": {
                      "order": {
                          "id": "12305",
                          "date": "18-08-2023",
                          "country": "US",
                          "expiryDate": "18-08-2024",
                          "currency": "$",
                          "amount": 5060.5,
                          "taxRate": 10,
                          "requester": "John",
                          "approver": "Smith",
                          "department": "Procurement",
                          "paymentTerms": "30 days",
                          "deliveryTerms": "30 days",
                          "deliveryDate": "18-09-2023",
                          "vendor": {
                              "company": "Example company",
                              "address": {
                                  "street": "Example street",
                                  "city": "Example city",
                                  "zip": "EX-456"
                              }
                          },
                          "products": [
                              {
                                  "id": 1,
                                  "name": "A4 Papers",
                                  "type": "non-fragile",
                                  "quantity": 100,
                                  "price": 29,
                                  "amount": 2900
                              },
                              {
                                  "id": 2,
                                  "name": "Ink  Cartridge",
                                  "type": "non-fragile",
                                  "quantity": 40,
                                  "price": 39,
                                  "amount": 1560
                              },
                              {
                                  "id": 3,
                                  "name": "Adhesive tape",
                                  "type": "non-fragile",
                                  "quantity": 20,
                                  "price": 30,
                                  "amount": 600.5
                              }
                          ]
                      }
                  }
              }
          ]`
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.docgen.createDocgenBatchV2025R0({
    file: new FileReferenceV2025R0({ id: uploadedFile.id }),
    inputSource: 'api',
    destinationFolder: new DocGenBatchCreateRequestV2025R0DestinationFolderField({
      id: folder.id,
    }),
    outputType: 'pdf',
    documentGenerationData: [
      {
        generatedFileName: 'test',
        userInput: { ['abc']: 'xyz' },
      } satisfies DocGenDocumentGenerationDataV2025R0,
    ],
  } satisfies DocGenBatchCreateRequestV2025R0);
  ```

  ```python Python v10 theme={null}
  client.docgen.create_docgen_batch_v2025_r0(
      FileReferenceV2025R0(id=uploaded_file.id),
      "api",
      CreateDocgenBatchV2025R0DestinationFolder(id=folder.id),
      "pdf",
      [
          DocGenDocumentGenerationDataV2025R0(
              generated_file_name="test", user_input={"abc": "xyz"}
          )
      ],
  )
  ```

  ```cs .NET v10 theme={null}
  await client.Docgen.CreateDocgenBatchV2025R0Async(requestBody: new DocGenBatchCreateRequestV2025R0(file: new FileReferenceV2025R0(id: uploadedFile.Id), inputSource: "api", destinationFolder: new DocGenBatchCreateRequestV2025R0DestinationFolderField(id: folder.Id), outputType: "pdf", documentGenerationData: Array.AsReadOnly(new [] {new DocGenDocumentGenerationDataV2025R0(generatedFileName: "test", userInput: new Dictionary<string, object>() { { "abc", "xyz" } })})));
  ```

  ```swift Swift v10 theme={null}
  try await client.docgen.createDocgenBatchV2025R0(requestBody: DocGenBatchCreateRequestV2025R0(file: FileReferenceV2025R0(id: uploadedFile.id), inputSource: "api", destinationFolder: DocGenBatchCreateRequestV2025R0DestinationFolderField(id: folder.id), outputType: "pdf", documentGenerationData: [DocGenDocumentGenerationDataV2025R0(generatedFileName: "test", userInput: ["abc": "xyz"])]))
  ```

  ```java Java v10 theme={null}
  client.getDocgen().createDocgenBatchV2025R0(new DocGenBatchCreateRequestV2025R0(new FileReferenceV2025R0(uploadedFile.getId()), "api", new DocGenBatchCreateRequestV2025R0DestinationFolderField(folder.getId()), "pdf", Arrays.asList(new DocGenDocumentGenerationDataV2025R0("test", mapOf(entryOf("abc", "xyz"))))))
  ```
</CodeGroup>

Box Doc Gen APIを使用すると、Box Doc Genジョブに関する情報を取得できます。

## 前提条件

Box Doc Gen APIの使用を開始する前に、<Link href="/guides/docgen/docgen-getting-started">Box Doc Genの使い方</Link>ガイドに記載されている手順に従って、PlatformアプリとBox Doc Genテンプレートを作成してください。

## すべてのBox Doc Genジョブのリストを取得

実行されたすべてのBox Doc Genジョブのリストを取得するには、`GET /2.0/docgen_jobs`エンドポイントを使用します。追加のパラメータを指定する必要はありません。

<CodeGroup>
  ```sh cURL theme={null}
  curl -i -X GET "https://api.box.com/2.0/docgen_jobs" \
       -H 'box-version: 2025.0' \
       -H "authorization: Bearer <ACCESS_TOKEN>"
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.docgen.getDocgenJobsV2025R0({
    limit: 10000,
  } satisfies GetDocgenJobsV2025R0QueryParams);
  ```

  ```python Python v10 theme={null}
  client.docgen.get_docgen_jobs_v2025_r0(limit=10000)
  ```

  ```cs .NET v10 theme={null}
  await client.Docgen.GetDocgenJobsV2025R0Async(queryParams: new GetDocgenJobsV2025R0QueryParams() { Limit = 10000 });
  ```

  ```swift Swift v10 theme={null}
  try await client.docgen.getDocgenJobsV2025R0(queryParams: GetDocgenJobsV2025R0QueryParams(limit: Int64(10000)))
  ```

  ```java Java v10 theme={null}
  client.getDocgen().getDocgenJobsV2025R0(new GetDocgenJobsV2025R0QueryParams.Builder().limit(10000L).build())
  ```
</CodeGroup>

## IDを指定してBox Doc Genジョブを取得

特定のBox Doc Genジョブを取得するには、`GET /2.0/docgen_jobs_id`エンドポイントを使用して、`job_id`を指定します。

<CodeGroup>
  ```sh cURL theme={null}
  curl -i -X GET "https://api.box.com/2.0/docgen_jobs/12345" \
       -H 'box-version: 2025.0' \
       -H "authorization: Bearer <ACCESS_TOKEN>"
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.docgen.getDocgenJobByIdV2025R0(docgenJobItemFromList.id);
  ```

  ```python Python v10 theme={null}
  client.docgen.get_docgen_job_by_id_v2025_r0(docgen_job_item_from_list.id)
  ```

  ```cs .NET v10 theme={null}
  await client.Docgen.GetDocgenJobByIdV2025R0Async(jobId: docgenJobItemFromList.Id);
  ```

  ```swift Swift v10 theme={null}
  try await client.docgen.getDocgenJobByIdV2025R0(jobId: docgenJobItemFromList.id)
  ```

  ```java Java v10 theme={null}
  client.getDocgen().getDocgenJobByIdV2025R0(docgenJobItemFromList.getId())
  ```
</CodeGroup>

## 特定のIDを使用してバッチ内のGet Box Doc Genジョブを取得

単一のリクエストで複数のドキュメントを生成できます。このような場合、個別の生成ジョブが各ドキュメントに対して実行され、これらすべてのジョブが1つの「バッチ」(つまり、1つのリクエスト) に含まれます。1つのリクエスト内で実行されたすべてのジョブを取得するには、`GET /2.0/docgen_batch_jobs_id`エンドポイントを使用し、`batch_id`を指定します。

<CodeGroup>
  ```sh cURL theme={null}
  curl -i -X GET "https://api.box.com/2.0/docgen_jobs/12345" \
       -H 'box-version: 2025.0' \
       -H "authorization: Bearer <ACCESS_TOKEN>"
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.docgen.getDocgenJobByIdV2025R0(docgenJobItemFromList.id);
  ```

  ```python Python v10 theme={null}
  client.docgen.get_docgen_job_by_id_v2025_r0(docgen_job_item_from_list.id)
  ```

  ```cs .NET v10 theme={null}
  await client.Docgen.GetDocgenJobByIdV2025R0Async(jobId: docgenJobItemFromList.Id);
  ```

  ```swift Swift v10 theme={null}
  try await client.docgen.getDocgenJobByIdV2025R0(jobId: docgenJobItemFromList.id)
  ```

  ```java Java v10 theme={null}
  client.getDocgen().getDocgenJobByIdV2025R0(docgenJobItemFromList.getId())
  ```
</CodeGroup>

<RelatedLinks
  title="関連するガイド"
  items={[
{ label: translate("Get started with Box Doc Gen"), href: "/guides/docgen/docgen-getting-started", badge: "GUIDE" },
{ label: translate("Generate documents"), href: "/guides/docgen/generate-document", badge: "GUIDE" }
]}
/>
