---
title: "Generate B2B Documents"
method: POST
path: "/api/b2b/generate"
tags: ["B2B Documents"]
---

# Generate B2B Documents

`POST /api/b2b/generate`

## Request

- Base URL: `https://api.soeru.biz` (the document declares no server; this is the origin it was published from)
- URL: `https://api.soeru.biz/api/b2b/generate`
- Auth: none declared. Required headers: `authorization`

一般注文と卸注文が混在した選択を、1本のPDFにまとめて出力する。

ハイブリッド運用 (2026-08-03):
B2B帳票機能を ON にしているショップでも、出荷キューには一般消費者の注文が
普通に並ぶ。ここでは注文ごとに卸かどうかを DB から確定させ、卸だけを法人
書式 (納品書/請求書/…) に回し、一般のお客様には従来の明細書を出す。

Rate limit: 20 requests per minute per user.

## Headers

- `x-shop-id` string, nullable: Optional shop ID
- `authorization` string, required: Bearer <token>

## Request body

- B2BDocumentRequest: B2B帳票生成リクエスト — 注文別帳票タイプ選択対応. orders: 注文データ配列。各注文は document_types フィールドを含めることが可能。 document_types: グローバルのフォールバック（注文に個別指定がない場合に使用） include_ai_message: AIメッセージを含めるか（設定のオーバーライド用）
  - `document_types` string[]: グローバルの帳票タイプ（注文別指定がない場合のフォールバック）
  - `orders` object[], required: 注文データ配列。各注文は document_types を含めることが可能
  - `include_ai_message` boolean, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/soeru/apis/soeru-api.md) · [All operations](https://skmtc.dev/soeru/apis/soeru-api/llms.txt) · [OpenAPI document](https://skmtc.dev/soeru/apis/soeru-api/revisions/63f8d371abed?raw)
