Skip to Content

Quickstart

Make your first top-up in the sandbox, then go live.

The sandbox behaves like production but never moves money or calls an operator. Build and test everything with a sandbox key first.

Create a sandbox key

Open Settings → Partner API in your dashboard. In the API keys (v3) card, click Create key and choose the type Sandbox. It starts with flx_test_. Copy it now: it is shown only once.

No Partner API tab? API access is enabled per account: contact support to turn it on.

Keep keys on your server. Never put an API key in a website, a mobile app or a public repository.

Check the key

Set two shell variables, then call /v3/validate. Every example in these docs uses them.

export API_URL="https://api.flexyliktelecom.com"
export API_KEY="flx_test_..."

curl "$API_URL/v3/validate" -H "X-Access-Token: $API_KEY"
{
  "success": true,
  "data": {
    "username": "my-shop",
    "apiKey": { "type": "SANDBOX", "scope": "READ-WRITE", "isEnabled": true, "allowedips": [] }
  },
  "meta": { "timestamp": "2026-11-15T10:30:00.000Z" },
  "requestId": "req_8fK2mQx7Lp0aZ3nV1cWb"
}

Send a top-up

curl -X POST "$API_URL/v3/mobile/send" \
  -H "X-Access-Token: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"plan_code":"PREPAID_DJEZZY","MSSIDN":"0700000009","amount":500,"ref":"order-1001"}'
{
  "success": true,
  "data": { "topupId": "SBXF8cKfBRee", "topupRef": "order-1001" },
  "meta": { "timestamp": "2026-11-15T10:30:01.000Z" },
  "requestId": "req_Zk1o9P2nB7c4XqLw0eRt"
}

Poll the status

curl "$API_URL/v3/mobile/check-ref/order-1001" -H "X-Access-Token: $API_KEY"

In the sandbox a normal number is PENDING for 5 seconds, HANDLING until 15 seconds, then COMPLETED:

{
  "success": true,
  "data": {
    "_id": "SBXF8cKfBRee",
    "ref": "order-1001",
    "status": "COMPLETED",
    "plan_code": "PREPAID_DJEZZY",
    "MSSIDN": "0700000009",
    "topup_amount": 500,
    "balance_amount": 500,
    "created_at": "2026-11-15T10:30:01.000Z"
  }
}

Test the failure paths

Use the sandbox test numbers to get REFUNDED, UNKNOWN_ERROR and the other outcomes, and make sure your code handles each one.

Go live

Create a Production key (flx_live_...), restrict it to your server IPs, and switch API_KEY. Nothing else changes.

A complete example

#!/usr/bin/env bash
# Usage: API_URL=... API_KEY=... ./topup.sh order-1001 0700000009 500
ORDER_ID="$1"; PHONE="$2"; AMOUNT="$3"

send=$(curl -s -X POST "$API_URL/v3/mobile/send" \
  -H "X-Access-Token: $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"plan_code\":\"PREPAID_DJEZZY\",\"MSSIDN\":\"$PHONE\",\"amount\":$AMOUNT,\"ref\":\"$ORDER_ID\"}")
echo "$send"

# DUPLICATED_REF means this order was already sent: just read its status.
for attempt in $(seq 1 60); do
  sleep 5
  check=$(curl -s "$API_URL/v3/mobile/check-ref/$ORDER_ID" -H "X-Access-Token: $API_KEY")
  status=$(echo "$check" | sed -n 's/.*"status":"\([A-Z_]*\)".*/\1/p')
  echo "status: $status"
  case "$status" in COMPLETED|REFUNDED|UNKNOWN_ERROR) echo "$check"; break ;; esac
done

On this page