Introduction
The OptiFlow API provides programmatic access to your business management system. Built on Laravel 12 with a RESTful architecture, the API enables you to manage invoices, quotations, products, contacts, inventory, and workspaces.Base URL
The OptiFlow API uses tenant-based URLs with subdomain routing:{tenant} is your organization’s unique subdomain identifier.
All API requests must include the tenant subdomain. The system uses Laravel’s
stancl/tenancy package to initialize the correct tenant context based on the subdomain.Authentication
OptiFlow uses Laravel Sanctum for API authentication. All API requests must include a valid API token in the request headers. See the Authentication page for detailed information.Request Format
All API requests should:- Use HTTPS
- Include the
Accept: application/jsonheader - Include the
Authorization: Bearer {token}header - Send request data as JSON with
Content-Type: application/json
Example Request
Response Format
All API responses are returned in JSON format. Successful responses include the requested data, while error responses include error details.Success Response
Error Response
HTTP Status Codes
The API uses standard HTTP status codes:| Status Code | Description |
|---|---|
200 | OK - Request succeeded |
201 | Created - Resource successfully created |
204 | No Content - Request succeeded with no response body |
400 | Bad Request - Invalid request data |
401 | Unauthorized - Missing or invalid authentication |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Resource does not exist |
422 | Unprocessable Entity - Validation error |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Server error |
Pagination
List endpoints support pagination using query parameters:Page number to retrieve
Number of items per page (max 100)
Paginated Response
Filtering and Sorting
Many list endpoints support filtering and sorting:Filter results by field value
Sort by field (prefix with
- for descending)Example
Rate Limiting
The API implements rate limiting to ensure fair usage:- Authenticated requests: 60 requests per minute per user
- Unauthenticated requests: 10 requests per minute per IP
429 Too Many Requests response with headers:
Multi-Tenancy Considerations
Workspace Context
Many resources (products, invoices, contacts) are further scoped to specific workspaces within a tenant. When working with these resources:- Users can only access resources in workspaces they belong to
- Some operations require specifying a
workspace_id - Stock levels and inventory are managed per workspace
Webhooks
OptiFlow supports webhooks for real-time notifications (coming soon). You’ll be able to subscribe to events like:- Invoice created/updated/paid
- Quotation converted to invoice
- Product stock low
- Payment received
SDK and Libraries
PHP SDK
Official PHP SDK for Laravel applications
JavaScript SDK
JavaScript/Node.js SDK with TypeScript support
API Versioning
The current API version is v1. Version information is included in the URL path:Future API versions will be released with a deprecation period. We’ll provide advance notice before deprecating any version.
Support
For API support:- Check the API Reference for detailed endpoint documentation
- Review our GitHub Issues
- Contact support at [email protected]
Next Steps
Authentication
Learn how to authenticate API requests
Invoices
Manage invoices via the API
Products
Create and update products
Contacts
Manage customer and supplier contacts