v1Beta

KiNG FLEXY GH
Developer API

Purchase data bundles programmatically. Integrate directly into your apps using your wallet balance and agent pricing.

Base URLhttps://kingflexygh.com/api/v1
Authentication Header
Authorization: kf_live_your_api_key_here
Section:Authentication

1Authentication

All API requests must include your API key in the Authorization header — no Bearer prefix required.

Authorization: kf_live_your_api_key_here
⚠️

Important: Your API key is shown only once when generated. Store it securely — losing it requires generating a new key, which permanently revokes the old one.

Getting Your API Key

  1. 1Log in to your KingFlexyGh account (agent role required)
  2. 2Navigate to Dashboard → Developer API
  3. 3Click Generate API Key and accept the policy
  4. 4Copy and store the key — it will not be shown again
  5. 5Wait for admin approval (status: pending → active)

2Response Format

All responses follow a consistent JSON structure:

Success

{
  "success": true,
  "data": { ... },
  "meta": {
    "timestamp": "2026-...",
    "version": "v1"
  }
}

Error

{
  "success": false,
  "error": {
    "code": 400,
    "message": "..."
  }
}

3Endpoints

Five endpoints — all require a valid API key in the Authorization header.

GET/api/v1/packages

List all available data packages with pricing for your account role. Call this first to discover valid network and size combinations.

Query Parameters

networkstringoptionalFilter by network: MTN, Telecel, AT-iShare, AT-BigTime (case-sensitive)
size_gbnumberoptionalFilter by exact GB size e.g. 5

Response

{
  "success": true,
  "data": {
    "packages": [
      {
        "id": "uuid-...",
        "network": "MTN",
        "size": "5GB",
        "volume_gb": 5,
        "price": 4.50,
        "currency": "GHS"
      }
    ],
    "total": 12
  }
}
  • Price is your role-specific price (agent, dealer, or standard customer).
  • Only packages with is_available = true are returned.
  • Use this to validate network/size combinations before placing orders.

Code Sample

cURL
# All packages
curl -X GET https://kingflexygh.com/api/v1/packages \
  -H "Authorization: kf_live_your_api_key_here"

# Filter by network
curl -X GET "https://kingflexygh.com/api/v1/packages?network=MTN" \
  -H "Authorization: kf_live_your_api_key_here"

# Filter by network + size
curl -X GET "https://kingflexygh.com/api/v1/packages?network=MTN&size_gb=5" \
  -H "Authorization: kf_live_your_api_key_here"
POST/api/v1/data/purchase

Purchase a single data bundle for a recipient phone number. Deducts from your wallet instantly.

Request Body

{
  "network": "MTN",
  "volume_gb": 5,
  "recipient": "0551617309",
  "reference": "order_001"
}

Response

{
  "success": true,
  "data": {
    "order_id": "uuid-...",
    "reference": "order_001",
    "status": "pending",
    "network": "MTN",
    "size": "5GB",
    "recipient": "0551617309",
    "price": 4.50,
    "new_balance": 120.50
  }
}
  • reference is your idempotency key — sending the same reference twice returns the existing order without double-charging.
  • network must be one of: MTN, Telecel, AT-iShare, AT-BigTime (case-sensitive).
  • volume_gb must match an available package. Use GET /packages to confirm.
  • recipient must be a valid Ghana number: 0XXXXXXXXX (10 digits, starts with 0).

Code Sample

cURL
curl -X POST https://kingflexygh.com/api/v1/data/purchase \
  -H "Authorization: kf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "network": "MTN",
    "volume_gb": 5,
    "recipient": "0551617309",
    "reference": "order_001"
  }'
POST/api/v1/data/bulk

Purchase up to 100 data bundles in a single atomic batch. Total cost is deducted at once — either all succeed or none.

Request Body

{
  "orders": [
    {
      "network": "MTN",
      "volume_gb": 5,
      "recipient": "0551617309",
      "reference": "b_001"
    },
    {
      "network": "Telecel",
      "volume_gb": 2,
      "recipient": "0201234567",
      "reference": "b_002"
    }
  ]
}

Response

{
  "success": true,
  "data": {
    "orders_placed": 2,
    "total_cost": 7.00,
    "new_balance": 113.50,
    "orders": [
      { "order_id": "...", "reference": "b_001", "status": "pending" }
    ]
  }
}
  • Maximum 100 orders per batch request.
  • Atomic: if any order fails validation, none are charged.
  • Each order in the array follows the same rules as single purchase.

Code Sample

cURL
curl -X POST https://kingflexygh.com/api/v1/data/bulk \
  -H "Authorization: kf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "orders": [
      {"network":"MTN","volume_gb":5,"recipient":"0551617309","reference":"b_001"},
      {"network":"Telecel","volume_gb":2,"recipient":"0201234567","reference":"b_002"}
    ]
  }'
GET/api/v1/wallet/balance

Retrieve your current wallet balance in GHS. Use before large orders to verify you have sufficient funds.

Response

{
  "success": true,
  "data": {
    "balance": 124.50,
    "currency": "GHS"
  }
}
  • Top up your wallet via the web dashboard at kingflexygh.com/dashboard/wallet.
  • Check balance before bulk orders to prevent partial failures due to insufficient funds.

Code Sample

cURL
curl -X GET https://kingflexygh.com/api/v1/wallet/balance \
  -H "Authorization: kf_live_your_api_key_here"
GET/api/v1/orders/{reference}

Check the fulfillment status of an order using the reference code you provided when placing it.

Response

{
  "success": true,
  "data": {
    "order_id": "uuid-...",
    "reference": "order_001",
    "status": "completed",
    "network": "MTN",
    "size": "5GB",
    "recipient": "0551617309",
    "price": 4.50,
    "source": "api",
    "created_at": "2026-..."
  }
}
  • Use the same reference you passed when calling /data/purchase or /data/bulk.
  • Status values: pending → processing → completed | failed.
  • Poll this endpoint after placing an order to confirm delivery.

Code Sample

cURL
curl -X GET https://kingflexygh.com/api/v1/orders/your_reference_here \
  -H "Authorization: kf_live_your_api_key_here"

4Supported Networks

Network ValueProviderNotes
"MTN"MTN GhanaMost widely available bundles
"Telecel"Telecel Ghana (formerly Vodafone)
"AT-iShare"AirtelTigo iShareAirtelTigo bundle type 1
"AT-BigTime"AirtelTigo BigTimeAirtelTigo bundle type 2
Network values are case-sensitive. Use GET /packages to see exactly which networks and sizes are currently available.

5Error Codes

CodeWhen it occurs
400Bad request — invalid phone, volume_gb, network value, or malformed body
401Missing or invalid API key
403Key pending approval, revoked, suspended account, or role not allowed
404Package or order not found for the given network/size/reference
409Duplicate reference — an order with this reference already exists
429Rate limit exceeded — back off and retry after a short delay
500Internal server error — contact support if persistent
503API feature temporarily disabled by administrator

6Full Examples

Complete runnable data purchase example. Select your language.

cURL
curl -X POST https://kingflexygh.com/api/v1/data/purchase \
  -H "Authorization: kf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "network": "MTN",
    "volume_gb": 5,
    "recipient": "0551617309",
    "reference": "order_001"
  }'

Ready to start building?

© 2026 KiNG FLEXY TECHNOLOGIES LTD · Need help? Contact support via your dashboard.