1. Overview
The Genuka API is a multi-tenant REST API for building commerce, inventory, messaging, and accounting integrations on top of the Genuka platform. All responses are JSON. Production base URLapi.genuka.com. There is no separate sandbox URL.
2. Versioning
The API uses date-based path versioning. Every resource endpoint is nested under the version prefix:2023-11 is the current stable version. Breaking changes will be introduced under a new date prefix while the previous version remains accessible during a deprecation period.
3. Authentication
The API uses Laravel Passport personal access tokens (Bearer JWT). You must include a valid token on every authenticated request.Obtaining a token
Send aPOST request to the login endpoint:
plainTextToken (the token you store and reuse) along with the user’s companyId:
plainTextToken securely. Include it in every subsequent request as a Bearer token.
For full authentication details — registration, PIN login, password reset, multi-company users — see 02-authentication.md.
4. Required Headers
Every authenticated request to the admin API must include all four headers below.
Example authenticated request
5. Multi-Tenancy
The Genuka API is multi-tenant. Each company is an isolated tenant. All data — products, orders, customers, payments, etc. — is scoped to the company identified byX-Company.
How it works
- The
X-Companyheader value is read by theCheckCurrentCompanymiddleware and injected ascompanyIdinto the request context. - Eloquent global scopes (via
CompanyScope) automatically appendWHERE company_id = ?to every query for scoped models. - The
ownermiddleware (applied to the/adminroute group) additionally verifies that the authenticated user belongs to that company. If the user’s company does not matchX-Company, the request is rejected with HTTP 401.
6. Pagination
All paginated list endpoints return the same JSON envelope. The API does not use the default Laraveldata/links/meta wrapper. It uses a custom pagination object:
Pagination query parameters
Example
simple_paginate=1 which returns a cursor-based response without a total count (faster on very large tables).
7. Filtering, Sorting, and Search
The API uses Spatie Laravel Query Builder conventions. Parameters are namespaced with brackets.Filtering
Sorting
Including relationships
Field selection
Date range filtering
Many index endpoints acceptstartDate and endDate parameters (ISO 8601 format):
8. Error Handling
The API returns a consistent JSON error envelope for all error responses.Error envelope shape
errors object with per-field messages:
HTTP status codes
401 example
9. Data Formats
Resource IDs — ULIDs
All resource identifiers are ULIDs — 26-character alphanumeric strings that are lexicographically sortable by creation time.Timestamps
All timestamps are returned in ISO 8601 format, UTC:Money / Prices
Monetary amounts (prices, order totals, payment amounts) are stored and returned as decimal numbers (floating point, two decimal places). There is no integer-cent encoding.10. Rate Limiting
Theapi middleware group applies throttling to all /2023-11 routes via Laravel’s rate limiter.
When the limit is exceeded, the server responds with HTTP 429. Laravel includes standard rate-limit headers in responses:
