/api/purchase-orders/generatecurl -X POST https://api.miryo.ai/api/purchase-orders/generate \
-H "Content-Type: application/json" \
-H "x-api-key: your_api_key_here" \
-d '{
"issuer": {
"company": "miryo.AI株式会社"
},
"customer": {
"company": "サンプルシステム株式会社"
},
"order": {
"subject": "Webシステム開発業務委託",
"items": [
{
"name": "開発作業",
"quantity": 1,
"unitPrice": 1000000,
"amount": 1000000
}
]
}
}' \
--output purchase-order.pdfcurl -X POST https://api.miryo.ai/api/purchase-orders/generate \
-H "Content-Type: application/json" \
-H "x-api-key: your_api_key_here" \
-d '{
"issuer": {
"company": "miryo.AI株式会社",
"email": "info@miryo.ai",
"phone": "050-1725-6435",
"address": "東京都港区1-2-3 ミリョービル5F",
"contactPerson": "購買部 佐藤次郎"
},
"customer": {
"company": "サンプルシステム株式会社",
"name": "山田太郎",
"email": "yamada@sample-system.co.jp",
"phone": "03-1234-5678",
"department": "開発部",
"position": "部長",
"nameKana": "ヤマダ タロウ",
"zipCode": "150-0001",
"address": "東京都渋谷区神宮前1-1-1"
},
"order": {
"orderNumber": "PO-2025-12-001",
"orderDate": "2025-12-07T00:00:00.000Z",
"deliveryDate": "2025-12-31T00:00:00.000Z",
"subject": "Webシステム開発業務委託",
"items": [
{
"name": "要件定義・基本設計",
"majorCategory": "設計",
"description": "業務フロー分析、機能要件定義書作成、画面設計",
"quantity": 1,
"unitPrice": 500000,
"amount": 500000
},
{
"name": "詳細設計・開発",
"majorCategory": "開発",
"quantity": 1,
"unitPrice": 800000,
"amount": 800000
}
],
"taxRate": 0.1,
"paymentTerms": "検収完了後、翌月末払い",
"notes": "■ 納品物:ソースコード一式、設計書\n■ 検収期間:納品後2週間",
"showItemDescription": true,
"fontSize": {
"customerCompany": 20,
"customerName": 16
},
"tableColumns": {
"showNo": true,
"showMajorCategory": true
}
}
}' \
--output purchase-order.pdf| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
issuer.company | string | 必須 | 発注者の会社名 |
customer.company | string | 必須 | 発注先の会社名 |
customer.name | string | 任意 | 発注先の担当者名(null可、指定しない場合は「様」も表示されません) |
customer.email | string | 任意 | 発注先のメールアドレス(email形式、任意) |
customer.phone | string | 任意 | 発注先の電話番号(任意) |
order.subject | string | 必須 | 発注件名・タイトル |
order.items | array | 必須 | 発注明細の配列(最低1件必要) |
order.items[].name | string | 必須 | 明細項目名 |
order.items[].quantity | number | 必須 | 数量(正の数値) |
order.items[].unitPrice | number | 必須 | 単価(0以上の数値) |
order.items[].amount | number | 必須 | 金額(0以上の数値)= quantity × unitPrice |
issuer.email | string | 任意 | 発注者のメールアドレス(デフォルト: 表示なし) |
issuer.phone | string | 任意 | 発注者の電話番号(デフォルト: 表示なし) |
issuer.address | string | 任意 | 発注者の住所(デフォルト: 表示なし) |
issuer.contactPerson | string | 任意 | 発注者の担当者名(デフォルト: 表示なし) |
customer.department | string | 任意 | 発注先の部署名(デフォルト: 表示なし) |
customer.position | string | 任意 | 発注先の役職(デフォルト: 表示なし) |
customer.nameKana | string | 任意 | 発注先担当者名のカナ表記(デフォルト: 表示なし) |
customer.zipCode | string | 任意 | 発注先の郵便番号(デフォルト: 表示なし) |
customer.address | string | 任意 | 発注先の住所(デフォルト: 表示なし) |
order.orderNumber | string | 任意 | 発注番号(未指定時は自動生成: PO-{timestamp}) |
order.orderDate | string | 任意 | 発注日(ISO 8601形式、デフォルト: 現在日時) |
order.deliveryDate | string | 任意 | 納期(ISO 8601形式、デフォルト: 表示なし) |
order.items[].description | string | 任意 | 明細項目の詳細説明(デフォルト: 表示なし) |
order.items[].majorCategory | string | 任意 | 大カテゴリ名(デフォルト: 表示なし、showMajorCategory: true で表示) |
order.notes | string | 任意 | 備考欄(改行は\nで指定、デフォルト: 表示なし) |
order.paymentTerms | string | 任意 | 支払条件(デフォルト: 表示なし) |
order.showItemDescription | boolean | 任意 | 明細の詳細説明を表示するか(デフォルト: false) |
order.taxRate | number | 任意 | 消費税率 0.0~1.0(デフォルト: 0.1 = 10%) |
order.fontSize | object | 任意 | フォントサイズカスタマイズ設定(デフォルト: システム標準値) |
order.fontSize.customerCompany | number | 任意 | 発注先会社名のフォントサイズ(デフォルト: 20) |
order.fontSize.customerName | number | 任意 | 発注先担当者名のフォントサイズ(デフォルト: 16) |
order.fontSize.customerOther | number | 任意 | 発注先その他情報のフォントサイズ(デフォルト: 10) |
order.fontSize.issuerCompany | number | 任意 | 発注者会社名のフォントサイズ(デフォルト: 12) |
order.fontSize.issuerName | number | 任意 | 発注者担当者名のフォントサイズ(デフォルト: 10) |
order.fontSize.issuerOther | number | 任意 | 発注者その他情報のフォントサイズ(デフォルト: 10) |
order.fontSize.itemDetail | number | 任意 | 明細詳細のフォントサイズ(デフォルト: 9) |
order.tableColumns | object | 任意 | テーブル列の表示設定(デフォルト: 全てfalse) |
order.tableColumns.showNo | boolean | 任意 | No列を表示するか(デフォルト: false) |
order.tableColumns.showMajorCategory | boolean | 任意 | 大カテゴリ列を表示するか(デフォルト: false) |
PDF Binary Data (application/pdf) Response Headers: Content-Type: application/pdf Content-Disposition: attachment; filename="purchase-order-PO-2025-12-001.pdf" X-Order-Number: PO-2025-12-001
注: 発注番号がリクエストで指定されていない場合、自動生成された番号がX-Order-Numberヘッダーに含まれます。
{
"error": "Invalid request data",
"details": [
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": ["customer", "name"],
"message": "Required"
}
]
}{
"error": "API key is required"
}const axios = require('axios');
const fs = require('fs');
async function generatePurchaseOrder() {
const response = await axios.post(
'https://api.miryo.ai/api/purchase-orders/generate',
{
issuer: {
company: 'miryo.AI株式会社',
contactPerson: '購買部 佐藤次郎'
},
customer: {
company: 'サンプルシステム株式会社',
name: '山田太郎',
email: 'yamada@sample-system.co.jp',
phone: '03-1234-5678'
},
order: {
subject: 'Webシステム開発業務委託',
deliveryDate: '2025-12-31T00:00:00.000Z',
items: [{
name: '開発作業',
quantity: 1,
unitPrice: 1000000,
amount: 1000000 // quantity × unitPrice
}]
}
},
{
headers: { 'x-api-key': 'your_api_key_here' },
responseType: 'arraybuffer'
}
);
fs.writeFileSync('purchase-order.pdf', response.data);
console.log('Order Number:', response.headers['x-order-number']);
}import requests
def generate_purchase_order():
response = requests.post(
'https://api.miryo.ai/api/purchase-orders/generate',
headers={'x-api-key': 'your_api_key_here'},
json={
'issuer': {
'company': 'miryo.AI株式会社',
'contactPerson': '購買部 佐藤次郎'
},
'customer': {
'company': 'サンプルシステム株式会社',
'name': '山田太郎',
'email': 'yamada@sample-system.co.jp',
'phone': '03-1234-5678'
},
'order': {
'subject': 'Webシステム開発業務委託',
'deliveryDate': '2025-12-31T00:00:00.000Z',
'items': [{
'name': '開発作業',
'quantity': 1,
'unitPrice': 1000000,
'amount': 1000000 # quantity × unitPrice
}],
'notes': '■ 納品物:ソースコード一式、設計書\n■ 検収期間:納品後2週間'
}
}
)
with open('purchase-order.pdf', 'wb') as f:
f.write(response.content)
order_number = response.headers.get('X-Order-Number')
if order_number:
print('Order Number:', order_number)| 項目 | 発注書API | 請求書API |
|---|---|---|
| エンドポイント | /api/purchase-orders/generate | /api/invoices/generate |
| メインオブジェクト | order | invoice |
| 番号フィールド | orderNumber | invoiceNumber |
| 日付フィールド | orderDate, deliveryDate | invoiceDate, paymentDueDate |
| 振込先情報 | なし | bankAccount |
| 適格請求書対応 | なし | qualifiedInvoice, registrationNumber |
| 担当者名 | 必須 | 任意 |
customer.name(発注先担当者名)が必須です