Partner API referansı

Tüm endpoint'ler JSON döner. Fiyatı siz göndermezsiniz - sadece ne almak istediğinizi belirtirsiniz, fiyatı her zaman sunucu kendisi hesaplar; böylece fiyat sahtelenemez veya değiştirilemez.

Base URL:

Base URL
https://buyukesim.com/api/v1

Kimlik doğrulama

Aşağıdaki her istekte API anahtarınızı Bearer token olarak gönderin.

Not: bakiye ekleme sadece site üzerinden yapılan bir işlemdir (panel Magic Code'unuzla), bu API'nin parçası değildir - API anahtarınızla bakiye yükleyemezsiniz.

Header
Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx

Hesap

GET/api/v1/balance

Hesap Bakiyesi

Ön ödemeli hesabınızda kalan tutar. Her sipariş aynı rakamı kendi balance bloğunda zaten döndürür, yani bir satın almanın ne tuttuğunu görmek için buraya istek atmanız gerekmez. Bu uç nokta satın almadan bağımsız kontroller içindir: bakiye alarmı, panel kartı, ödeyemeyeceği işi başlatmayı reddeden toplu iş.

Request
curl "https://buyukesim.com/api/v1/balance" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response
{
  "success": true,
  "data": {
    "balance_usd": 477.5,
    "currency": "USD",
    "discount_pct": 10,
    "discounts": { "uk_number": 10, "travel_data": 10, "vpn": 10 },
    "account": {
      "name": "Acme Telecom",
      "status": "active",
      "api_key_prefix": "buk_live_9f2a"
    }
  }
}
GET/api/v1/reports?from=2026-08-01&to=2026-08-31

Satış Raporu

Bir tarih aralığında ne aldığınız ve ne kadara mal olduğu, ürün bazında. Tarihler sipariş tarihine göre UTC takvim günüdür ve iki uçtan da dahildir; boş bırakırsanız son 30 gün raporlanır. Yalnızca ödenmiş siparişler - teslimatı başarısız olan sipariş iptal edilip bakiyenize iade edildiği için hiç para götürmemiştir. Kalem kalem orders dizisi varsayılan olarak 100 satırla sınırlıdır (limit, en fazla 500); daha fazlası için tarih aralığını daraltın.

Request
curl "https://buyukesim.com/api/v1/reports?from=2026-08-01&to=2026-08-31" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response
{
  "success": true,
  "data": {
    "period": { "from": "2026-08-01", "to": "2026-08-31", "timezone": "UTC" },
    "totals": {
      "orders": 4,
      "units": 4,
      "spend_usd": 25.16,
      "currency": "USD"
    },
    "products": [
      { "type": "travel_data", "orders": 3, "units": 3, "spend_usd": 16.17 },
      { "type": "vpn",         "orders": 1, "units": 1, "spend_usd": 8.99 }
    ],
    "balance": { "remaining_usd": 477.5, "currency": "USD" },
    "orders": [
      {
        "order_id": 98423,
        "type": "vpn",
        "reference": "order-1236",
        "lookup_code": "K7M9-2XP4",
        "units": 1,
        "spend_usd": 8.99,
        "created_at": "2026-08-29 20:00:00",
        "plan": "30d"
      }
    ],
    "orders_truncated": false
  }
}

Ürünler

GET/api/v1/products

Ürünleri Listele

Tüm aktif Travel eSIM paketlerini (güncel package_code ve price_usd ile) ve VPN erişim planları ile sunucularını çekin; böylece Create Order çağırmadan önce neyin satın alınabilir olduğunu bilirsiniz. travel_data dizisi canlı kataloğun tamamıdır (yaklaşık 198 destinasyon - burada bir tanesi gösteriliyor); ?location_code=GB ile daraltılır. Her price_usd SİZİN fiyatınızdır: discount_pct sabit değil, size özel oranınızdır; aşağıdaki örnek sadece %10 kullanıyor. Her ürün grubunun kendi oranı olabilir: discounts, uk_number, travel_data ve vpn için oranı verir (top-up travel_data, yenileme uk_number oranıyla fiyatlanır); discount_pct ise kendi oranı olmayan grubun kullandığı hesap oranıdır.

Request
curl "https://buyukesim.com/api/v1/products" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response
{
  "success": true,
  "data": {
    "discount_pct": 10,
    "discounts": { "uk_number": 10, "travel_data": 10, "vpn": 10 },
    "travel_data": [
      {
        "package_code": "GB_1GB_7D",
        "name": "United Kingdom 1GB / 7 Days",
        "location_code": "GB",
        "retail_price_usd": 5.99,
        "price_usd": 5.39,
        "volume_label": "1 GB",
        "duration": 7,
        "duration_unit": "DAY"
      }
    ],
    "vpn": {
      "type": "vpn",
      "available": true,
      "currency": "USD",
      "plans": [
        { "plan": "30d", "days": 30, "label": "30 days", "retail_price_usd": 9.99, "price_usd": 8.99, "currency": "USD" }
      ],
      "protocols": ["wireguard", "openvpn", "vless"],
      "servers": [
        { "id": 42, "country_code": "NL", "city": "Amsterdam", "protocol": "wireguard" }
      ]
    }
  }
}

Siparişler

POST/api/v1/orders

Sipariş Oluştur - Seyahat eSIM

Verilen package_code için bir Seyahat eSIM siparişi oluşturur ve anında teslim eder.

Request
curl -X POST "https://buyukesim.com/api/v1/orders" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "product_type": "travel_data",
  "package_code": "GB_1GB_7D",
  "reference": "order-1235"
}'
Response
{
  "success": true,
  "data": {
    "order_id": 98422,
    "reference": "order-1235",
    "status": "paid",
    "product": {
      "type": "travel_data",
      "package_code": "GB_1GB_7D",
      "package_name": "United Kingdom 1GB / 7 Days",
      "location_code": "GB",
      "retail_price_usd": 5.99,
      "discount_pct": 10,
      "price_usd": 5.39
    },
    "lookup_code": null,
    "created_at": "2026-07-06T20:00:00+00:00",
    "balance": { "charged_usd": 5.39, "remaining_usd": 472.11, "currency": "USD" }
  }
}
POST/api/v1/orders

Sipariş Oluştur - VPN erişimi

Verilen vpn_plan için bir VPN erişim siparişi oluşturur ve anında sağlar; tutar ön ödemeli bakiyenizden düşülür. Yanıt kullanıcı adını, parolayı ve bitiş tarihini içerir. VPN sağlayıcısına ulaşılamazsa sipariş yine de ödenmiş sayılır ve korunur: HTTP 202 ile "provisioning_pending" durumunu ve sipariş kimliğini alırsınız, ekibimize uyarı gider ve hesap oluşturulduğunda kimlik bilgileri GET /v1/orders/{id} yanıtında görünür.

Request
curl -X POST "https://buyukesim.com/api/v1/orders" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "product_type": "vpn",
  "vpn_plan": "30d",
  "reference": "order-1236"
}'
Response
{
  "success": true,
  "data": {
    "order_id": 98423,
    "reference": "order-1236",
    "status": "paid",
    "product": {
      "type": "vpn",
      "plan": { "key": "30d", "days": 30, "label": "30 days" },
      "retail_price_usd": 9.99,
      "discount_pct": 10,
      "price_usd": 8.99
    },
    "lookup_code": "K7M9-2XP4",
    "created_at": "2026-08-29T20:00:00+00:00",
    "vpn": {
      "provisioned": true,
      "expires_at": "2026-09-28 00:00:00",
      "username": "bk98423a1c3e",
      "password": "s7Kq2vXpLm4A",
      "protocols": ["wireguard", "openvpn", "vless"],
      "config_endpoint": "https://buyukesim.com/api/v1/orders/98423/vpn-config"
    },
    "success_url": "https://buyukesim.com/en/success/#order_id=98423&access_token=...",
    "balance": { "charged_usd": 8.99, "remaining_usd": 463.12, "currency": "USD" }
  }
}
GET/api/v1/orders/98422

Sipariş Durumu ve Teslimat

Teslimat çağrısı: data.esim.ready true olana kadar sorgulayın ve profili data.esim.items içinden alın. Her kalem telefona girmenin iki yolunu da taşır - qr_code, ve elle girilecek SM-DP+ adresi ile aktivasyon kodunu içeren manual_install. İkincisi çok yaygın bir durum içindir: müşteriniz uygulamanızı, profilin kurulacağı telefonun kendisinde okuyordur ve tarayacak ikinci bir ekranı yoktur. Travel eSIM'lerde puk_code null gelir. status alanını sorgulamayın: bakiyeniz düşüldüğü anda "paid" olur, bu bir ödeme durumudur, teslimat durumu değil.

Request
curl "https://buyukesim.com/api/v1/orders/98422" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response
{
  "success": true,
  "data": {
    "order_id": 98422,
    "reference": "order-1235",
    "status": "paid",
    "product": { "type": "travel_data", "package_code": "GB_1GB_7D", "retail_price_usd": 5.99, "price_usd": 5.39 },
    "lookup_code": "K7M9-2XP4",
    "esim": {
      "ready": true,
      "items": [
        {
          "_comment": "hosts below are placeholders - the real ones differ per profile",
          "qr_code": "https://qr.example-provider.net/8e2bba37e8b94ca49bf23be334a0a57f.png",
          "iccid": "8944...",
          "puk_code": null,
          "manual_install": {
            "activation_string": "LPA:1$rsp.example-provider.com$1173094A3D3A473D84695E0D6C404B34",
            "smdp_address": "rsp.example-provider.com",
            "activation_code": "1173094A3D3A473D84695E0D6C404B34",
            "confirmation_code_required": false
          }
        }
      ]
    }
  }
}
GET/api/v1/orders/98422/usage

Seyahat eSIM Veri Kullanımı

Bir Seyahat eSIM siparişinin kalan/kullanılan verisini, aktivasyon ve son kullanma durumunu her çağrıda sağlayıcıdan canlı olarak alın.

Request
curl "https://buyukesim.com/api/v1/orders/98422/usage" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response
{
  "success": true,
  "data": {
    "order_id": 98422,
    "status": "paid",
    "package": {
      "package_code": "GB_1GB_7D",
      "name": "United Kingdom 1GB / 7 Days",
      "location_code": "GB",
      "volume_label": "1 GB",
      "duration": 7,
      "duration_unit": "DAY"
    },
    "usage": {
      "iccid": "8944...",
      "apn": "cmlink",
      "esim_status": "IN_USE",
      "smdp_status": "ENABLED",
      "total_volume_bytes": 1073741824,
      "used_volume_bytes": 214748364,
      "remaining_volume_bytes": 858993459,
      "usage_percent": 20.0,
      "total_duration": 7,
      "duration_unit": "DAY",
      "expired_time": "2026-07-13T20:00:00+00:00"
    }
  }
}
GET/api/v1/orders/98422/topups

Bir eSIM için Yükleme Seçenekleri

Sağlayıcının bu siparişteki eSIM için şu anda sunduğu veri paketleri, indiriminiz uygulanmış halde. Katalog her eSIM için ayrıdır ve canlıdır; bu kodlar GET /v1/products içinde yer almaz ve önbelleğe alınmamalıdır, müşteriniz veri eklemek istediğinde çağırın. Bir eSIM toplam 8 yükleme alır, remaining_topups kalan hakkı gösterir.

Request
curl "https://buyukesim.com/api/v1/orders/98422/topups" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response
{
  "success": true,
  "data": {
    "order_id": 98422,
    "iccid": "8944...",
    "discount_pct": 10,
    "reloadable": true,
    "used_topups": 1,
    "remaining_topups": 7,
    "max_topups": 8,
    "options": [
      {
        "package_code": "TOPUP_GB_1GB_7D",
        "name": "United Kingdom 1GB / 7 Days",
        "retail_price_usd": 5.99,
        "price_usd": 5.39,
        "volume_label": "1 GB",
        "volume_bytes": 1073741824,
        "duration": 7,
        "duration_unit": "DAY"
      }
    ]
  }
}
POST/api/v1/topups

Bir eSIM'e Veri Ekleme

Daha önce sattığınız bir Seyahat eSIM'ine veri yükler, ön ödemeli bakiyenizden indiriminizle düşülür. Aynı profil ve aynı QR çalışmaya devam eder, müşteriniz hiçbir şeyi yeniden kurmaz. package_code, bu eSIM için listeleme çağrısının döndürdüğü kodlardan biri olmalıdır; canlı olarak yeniden doğrulanır ve fiyat asla istekten alınmaz. reference tekrar koruma anahtarıdır ve POST /v1/orders ile aynı ad alanını paylaşır.

Request
curl -X POST "https://buyukesim.com/api/v1/topups" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "order_id": 98422,
  "package_code": "TOPUP_GB_1GB_7D",
  "reference": "topup-4471"
}'
Response
{
  "success": true,
  "data": {
    "order_id": 98599,
    "reference": "topup-4471",
    "status": "paid",
    "product": {
      "type": "travel_topup",
      "package_code": "TOPUP_GB_1GB_7D",
      "package_name": "United Kingdom 1GB / 7 Days",
      "volume_label": "1 GB",
      "duration": 7,
      "duration_unit": "DAY",
      "retail_price_usd": 5.99,
      "discount_pct": 10,
      "price_usd": 5.39
    },
    "esim": {
      "iccid": "8944...",
      "parent_order_id": 98422,
      "reinstall_required": false,
      "remaining_topups": 8
    },
    "created_at": "2026-07-09T11:20:00+00:00",
    "balance": { "charged_usd": 5.39, "remaining_usd": 466.72, "currency": "USD" }
  }
}
GET/api/v1/orders/98423/vpn-config?protocol=wireguard&server_id=42

VPN yapılandırması

Oluşturduğunuz bir VPN siparişi için tek bir sunucuya ait WireGuard, OpenVPN veya VLESS yapılandırmasını getirir. server_id değerini Ürünleri Listele yanıtındaki sunucu listesinden alın. WireGuard sunucuları aynı zamanda OpenVPN sunar; VLESS sunucuları yalnızca VLESS sunar. Dakikada 20 çağrıya kadar istediğiniz sıklıkta çağırabilirsiniz.

Request
curl "https://buyukesim.com/api/v1/orders/98423/vpn-config?protocol=wireguard&server_id=42" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response
{
  "success": true,
  "data": {
    "order_id": 98423,
    "protocol": "wireguard",
    "server": { "id": 42, "country_code": "NL", "city": "Amsterdam" },
    "name": "buyukesim-nl-amsterdam.conf",
    "content": "[Interface]\nPrivateKey = ...\nAddress = ...",
    "qr_payload": "[Interface]\nPrivateKey = ...\nAddress = ..."
  }
}

UK Numara (+44)

Sadece onaylı hesaplar

UK numara her partner hesabına açık değildir: ekibimiz talep üzerine hesap bazında açar. Hesabınızda açılana kadar GET /v1/products yanıtında uk_number bloğu yer almaz; product_type uk_number ile yapılan POST /v1/orders ve POST /v1/renewals çağrıları 403 product_unavailable döner. Travel eSIM ve VPN her hesapta çalışır. Erişim istemek için hesap adınızla destek ekibimize yazın.

Onaylı bir hesapta GET /v1/products ayrıca bir uk_number bloğu döner. Bir hat ilk 180 günüyle birlikte gelir. prepay_packages yeni bir hatla birlikte satılan 6, 12 ve 24 aylık paketlerdir (prepay_periods 0, 1 ve 3); renewal_packages ise daha önce sattığınız bir hattı uzatır (periods 1, 2 ve 4). Her price_usd sizin UK oranınızla hesaplanmış fiyatınızdır; örnek %10 kullanıyor.

GET /api/v1/products - uk_number
"uk_number": {
  "type": "uk_number",
  "retail_price_usd": 25,
  "price_usd": 22.5,
  "currency": "USD",
  "min_quantity": 1,
  "max_quantity": 10,
  "period_days": 180,
  "prepay_packages": [
    { "prepay_periods": 0, "months": 6,  "retail_price_usd": 25,   "price_usd": 22.5 },
    { "prepay_periods": 1, "months": 12, "retail_price_usd": 36,   "price_usd": 32.4 },
    { "prepay_periods": 3, "months": 24, "retail_price_usd": 59.5, "price_usd": 53.55 }
  ],
  "renewal_packages": [
    { "periods": 1, "months": 6,  "retail_price_usd": 15, "price_usd": 13.5 },
    { "periods": 2, "months": 12, "retail_price_usd": 27, "price_usd": 24.3 },
    { "periods": 4, "months": 24, "retail_price_usd": 51, "price_usd": 45.9 }
  ]
}

Müşterinize satın almadan önce söyleyin: her hattın QR kodu yalnızca bir kez kurulur. Yeniden verilmez ve teslim edilmiş bir UK hattı iade edilmez. Numara bitiş tarihine kadar aktif kalır ve o tarihten önce yenilenmelidir: bitiş tarihini geçen hat serbest bırakılır ve geri alınamaz.

POST/api/v1/orders

Sipariş Oluştur - UK Numara

Bir UK Numara (+44) siparişi oluşturur ve stoktan hemen teslim eder; tutar UK oranınızla ön ödemeli bakiyenizden düşülür. quantity 1 ile 10 hat arasındadır. prepay_periods daha uzun paketi aynı çağrıda satar: 0 (veya gönderilmezse) 6 ay, 1 12 ay, 3 24 aydır. reference idempotency anahtarıdır ve diğer tüm POST /v1/orders çağrılarıyla aynı alanı paylaşır. Teslimat ya hep ya hiçtir: stok istenen adedin tamamını karşılayamazsa hiçbir hat teslim edilmez, sipariş iptal edilir ve bakiyeniz iade edilir.

Request
curl -X POST "https://buyukesim.com/api/v1/orders" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "product_type": "uk_number",
  "quantity": 1,
  "prepay_periods": 0,
  "reference": "order-1234"
}'
Response
{
  "success": true,
  "data": {
    "order_id": 98421,
    "reference": "order-1234",
    "status": "paid",
    "product": {
      "type": "uk_number",
      "quantity": 1,
      "prepay_periods": 0,
      "months": 6,
      "retail_price_usd": 25,
      "discount_pct": 10,
      "price_usd": 22.5
    },
    "lookup_code": "K7M9-2XP4",
    "created_at": "2026-07-06 20:00:00",
    "balance": { "charged_usd": 22.5, "remaining_usd": 449.61, "currency": "USD" }
  }
}
GET/api/v1/orders/98421

UK Numara Teslimatı

Diğer tüm siparişlerdeki GET /v1/orders/{id} çağrısının aynısı. data.esim.items her hat için bir kayıt içerir. qr_code, QR görseline giden ve yaklaşık iki saat sonra geçerliliğini yitiren imzalı bir bağlantıdır; saklamak yerine yeni bağlantı için siparişi tekrar okuyun. manual_install elle kurulum için SM-DP+ adresini ve aktivasyon kodunu taşır (profilde aktivasyon dizesi kayıtlı değilse null), puk_code ise hattın PUK kodudur. Yanıtta telefon numarasının kendisi yer almaz; POST /v1/renewals bu yüzden phone ister.

Request
curl "https://buyukesim.com/api/v1/orders/98421" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response
{
  "success": true,
  "data": {
    "order_id": 98421,
    "reference": "order-1234",
    "status": "paid",
    "product": { "type": "uk_number", "quantity": 1, "prepay_periods": 0, "months": 6, "retail_price_usd": 25, "price_usd": 22.5 },
    "lookup_code": "K7M9-2XP4",
    "created_at": "2026-07-06 20:00:00",
    "esim": {
      "ready": true,
      "items": [
        {
          "qr_code": "https://buyukesim.com/api/serve_qr.php?order_id=98421&file=...&exp=...&sig=...",
          "iccid": "8944...",
          "puk_code": "12345678",
          "assigned_at": "2026-07-06 20:00:00",
          "manual_install": {
            "activation_string": "LPA:1$smdp.example.com$ABCD-1234-EFGH-5678",
            "smdp_address": "smdp.example.com",
            "activation_code": "ABCD-1234-EFGH-5678",
            "confirmation_code_required": false
          }
        }
      ]
    }
  }
}
POST/api/v1/renewals

UK Hattını Yenile

Daha önce sattığınız bir UK hattını uzatır; tutar UK oranınızla ön ödemeli bakiyenizden düşülür. periods 180 günlük blokları sayar: 1 dönem 6 ay, 2 dönem 12 ay (%10 indirim), 4 dönem 24 ay (%15 indirim), üstüne sizin indiriminiz uygulanır. order_id zorunludur ve kendi UK siparişlerinizden biri olmalıdır. Numara o sipariş için bizde kayıtlı değilse phone alanını da gönderin. Yanıttaki active_until hattın yeni bitiş tarihidir. reference POST /v1/orders ile aynı şekilde çalışır: aynı değeri tekrar göndermek ilk yenilemeyi döndürür ve ücret almaz.

Request
curl -X POST "https://buyukesim.com/api/v1/renewals" \
  -H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "order_id": 98421,
  "phone": "+447700900123",
  "periods": 2,
  "reference": "renewal-5501"
}'
Response
{
  "success": true,
  "data": {
    "renewal_id": 412,
    "order_id": 98421,
    "reference": "renewal-5501",
    "status": "completed",
    "phone_number": "+447700900123",
    "periods": 2,
    "months": 12,
    "price_usd": 24.3,
    "active_until": "2027-07-01",
    "created_at": "2026-07-06 20:05:00",
    "completed_at": "2026-07-06 20:05:00",
    "balance": { "charged_usd": 24.3, "remaining_usd": 425.31, "currency": "USD" }
  }
}

Hata kodları

Her hata yanıtı aynı yapıdadır: üst seviyede success: false, ve ne olduğunu anlamak için kontrol edebileceğiniz sabit bir code alanı içeren bir error nesnesi.

Error shape
{
  "success": false,
  "error": { "code": "insufficient_balance", "message": "..." }
}
HTTPcodeAnlamı
401unauthorizedAPI anahtarı eksik veya geçersiz.
402insufficient_balanceBu siparişin fiyatı için yetersiz ön ödemeli bakiye.
403product_unavailableBu hesap bu ürünü satamaz: UK numara, açılmamış bir hesapta.
404package_not_foundSeyahat package_code bulunamadı veya artık aktif değil.
409provisioning_pendingBu siparişin VPN hesabı henüz oluşturulmadı veya plan sona erdi.
429rate_limitRate limit aşıldı - istekleri yavaşlatın.