Introduction
The OpenCart API provides a comprehensive REST-based interface for managing your e-commerce store programmatically. It enables developers to integrate OpenCart with external systems, build custom applications, and automate store operations.Base URL
All API requests should be made to:API Architecture
The OpenCart API follows a stateful session-based architecture:- Session Management - API operations maintain session state
- Controller-Based - Each API endpoint is implemented as a controller
- JSON Responses - All responses are returned in JSON format
- Validation - Comprehensive input validation and error handling
Available API Groups
Catalog API
Manage products, categories, and manufacturers
Sales API
Handle cart, orders, customers, and checkout operations
Account API
Manage customer authentication, addresses, and wishlists
Localization API
Access currencies, countries, and zones data
API Workflow
A typical API workflow for creating an order:Response Format
All API endpoints return JSON responses with a consistent structure:Success Response
Error Response
Key Features
Cart Management
Cart Management
Add products, manage quantities, apply discounts, and calculate totals with full support for product options and subscriptions.
Order Processing
Order Processing
Complete checkout flow including customer data, addresses, shipping methods, payment methods, and order confirmation.
Catalog Access
Catalog Access
Retrieve product information, categories, manufacturers, and apply filters for product searches.
Customer Management
Customer Management
Handle customer authentication, profile data, addresses, and wishlists.
Validation
The API includes comprehensive validation:- Length Validation - Using
oc_validate_length()for string fields - Email Validation - Using
oc_validate_email()for email addresses - Regex Validation - Custom validation patterns for specific fields
- Stock Validation - Automatic stock checking for products
- Address Validation - Country and zone validation
The API is designed for server-to-server communication. All session data is stored server-side and managed through the session system.
Next Steps
Authentication
Learn how to authenticate API requests
Error Handling
Understand error codes and handling
Cart API
Start with cart operations
Orders API
Learn order management

