Overview
This guide shows you exactly what to change when migrating from OneClickDz Flexy API v2 to v3. Each example shows your current v2 code, lists what to change, and shows the v3 result. Available in multiple languages: JavaScript/Node.js, PHP, and Python examples included.API v2 Deprecation: API v2 will be deprecated on October 30, 2026.
Please migrate before this date to avoid service interruption.
What’s New in v3
Standardized Responses
All responses wrapped in
{(success, data, meta, requestId)} structureBetter Error Handling
Structured errors with codes, messages, and details for easier debugging
Enhanced Debugging
Every response includes timestamps and unique request IDs
Cleaner Endpoints
Logical grouping:
/mobile/*, /internet/*, /gift-cards/*, /account/*Separate API Keys
Generate dedicated sandbox keys for testing while keeping your production key
IP Whitelisting
Add IP restrictions directly from the settings page for enhanced security
Quick Migration Checklist
1
Generate Sandbox API Key (Optional)
Create a sandbox API key from your dashboard settings page for testing v3 before migrating production
2
Configure IP Whitelist (Optional)
Add IP restrictions for enhanced security directly from settings
3
Update Authentication Header
Change from
authorization to X-Access-Token in all API requests4
Update Response Handling
Access data through
result.data instead of directly from the response5
Update Error Handling
Check
result.success boolean and handle structured result.error object6
Update Endpoint Paths
Map v2 paths to new v3 paths (see complete reference table below)
7
Update Pagination Logic
Access pagination info from
result.data.pagination instead of root levelChoose Your Migration Strategy
Good News: Both v2 and v3 APIs work simultaneously until v2 deprecation.
Your current production API key works with both v2 and v3 endpoints, giving you flexibility in how you migrate.
Base URL Change: v3 uses a new base URL: - v2:
https://flexy-api.oneclickdz.com/v2 - v3: https://api.oneclickdz.com/v3New Security Features: v3 introduces separate sandbox API key management for testing, plus IP whitelisting directly from your dashboard settings page. Your production key continues to work with both v2 and v3.
🆕 Fresh Start
Best for: Complete rebuild or new projects
- Generate sandbox key for testing from settings
- Configure IP whitelist for production key
- Test everything in sandbox with v3
- Use production key when ready to go live
🔄 Gradual Migration
Best for: Existing production systems
- Keep using current production key for v2 endpoints
- Generate sandbox key to test v3 endpoints safely
- Migrate endpoints one by one to v3
- Run v2 and v3 side-by-side with same production key
Smart Migration: Start with Gift Cards
Pro Tip: If you’re interested in gift cards, integrate them on v3 first! You don’t need to migrate your existing mobile and internet top-ups to start using gift cards on v3. This gives you a low-risk way to test v3 while keeping your critical operations on v2. Use your sandbox key to test, then switch to production when ready.
- Phase 1: Integrate gift cards on v3 (if applicable)
- Generate sandbox key for testing
- Use
/v3/gift-cards/*endpoints in sandbox - Test thoroughly, then use production key
- Keep mobile/internet on v2
- Phase 2: Migrate account & validation endpoints
/v3/validate/v3/account/balance/v3/account/transactions
- Phase 3: Migrate mobile top-ups gradually
- Test with low-volume operations first
- Monitor for issues
- Scale up migration
- Phase 4: Migrate internet top-ups
- Complete before deprecation deadline
The 3 Main Changes
1. Authentication Header
What to change: Rename the header fromauthorization to X-Access-Token
New Key Management: v3 allows you to generate a separate sandbox API key for testing from your dashboard settings. You can also add IP whitelist restrictions for enhanced security. Your existing production API key works with both v2 and v3 endpoints.
- JavaScript
- PHP
- Python
- ❌ Remove:
authorization: "YOUR_API_KEY" - ✅ Add:
X-Access-Token: "YOUR_API_KEY" - ✅ Update: Base URL to
https://api.oneclickdz.com/v3
The authentication mechanism remains the same - only the header name changes. Your existing API key works with both v2 and v3.
- JavaScript
- PHP
- Python
2. Response Structure
What to change: All responses are now wrapped in a standard structure- JavaScript
- PHP
- Python
- ❌ Remove: Direct access to
data.balance - ✅ Add: Check
result.successfirst - ✅ Add: Access through
result.data.balance - ✅ Bonus: Use
result.requestIdfor debugging - ✅ Bonus: Use
result.meta.timestampfor timing info
Breaking Change: In v3, you must always check the
success boolean before
accessing data. Direct field access will cause errors if the request failed.- JavaScript
- PHP
- Python
3. Error Handling
What to change: Errors are now structured objects with codes- JavaScript
- PHP
- Python
- ❌ Remove: Checking
result.errorstring - ✅ Add: Check
result.success === false - ✅ Add: Access
result.error.codeandresult.error.message - ✅ Add: Handle different error codes with switch/if statements
- ✅ Add: Log
result.requestIdfor support tickets
Pro Tip: Always save the
requestId when logging errors. Our support team
needs this to trace issues in our system.- JavaScript
- PHP
- Python
Step-by-Step Migration Examples
Example 1: Get Mobile Plans
Step 1 - Your current v2 code:- JavaScript
- PHP
- Python
- Change base URL:
https://flexy-api.oneclickdz.com→https://api.oneclickdz.com - Change endpoint:
/v2/plans/listAll→/v3/mobile/plans - Change header:
authorization→X-Access-Token - Add success check:
if (result.success) - Access through data:
data.dymanicPlans→result.data.dynamicPlans(typo fixed!)
MUST Fix: v3 fixes the typo in “dymanicPlans” to “dynamicPlans”. Update
your code to use the correct spelling.
- JavaScript
- PHP
- Python
Example 2: Send Mobile Top-Up
Step 1 - Your current v2 code:- JavaScript
- PHP
- Python
- Change base URL:
https://flexy-api.oneclickdz.com→https://api.oneclickdz.com - Change endpoint:
/v2/topup/sendTopup→/v3/mobile/send - Change header:
authorization→X-Access-Token - Add success check:
if (result.success) - Access through data:
data.topupId→result.data.topupId - Add comprehensive error handling
Important: Always handle errors when sending top-ups. Network issues,
insufficient balance, or invalid data can cause failures. Save the
requestId
for tracking.- JavaScript
- PHP
- Python
Example 3: Check Top-Up Status
Step 1 - Your current v2 code:- JavaScript
- PHP
- Python
- Change base URL:
https://flexy-api.oneclickdz.com→https://api.oneclickdz.com - Change endpoint:
/v2/topup/checkStatus/REF/:ref→/v3/mobile/check-ref/:ref - Change header:
authorization→X-Access-Token - Add success check:
if (result.success) - Access directly:
data.topup.status→result.data.status(no more nestedtopupobject) - Handle new refund information fields
New Feature: v3 includes detailed refund information with suggested
alternative offers when a top-up is refunded.
- JavaScript
- PHP
- Python
Example 4: List Transactions with Pagination
Step 1 - Your current v2 code:- JavaScript
- PHP
- Python
- Change base URL:
https://flexy-api.oneclickdz.com→https://api.oneclickdz.com - Change version:
/v2/account/transactions→/v3/account/transactions - Change header:
authorization→X-Access-Token - Add success check:
if (result.success) - Access items:
data.transactions→result.data.items - Access pagination: Root level fields →
result.data.paginationobject
Breaking Change: Pagination structure has moved from root level to
data.pagination. Update all list/pagination logic.- JavaScript
- PHP
- Python
Example 5: Check Internet Products
Step 1 - Your current v2 code:- JavaScript
- PHP
- Python
- Change base URL:
https://flexy-api.oneclickdz.com→https://api.oneclickdz.com - Change endpoint:
/v2/internet/checkCards/:type→/v3/internet/products?type=:type - Change from path param to query param:
/ADSL→?type=ADSL - Change header:
authorization→X-Access-Token - Add success check:
if (result.success) - Access array: Direct array →
result.data.products
API Design: v3 uses query parameters instead of path parameters for type
selection, making it easier to add filters in the future.
- JavaScript
- PHP
- Python
Migrate Your API Client
Here’s how to update your API client wrapper: Step 1 - Your current v2 client:- JavaScript
- PHP
- Python
- Change base URL:
https://flexy-api.oneclickdz.com→https://api.oneclickdz.com - Change header:
authorization→X-Access-Token - Add response wrapper handling in
request()method - Check
result.successand handle errors - Update all endpoint paths to v3
- Throw structured errors with codes and request IDs
Best Practice: Centralize error handling in your API client. This makes it
easier to add logging, monitoring, and user notifications.
- JavaScript
- PHP
- Python
Complete Endpoint Reference
| Service | v2 Endpoint | v3 Endpoint | Notes |
|---|---|---|---|
| Authentication | |||
| Header | authorization: KEY | X-Access-Token: KEY | Header name changed |
| Validate | GET /v2/validate | GET /v3/validate | Response wrapped |
| Mobile | |||
| List Plans | GET /v2/plans/listAll | GET /v3/mobile/plans | Path changed, typo fixed |
| Send Top-Up | POST /v2/topup/sendTopup | POST /v3/mobile/send | Path simplified |
| Check by Ref | GET /v2/topup/checkStatus/REF/:ref | GET /v3/mobile/check-ref/:ref | Path simplified, refund info added |
| Check by ID | GET /v2/topup/checkStatus/ID/:id | GET /v3/mobile/check-id/:id | Path simplified |
| List Top-Ups | GET /v2/topup/list | GET /v3/mobile/list | Pagination moved to data.pagination |
| Internet | |||
| Products | GET /v2/internet/checkCards/:type | GET /v3/internet/products?type= | Path param → query param |
| Check Number | GET /v2/internet/checkNumber/:t/:n | GET /v3/internet/check-number?type=&number= | Path params → query params |
| Send | POST /v2/internet/sendTopup | POST /v3/internet/send | Path simplified |
| Check by Ref | GET /v2/internet/checkStatus/REF/:ref | GET /v3/internet/check-ref/:ref | Path simplified |
| Check by ID | GET /v2/internet/checkStatus/ID/:id | GET /v3/internet/check-id/:id | Path simplified |
| List | GET /v2/internet/list | GET /v3/internet/list | Pagination moved |
| Gift Cards | |||
| Catalog | GET /v2/gift-cards/catalogue | GET /v3/gift-cards/catalog | Spelling fixed |
| Check Product | GET /v2/gift-cards/checkProduct/:id | GET /v3/gift-cards/checkProduct/:id | Response wrapped |
| Place Order | POST /v2/gift-cards/placeOrder | POST /v3/gift-cards/placeOrder | Response wrapped |
| Check Order | GET /v2/gift-cards/checkOrder/:id | GET /v3/gift-cards/checkOrder/:id | Response wrapped |
| List Orders | GET /v2/gift-cards/list | GET /v3/gift-cards/list | Pagination moved |
| Account | |||
| Balance | GET /v2/account/balance | GET /v3/account/balance | Response wrapped |
| Transactions | GET /v2/account/transactions | GET /v3/account/transactions | Pagination moved |
Error Code Reference
Common v2 errors and their v3 equivalents:| v2 Error | v3 Error Code | What Changed |
|---|---|---|
"NO-BALANCE" | INSUFFICIENT_BALANCE | Now a code with structured message |
"DUPLICATED-REF" | DUPLICATED_REF | Same code, now with details object |
"ERR_VALIDATION" | ERR_VALIDATION | Includes details.field and `details.pattern |
"ERR_PHONE" | ERR_PHONE | Includes validation pattern in details |
"ERR_STOCK" | ERR_STOCK | Product availability information |
"Forbidden" | ERR_AUTH | More descriptive, unified auth errors |
"Access token missing" | ERR_AUTH | Same code for all auth errors |
"NOT_FOUND" | NOT_FOUND | Resource not found (order, product, etc.) |
- JavaScript
- PHP
- Python
Critical Deadline: After October 30, 2026, all v2 API requests will fail.
Plan your migration accordingly to avoid service disruption.
Common Migration Issues & Solutions
Issue: Getting 401 Unauthorized Errors
Issue: Getting 401 Unauthorized Errors
Issue: Getting 'undefined' When Accessing Data
Issue: Getting 'undefined' When Accessing Data
Problem: Trying to access data directly instead of through
result.data.
Solution: Always access response data through the data property.❌ Wrong const balance = result.balance; ✅ Correct const
Issue: 404 Not Found Errors
Issue: 404 Not Found Errors
Problem: Using old v2 endpoint paths.Solution: Update all paths according to the reference table above.
Testing Checklist
Before deploying to production, verify:- All authentication headers changed to
X-Access-Token - All endpoint paths updated to v3
- Success/error checking implemented everywhere
- Data accessed through
result.data - Pagination accessed through
result.data.pagination - Error codes handled with
result.error.code - Request IDs logged for debugging
- Tested in sandbox mode first
- All existing functionality still works
- Error scenarios tested (insufficient balance, invalid data, etc.)
Need Help?
API v3 Documentation
Complete v3 API reference and examples
Error Handling Guide
Best practices for error handling
Dashboard Settings
Access: Login to your dashboardGenerate Sandbox Key: Create a sandbox key for safe testingIP Whitelist: Add IP restrictions for enhanced security
Support
Email: [email protected]Important: Always include your request ID when reporting issues
Migration Support: Our team is here to help! Email us with “API v3
Migration Support” in the subject line, and include: - Your current
implementation details - Specific errors (with request IDs) - Code samples
showing the issue

