API リファレンス
FabHub パブリック API の完全なリファレンスです。ブランド化されたポータルが正規のものですが、機械可読のコントラクトを任意の OpenAPI ビューア(Swagger Editor、Redoc、Postman、または IDE)に読み込むこともできます。
ベース URL
https://api.fabhub.app/v1
規約
X-API-Key(またはAuthorization: Bearer)で認証します。認証を参照してください。- リクエストボディは
camelCaseキーの JSON です。リストのフィルターはsnake_caseのクエリパラメータです。 - リストエンドポイントはページベースで、
paginationオブジェクトを返します。ページネーションを参照してください。 - 書き込みエンドポイントには
Idempotency-Keyヘッダーが必要です。冪等性を参照してください。 - エラーは機械可読の
codeを持つ安定したエンベロープを使用します。エラーを参照してください。
すべてのエンドポイント
この表は OpenAPI コントラクトから生成され、すべてのパブリック操作とそれに必要なスコープを常に一覧化します。以下のセクションは、最も一般的なリソースについての実例です。リクエストおよびレスポンスのスキーマの網羅的なソースは OpenAPI コントラクトです。
| メソッド | パス | スコープ |
|---|---|---|
GET | /v1 | authenticated |
GET | /v1/audit/events | audit:read |
GET | /v1/auth/context | authenticated |
GET | /v1/contacts | contacts:read |
POST | /v1/contacts | contacts:write |
DELETE | /v1/contacts/{contact_id} | contacts:write |
GET | /v1/contacts/{contact_id} | contacts:read |
PATCH | /v1/contacts/{contact_id} | contacts:write |
GET | /v1/items | items:read |
POST | /v1/items | items:write |
DELETE | /v1/items/{item_id} | items:write |
GET | /v1/items/{item_id} | items:read |
PATCH | /v1/items/{item_id} | items:write |
GET | /v1/items/{item_id}/ingredients | items:read |
POST | /v1/items/{item_id}/ingredients | items:write |
DELETE | /v1/items/{item_id}/ingredients/{ingredient_id} | items:write |
PATCH | /v1/items/{item_id}/ingredients/{ingredient_id} | items:write |
GET | /v1/items/{item_id}/suppliers | items:read |
POST | /v1/items/{item_id}/suppliers | items:write |
DELETE | /v1/items/{item_id}/suppliers/{supplier_id} | items:write |
PATCH | /v1/items/{item_id}/suppliers/{supplier_id} | items:write |
GET | /v1/orders | orders:read |
POST | /v1/orders | orders:write |
GET | /v1/orders/{order_id} | orders:read |
PATCH | /v1/orders/{order_id} | orders:write |
GET | /v1/orders/{order_id}/lines | orders:read |
GET | /v1/organization | organization:read |
GET | /v1/stock-documents | inventory:read |
POST | /v1/stock-documents | inventory:write |
DELETE | /v1/stock-documents/{document_id} | inventory:write |
GET | /v1/stock-documents/{document_id} | inventory:read |
PATCH | /v1/stock-documents/{document_id} | inventory:write |
POST | /v1/stock-documents/{document_id}/approve | inventory:write |
POST | /v1/stock-documents/{document_id}/cancel | inventory:write |
GET | /v1/stock-documents/{document_id}/lines | inventory:read |
POST | /v1/stock-documents/{document_id}/lines | inventory:write |
DELETE | /v1/stock-documents/{document_id}/lines/{line_id} | inventory:write |
PATCH | /v1/stock-documents/{document_id}/lines/{line_id} | inventory:write |
POST | /v1/stock-documents/{document_id}/submit | inventory:write |
GET | /v1/stock-levels | inventory:read |
GET | /v1/usage | usage:read |
GET | /v1/webhooks | webhooks:read |
POST | /v1/webhooks | webhooks:write |
DELETE | /v1/webhooks/{webhook_id} | webhooks:delete |
GET | /v1/webhooks/{webhook_id} | webhooks:read |
PATCH | /v1/webhooks/{webhook_id} | webhooks:write |
GET | /v1/webhooks/{webhook_id}/deliveries | webhooks:deliveries:read |
サービス
GET /v1
呼び出し元の認証情報が利用できるケイパビリティ(メソッド、パス、スコープ)を返します。スコープは不要です。
GET /v1/auth/context
呼び出し元の認証情報のテナント、プラン、スコープ、レート制限ティア、有効期限を返します。スコープは不要です。例はクイックスタートを参照してください。
アイテム
GET /v1/items
スコープ: items:read。アイテム(製品、材料、コンボ)を一覧取得します。
| クエリ | 型 | 備考 |
|---|---|---|
page | integer | 1 始まりのページ番号(デフォルト 1) |
page_size | integer | 1 ページあたりのアイテム数(デフォルト 20) |
search | string | 名前 / SKU に対する自由テキスト一致 |
curl "https://api.fabhub.app/v1/items?page=1&page_size=2&search=widget" \
-H "X-API-Key: $FABHUB_API_KEY"
{
"data": [
{
"id": "a1c9...",
"name": "Blue Widget",
"sku": "WIDG-BLUE",
"itemType": "product",
"salePrice": 19.99,
"purchasePrice": 8.5,
"isActive": true,
"category": { "id": "cat_1", "name": "Widgets" },
"supplier": { "id": "sup_1", "name": "Acme", "company": "Acme Ltd" },
"updatedAt": "2026-06-19T14:02:00Z"
}
],
"pagination": { "page": 1, "pageSize": 2, "total": 57, "totalPages": 29 }
}
POST /v1/items
スコープ: items:write。Idempotency-Key が必要です。アイテムを作成します。
| ボディフィールド | 型 | 備考 |
|---|---|---|
name | string | 必須 |
itemType | product | material | combo | デフォルトは product |
sku、mpn、barcode | string | null | 任意の識別子 |
categoryId、unitId、supplierId | string | null | 任意の参照 |
salePrice、purchasePrice | number | null | 任意の価格 |
supplierCode、notes | string | null | 任意 |
isActive | boolean | デフォルトは true |
curl -X POST https://api.fabhub.app/v1/items \
-H "X-API-Key: $FABHUB_API_KEY" \
-H "Idempotency-Key: 0b9c4a2e-..." \
-H "Content-Type: application/json" \
-d '{"name":"Blue Widget","itemType":"product","salePrice":19.99}'
作成されたアイテムとともに { "data": { ...item } } を返します。
GET /v1/items/{item_id}
スコープ: items:read。{ "data": { ...item } } を返すか、code: "NOT_FOUND" とともに 404 を返します。
PATCH /v1/items/{item_id}
スコープ: items:write。Idempotency-Key が必要です。作成フィールドの任意のサブセットを受け取り、更新されたアイテムを返します。
アイテムのサブリソース
GET /v1/items/{item_id}/ingredients(スコープitems:read)-combo/ 製造アイテムの構成要素。GET /v1/items/{item_id}/suppliers(スコープitems:read)- アイテムにリンクされたサプライヤー。
注文
GET /v1/orders
スコープ: orders:read。
| クエリ | 型 | 備考 |
|---|---|---|
module | buy | sell | make | check | fix | 必須 |
status | order status | 任意のフィルター(draft、open、in_progress、waiting、completed、cancelled) |
page、page_size、search | - | 標準のリストパラメータ |
{
"data": [
{
"id": "ord_1",
"module": "sell",
"orderNumber": "SO-1042",
"status": "open",
"contactId": "con_7",
"orderDate": "2026-06-18",
"dueDate": "2026-06-25",
"siteId": null,
"priority": "normal",
"assignedTo": null,
"contact": { "id": "con_7", "name": "Globex" },
"site": null,
"createdAt": "2026-06-18T10:00:00Z",
"updatedAt": "2026-06-18T10:05:00Z"
}
],
"pagination": { "page": 1, "pageSize": 20, "total": 3, "totalPages": 1 }
}
注文は POST /v1/orders、GET /v1/orders/{order_id}、PATCH /v1/orders/{order_id}(書き込みには Idempotency-Key が必要)に加え、明細項目のための GET /v1/orders/{order_id}/lines(スコープ orders:read)もサポートします。正確なリクエストボディについては OpenAPI コントラクトを参照してください。
連絡先
GET /v1/contacts
スコープ: contacts:read。
| クエリ | 型 | 備考 |
|---|---|---|
contact_types | string | カンマ区切り: customer、supplier、both |
page、page_size、search | - | 標準のリストパラメータ |
各連絡先: id、name、email、phone、company、contactType、country、contactGroup、isPrimaryContact、isActive、updatedAt。
連絡先は POST /v1/contacts、GET /v1/contacts/{contact_id}、PATCH /v1/contacts/{contact_id}(書き込みには Idempotency-Key が必要)もサポートします。フィールドについては OpenAPI コントラクトを参照してください。
組織
GET /v1/organization
スコープ: organization:read。{ "data": { "id", "name", "slug", "plan", "createdAt" } } を返します。ここで plan は free | standard | pro | enterprise です。
使用状況
GET /v1/usage
スコープ: usage:read。現在の請求期間、リクエストの合計(全体およびケイパビリティ別)、残り予算を含むレート制限ティアを返します。レート制限を参照してください。
監査イベント
GET /v1/audit/events
スコープ: audit:read(Enterprise)。カーソルページネーション形式のエクスポート。
| クエリ | 型 | 備考 |
|---|---|---|
since、until | ISO 8601 | 時間範囲 |
action_prefix | string | アクションプレフィックスでフィルター |
actor_type | user | system | api | アクターでフィルター |
limit | integer | ページサイズ |
cursor_created_at、cursor_id | - | 前のページから再開 |
{
"data": [
{
"id": "evt_1",
"actorType": "api",
"actorId": "key_8f...",
"action": "item.created",
"resourceType": "item",
"resourceId": "a1c9...",
"metadata": {},
"ipAddress": "203.0.113.10",
"createdAt": "2026-06-19T14:02:00Z"
}
],
"pagination": { "hasMore": true, "nextCursor": { "createdAt": "2026-06-19T14:02:00Z", "id": "evt_1" } }
}
在庫
GET /v1/stock-levels
テナントのアイテムの現在の在庫レベルを返します(必要なスコープは上記の表を、フィルターとレスポンスの形状については OpenAPI コントラクトを参照してください)。
Webhook
ライフサイクルと署名の詳細はすべて Webhook に記載されています。
| メソッド | パス | スコープ |
|---|---|---|
GET | /v1/webhooks | webhooks:read |
POST | /v1/webhooks | webhooks:write(Enterprise) |
GET | /v1/webhooks/{webhook_id} | webhooks:read |
PATCH | /v1/webhooks/{webhook_id} | webhooks:write |
DELETE | /v1/webhooks/{webhook_id} | webhooks:delete |
GET | /v1/webhooks/{webhook_id}/deliveries | webhooks:deliveries:read |