This documentation covers the external API endpoints for airtime selling flows in the Cronos system. These APIs are designed for external clients to integrate airtime recharge functionality.
http://api.omega.sendai.co.zw
The API uses PIN-based authentication with JWT tokens. All airtime operations require authentication.
- Authenticate using PIN to get JWT token
- Include JWT token in Authorization header for subsequent requests
- Token format:
Bearer <jwt_token>
Authenticate user with phone number and PIN to obtain JWT token.
Endpoint: POST /auth/pin-authentication
Request Body:
{
"phone": "+263771234567",
"pin": "1234"
}
Request Validation:
phone
: Required, must be valid phone number formatpin
: Required
Response (Success - 200):
{
"status": "success",
"message": "authenticated",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_at": "2024-01-01T12:00:00Z"
}
}
Response (Error - 401):
{
"message": "Invalid credentials"
}
Reset user's PIN (sends new PIN via configured method).
Endpoint: POST /auth/pin-reset
Request Body:
{
"phone": "+263771234567"
}
Request Validation:
phone
: Required, must be valid phone number format
Response (Success - 200):
{
"status": "success",
"message": "pin was rest successfully",
"data": null
}
Response (Error - 422):
{
"message": "User not found"
}
Get authenticated user information.
Endpoint: GET /auth/user
Headers:
Authorization: Bearer <jwt_token>
Response (Success - 200):
{
"status": "success",
"message": "user retrieved",
"data": {
"id": "user-id",
"email": "[email protected]",
"phone": "+263771234567",
"account_id": "account-id"
}
}
Credit airtime to a phone number.
Endpoint: POST /api/v1/recharges/airtime
Headers:
Authorization: Bearer <jwt_token>
Request Body:
{
"phone": "+263771234567",
"amount": 100,
"currency": "USD",
"reference": "unique-reference-123"
}
Request Validation:
phone
: Required, must be valid phone number formatamount
: Required, integer amount in cents/smallest currency unitcurrency
: Required, currency code (e.g., "USD", "ZWL")reference
: Required, unique transaction reference
Response (Success - 200):
{
"status": "success",
"message": "successful airtime recharge",
"data": {
"transaction_id": "txn-12345",
"reference": "unique-reference-123",
"phone": "+263771234567"
}
}
Response (Insufficient Funds - 422):
{
"status": "error",
"message": "Insufficient funds",
"data": null
}
Response (Wallet Not Found - 422):
{
"status": "error",
"message": "Wallet not found",
"data": null
}
Rate Limiting: This endpoint is rate-limited based on server configuration.
Process multiple airtime recharges in batch.
Endpoint: POST /api/v1/recharges/airtime/batch
Request Body:
{
"account": "account-id",
"recharges": [
{
"phone": "+263771234567",
"amount": 100,
"currency": "USD",
"reference": "ref-001"
},
{
"phone": "+263779876543",
"amount": 200,
"currency": "USD",
"reference": "ref-002"
}
]
}
Response (Success - 200):
{
"status": "success",
"message": "batch recharge created",
"data": {
"batch_id": "batch-12345",
"total_count": 2,
"status": "processing"
}
}
{
"status": "error",
"message": "Error description",
"data": null
}
200
- Success400
- Bad Request (validation errors)401
- Unauthorized (authentication required/invalid)422
- Unprocessable Entity (business logic errors)429
- Too Many Requests (rate limited)500
- Internal Server Error
- Invalid Phone Number: Phone number format validation fails
- Insufficient Funds: User's wallet balance is insufficient for the recharge
- Wallet Not Found: User doesn't have a wallet in the specified currency
- Rate Limiting: Too many requests in the rate limit window
- Invalid PIN: Authentication fails due to incorrect PIN
- User Not Found: Phone number is not registered in the system
- Must be in international format (e.g., +263771234567)
- System validates phone number format before processing
- Amounts are specified in the smallest currency unit (cents for USD, etc.)
- Supported currencies depend on server configuration
- Must be unique per transaction
- Used for idempotency and tracking
- Recommended format: timestamp-based or UUID
- Store JWT tokens securely
- Handle token expiration gracefully
- Implement proper logout functionality
- Single airtime endpoint has rate limiting enabled
- Monitor response headers for rate limit information
- Implement proper backoff strategies
- All communication must be over HTTPS
- JWT tokens have expiration times
- PIN-based authentication provides additional security layer
- Rate limiting prevents abuse