API Model Overview
Mini App APIs are divided into two main categories:Client-Side APIs (JSAPI)
APIs exposed to Mini App code running inside the SuperApp
Server-Side APIs (OpenAPI)
Server-to-server APIs consumed by merchant backends
Client-Side APIs (JSAPI)
JSAPI are APIs exposed to Mini App code running inside the Rebell SuperApp. They allow the Mini App to:- Interact with the SuperApp runtime
- Control navigation and UI behavior
- Access platform capabilities
- Trigger user-facing actions such as payments
Key Characteristics
Common JSAPI Categories
Authorization JSAPI
Request user authorization for scoped data access:Payment JSAPI
Trigger payment flows from the Mini App:Server-Side APIs (OpenAPI)
OpenAPI refers to server-to-server APIs exposed by Rebell and consumed by merchant backends. They are used to:- Execute secure operations
- Manage payments and transactions
- Retrieve or update backend data
- Receive asynchronous notifications
Key Characteristics
Common OpenAPI Categories
- Authentication
- User Info
- Payments
Exchange authorization codes for user context:
Typical API Interaction Pattern
Mini Apps do not operate in isolation. Most real-world flows involve both JSAPI and OpenAPI, coordinated through the merchant backend. This pattern ensures:- Sensitive operations remain server-side
- Payments are securely authorized
- Asynchronous events are handled reliably
API Scope & Responsibility
Mini Apps should always delegate:
- Business logic
- Data persistence
- Payment confirmation
Payments and Mini App APIs
Payments initiated from Mini Apps follow the same principles as standalone payments:1
Trigger
Mini App triggers the payment flow using JSAPI
2
Create
Merchant backend creates the payment using OpenAPI
3
Confirm
Final payment result is delivered via webhook
4
Update
Mini App UI is updated based on backend state
Permissions and Capability Control
Access to JSAPI capabilities may be:Permission Request Flow
Rebell enforces:- Capability-level permissions
- Runtime security checks
- Compliance validation during review
JSAPI Error Handling
All JSAPI calls should include error handling:Common Error Codes
Best Practices
Always handle errors
Always handle errors
Never assume JSAPI calls will succeed. Always provide error handlers and user feedback.
Don't trust client-side data
Don't trust client-side data
Always validate and verify data on the backend. Never trust values passed from the Mini App.
Use appropriate APIs
Use appropriate APIs
Use JSAPI for UI and user interaction. Use OpenAPI (via backend) for business operations.
Request minimal permissions
Request minimal permissions
Only request the scopes and capabilities you actually need.
Handle offline gracefully
Handle offline gracefully
Design your Mini App to handle network failures gracefully with appropriate user feedback.
Next Steps
With an understanding of Mini App APIs, proceed to implement secure backend authentication:Backend Authentication
Implement the authCode exchange flow
Payments in Mini Apps
Integrate payment functionality