Developer API Guide
Connect your existing tools, e-commerce platforms, and internal systems to the AWRA OpsHub ecosystem. Our API provides secure, reliable access to your inventory data and real-time events.
Introduction
The AWRA OpsHub API is designed to allow developers to build powerful integrations on top of our smart inventory and procurement platform. Whether you are looking to sync stock levels with a Shopify store, automate purchase orders from an ERP, or receive real-time notifications via webhooks, our API provides the necessary endpoints to make it happen.
Our API follows RESTful principles and uses standard HTTP methods. All responses are returned in JSON format, ensuring compatibility with modern programming languages and frameworks. We prioritize security and multi-tenancy, meaning your data is always isolated and protected behind robust authentication layers.
Authentication
To interact with the AWRA OpsHub API, you must first obtain a Sanctum API Token. These tokens act as your digital keys and should be kept secure. You can generate a token through your account settings or by using the authentication endpoint for programmatic access.
Once you have your token, you must include it in the header of every request using the Authorization field:
Security Note: Always use HTTPS for all API calls. Never expose your tokens in client-side code (like frontend JavaScript). If you believe a token has been compromised, revoke it immediately via the AWRA OpsHub dashboard.
Core Endpoints
GET Query Stock Level
Retrieve the real-time stock status of a specific item using its SKU or Barcode. This is ideal for external storefronts that need to check availability before confirming a sale.
Example Response:
{
"sku": "ITEM-001",
"name": "Industrial Widget A",
"stock_level": 150
}
POST Register Webhook
Stay updated in real-time by registering a Webhook. Instead of polling our API, we will "push" information to your server whenever a specific event occurs (e.g., stock running low or a purchase order being approved).
Request Body (JSON):
{
"url": "https://your-server.com/api/webhooks/awra",
"event_type": "stock.low",
"secret": "your-custom-secret-key"
}
GET List Categories
Retrieve a list of all item categories. This is helpful for building filter menus or navigation structures on your storefront.
GET Search Items
Search for items by name, description, or SKU. This endpoint supports pagination to handle large inventories efficiently.
Technical Considerations
Rate Limiting
To ensure system stability, our API is rate-limited. By default, clients are allowed up to 60 requests per minute.
If you exceed this, you will receive a 429 Too Many Requests response.
Pagination
Endpoints that return lists (like Search) are paginated. We return 20 items per page by default.
Use the page query parameter to navigate through the results.
Error Handling
Errors follow a standard structure, providing a descriptive message and, where applicable, a machine-readable code.
{ "message": "Item not found" }
JSON Content-Type
Always ensure your requests include the Accept: application/json header to receive proper error messages.
Integration Examples
PHP (cURL)
cURL (Command Line)
Need More Technical Details?
If you are an administrator, you can access the full interactive Swagger documentation to test endpoints directly from your browser.
View Swagger Documentation (Admin Only)