API-Referenz
Vollständige Referenz für die öffentliche FabHub-API. Das gebrandete Portal ist kanonisch; Sie können den maschinenlesbaren Vertrag auch in einen beliebigen OpenAPI-Viewer laden (Swagger Editor, Redoc, Postman oder Ihre IDE).
Basis-URL
https://api.fabhub.app/v1
Konventionen
- Authentifizieren Sie sich mit
X-API-Key(oderAuthorization: Bearer). Siehe Authentifizierung. - Anfrage-Bodies sind JSON mit
camelCase-Schlüsseln; Listenfilter sindsnake_case-Query-Parameter. - Listenendpunkte sind seitenbasiert und geben ein
pagination-Objekt zurück; siehe Paginierung. - Schreibendpunkte erfordern einen
Idempotency-Key-Header; siehe Idempotenz. - Fehler verwenden eine stabile Hülle mit einem maschinenlesbaren
code; siehe Fehler.
Alle Endpunkte
Diese Tabelle wird aus dem OpenAPI-Vertrag generiert und listet immer jede öffentliche Operation und ihren erforderlichen Scope auf. Die folgenden Abschnitte sind ausgearbeitete Beispiele für die häufigsten Ressourcen; der OpenAPI-Vertrag ist die vollständige Quelle für Anfrage- und Antwortschemata.
| Methode | Pfad | Scope |
|---|---|---|
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 |
Service
GET /v1
Gibt die Fähigkeiten (Methode, Pfad, Scope) zurück, die die aufrufende Anmeldeinformation nutzen kann. Kein Scope erforderlich.
GET /v1/auth/context
Gibt Tenant, Plan, Scopes, Ratenlimit-Stufe und Ablaufdatum der aufrufenden Anmeldeinformation zurück. Kein Scope erforderlich. Siehe das Beispiel im Schnellstart.
Items
GET /v1/items
Scope: items:read. Listet Artikel auf (Produkte, Materialien, Kombinationen).
| Query | Typ | Hinweise |
|---|---|---|
page | integer | 1-basierte Seitenzahl (Standard 1) |
page_size | integer | Artikel pro Seite (Standard 20) |
search | string | Volltext-Übereinstimmung auf Name/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
Scope: items:write. Erfordert Idempotency-Key. Erstellt einen Artikel.
| Body-Feld | Typ | Hinweise |
|---|---|---|
name | string | Erforderlich |
itemType | product | material | combo | Standardmäßig product |
sku, mpn, barcode | string | null | Optionale Identifikatoren |
categoryId, unitId, supplierId | string | null | Optionale Referenzen |
salePrice, purchasePrice | number | null | Optionale Preisangaben |
supplierCode, notes | string | null | Optional |
isActive | boolean | Standardmäßig 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}'
Gibt { "data": { ...item } } mit dem erstellten Artikel zurück.
GET /v1/items/{item_id}
Scope: items:read. Gibt { "data": { ...item } } zurück, oder 404 mit code: "NOT_FOUND".
PATCH /v1/items/{item_id}
Scope: items:write. Erfordert Idempotency-Key. Akzeptiert eine beliebige Teilmenge der Erstellungsfelder und gibt den aktualisierten Artikel zurück.
Artikel-Unterressourcen
GET /v1/items/{item_id}/ingredients(Scopeitems:read) - Komponenten für einencombo-/gefertigten Artikel.GET /v1/items/{item_id}/suppliers(Scopeitems:read) - mit einem Artikel verknüpfte Lieferanten.
Orders
GET /v1/orders
Scope: orders:read.
| Query | Typ | Hinweise |
|---|---|---|
module | buy | sell | make | check | fix | Erforderlich |
status | order status | Optionaler Filter (draft, open, in_progress, waiting, completed, cancelled) |
page, page_size, search | - | Standard-Listenparameter |
{
"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 }
}
Aufträge unterstützen außerdem POST /v1/orders, GET /v1/orders/{order_id} und PATCH /v1/orders/{order_id} (Schreibvorgänge erfordern Idempotency-Key) sowie GET /v1/orders/{order_id}/lines (Scope orders:read) für Auftragspositionen. Siehe den OpenAPI-Vertrag für die genauen Anfrage-Bodies.
Contacts
GET /v1/contacts
Scope: contacts:read.
| Query | Typ | Hinweise |
|---|---|---|
contact_types | string | Kommagetrennt: customer, supplier, both |
page, page_size, search | - | Standard-Listenparameter |
Jeder Kontakt: id, name, email, phone, company, contactType, country, contactGroup, isPrimaryContact, isActive, updatedAt.
Kontakte unterstützen außerdem POST /v1/contacts, GET /v1/contacts/{contact_id} und PATCH /v1/contacts/{contact_id} (Schreibvorgänge erfordern Idempotency-Key); siehe den OpenAPI-Vertrag für die Felder.
Organization
GET /v1/organization
Scope: organization:read. Gibt { "data": { "id", "name", "slug", "plan", "createdAt" } } zurück, wobei plan free | standard | pro | enterprise ist.
Usage
GET /v1/usage
Scope: usage:read. Gibt den aktuellen Abrechnungszeitraum, die Anfragesummen (insgesamt und nach Fähigkeit) und die Ratenlimit-Stufe mit dem verbleibenden Budget zurück. Siehe Ratenlimits.
Audit-Ereignisse
GET /v1/audit/events
Scope: audit:read (Enterprise). Cursorpaginierter Export.
| Query | Typ | Hinweise |
|---|---|---|
since, until | ISO 8601 | Zeitfenster |
action_prefix | string | Nach Aktionspräfix filtern |
actor_type | user | system | api | Nach Akteur filtern |
limit | integer | Seitengröße |
cursor_created_at, cursor_id | - | Von einer vorherigen Seite fortsetzen |
{
"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" } }
}
Stock
GET /v1/stock-levels
Gibt die aktuellen Lagerbestände für die Artikel des Tenants zurück (siehe die Tabelle oben für den erforderlichen Scope und den OpenAPI-Vertrag für Filter und die Antwortform).
Webhooks
Vollständige Details zum Lebenszyklus und zur Signierung finden Sie unter Webhooks.
| Methode | Pfad | Scope |
|---|---|---|
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 |