API Dokümantasyonu

Bayilerimiz için hazırlanan API entegrasyon rehberi. İsteklerinizi POST ve GET metodları ile iletebilirsiniz.

POST GET

Servis Listesi

ParametrelerAçıklama
keyAPI Anahtarınız
actionservices

Başarılı Yanıt

[
    {
        "service": 1,
        "name": "Instagram Takipçi",
        "type": "Default",
        "category": "Instagram",
        "rate": "12.50",
        "min": 100,
        "max": 10000,
        "refill": true,
        "cancel": true
    }
]
POST GET

Sipariş Oluştur

ParametrelerAçıklama
keyAPI Anahtarınız
actionadd
serviceServis ID
linkLink
quantityMiktar
runsTekrar Sayısı (Opsiyonel)
intervalAralık (Dakika - Opsiyonel)

Başarılı Yanıt

{ "order": 23501 }
POST

Toplu Sipariş Oluştur (Bulk Add)

Aynı anda birden fazla sipariş oluşturmak için kullanılır. Maksimum 100 sipariş gönderilebilir.

ParametrelerAçıklama
keyAPI Anahtarınız
actionadd_bulk
ordersJSON array of orders (max 100 orders). Her sipariş için: service, link, quantity

Örnek İstek (JSON Body)

POST /api/v2
Content-Type: application/json

{
    "key": "your_api_key",
    "action": "add_bulk",
    "orders": [
        {
            "service": 1,
            "link": "https://instagram.com/test1",
            "quantity": 100
        },
        {
            "service": 2,
            "link": "https://instagram.com/test2",
            "quantity": 200
        }
    ]
}

Örnek İstek (Form Data)

POST /api/v2
Content-Type: application/x-www-form-urlencoded

key=your_api_key&action=add_bulk&orders=[{"service":1,"link":"https://instagram.com/test1","quantity":100}]

Başarılı Yanıt

{
    "0": { "order": 23501 },
    "1": { "order": 23502 }
}

Kısmi Başarılı Yanıt (Bazı siparişler hatalı)

{
    "0": { "error": "Order 1: Service not found" },
    "1": { "order": 23502 },
    "2": { "error": "Order 3: Quantity must be at least 100" }
}

Hata Yanıtı (Yetersiz Bakiye)

{ "error": "Insufficient balance. Required: 15.500000, Available: 10.000000" }

Not: Toplu sipariş oluşturma işlemi atomik değildir. Bazı siparişler başarılı olurken bazıları başarısız olabilir. Her sipariş için ayrı yanıt döner.

POST GET

Sipariş Durumu

ParametrelerAçıklama
keyAPI Anahtarınız
actionstatus
orderSipariş ID

Başarılı Yanıt

{
    "charge": "0.27819",
    "start_count": "3572",
    "status": "Partial",
    "remains": "157",
    "currency": "TRY"
}
POST GET

Çoklu Sipariş Durumu

ParametrelerAçıklama
keyAPI Anahtarınız
actionstatus
ordersSipariş ID'leri (Virgül ile ayrılmış, max 100)

Başarılı Yanıt

{
    "1": {
        "charge": "0.27819",
        "start_count": "3572",
        "status": "Partial",
        "remains": "157",
        "currency": "TRY"
    },
    "10": {
        "error": "Incorrect order ID"
    }
}
POST GET

Telafi Oluştur (Create Refill)

Tamamlanmış veya kısmi tamamlanmış bir sipariş için telafi (refill) talebi oluşturur. Sipariş durumu "Completed" veya "Partial" olmalıdır.

ParametrelerAçıklama
keyAPI Anahtarınız (zorunlu)
actionrefill (zorunlu)
orderSipariş ID (zorunlu)

Örnek İstek (GET)

GET /api/v2?key=your_api_key&action=refill&order=12345

Örnek İstek (POST)

POST /api/v2
Content-Type: application/x-www-form-urlencoded

key=your_api_key&action=refill&order=12345

# veya

POST /api
Content-Type: application/x-www-form-urlencoded

key=your_api_key&action=refill&order=12345

Başarılı Yanıt

{ "refill": "23", "status": "completed" }

Not: Refill başarıyla oluşturulduğunda "completed", reddedildiğinde "rejected" döner.

Hata Yanıtları

// Sipariş bulunamadı veya geçersiz
{ "refill": null, "status": "rejected" }

// Sipariş size ait değil
{ "refill": null, "status": "rejected" }

// Sipariş durumu uygun değil (Pending, Processing, Cancelled)
{ "refill": null, "status": "rejected" }

// Servis refill desteklemiyor
{ "refill": null, "status": "rejected" }

Not: Aynı endpoint formatı hem /api/v2 hem de /api için geçerlidir.

PHP Örnek Kodu

api_key = 'your_api_key';

// Tek bir sipariş için refill oluştur
$result = $api->refill(12345);
if (isset($result->refill)) {
    echo "Refill ID: " . $result->refill;
} else {
    echo "Hata: " . $result->error;
}
?>

cURL Örnek Kodu

curl -X POST "https://roketbayim.com/api/v2" \
  -d "key=your_api_key" \
  -d "action=refill" \
  -d "order=12345"
POST GET

Çoklu Telafi Oluştur (Multiple Refill)

Birden fazla sipariş için aynı anda telafi talebi oluşturur. Her sipariş için ayrı refill ID döner.

ParametrelerAçıklama
keyAPI Anahtarınız (zorunlu)
actionrefill (zorunlu)
ordersSipariş ID'leri (Virgül ile ayrılmış, örn: "12345,12346,12347")

Örnek İstek (GET)

GET /api/v2?key=your_api_key&action=refill&orders=12345,12346,12347
GET /api?key=your_api_key&action=refill&orders=12345,12346,12347

Örnek İstek (POST)

POST /api/v2
Content-Type: application/x-www-form-urlencoded

key=your_api_key&action=refill&orders=12345,12346,12347

Başarılı Yanıt

[
    { "refill": "1", "status": "completed" },
    { "refill": "2", "status": "completed" },
    { "refill": "3", "status": "completed" }
]

Kısmi Başarılı Yanıt (Bazı siparişler hatalı)

[
    { "refill"1", "status": "success" },
    { "refill": null, "status": "rejected" },
    { "refill": null, "status": "rejected" }
]

PHP Örnek Kodu

api_key = 'your_api_key';

// Birden fazla sipariş için refill oluştur
$orderIds = [12345, 12346, 12347];
$results = $api->multiRefill($orderIds);

foreach ($results as $result) {
    if (isset($result['refill']) && is_numeric($result['refill'])) {
        echo "Order {$result['order']}: Refill ID = {$result['refill']}\n";
    } else {
        echo "Order {$result['order']}: Hata - " . $result['refill']['error'] . "\n";
    }
}
?>

cURL Örnek Kodu

curl -X POST "https://roketbayim.com/api/v2" \
  -d "key=your_api_key" \
  -d "action=refill" \
  -d "orders=12345,12346,12347"
POST GET

Telafi Durumu (Refill Status)

Oluşturduğunuz refill taleplerinin durumunu sorgular. Tek bir refill veya birden fazla refill için sorgu yapabilirsiniz.

ParametrelerAçıklama
keyAPI Anahtarınız (zorunlu)
actionrefill_status (zorunlu)
refillRefill ID (Tekli sorgu için, örn: "1")
refillsRefill ID'leri (Çoklu sorgu için, virgül ile ayrılmış, örn: "1,2,3")

Not: refill veya refills parametrelerinden birini kullanmalısınız. İkisini birlikte kullanırsanız refills önceliklidir.

Tekli Refill Durumu - Örnek İstek (GET)

GET /api/v2?key=your_api_key&action=refill_status&refill=1
GET /api?key=your_api_key&action=refill_status&refill=1

Tekli Refill Durumu - Örnek İstek (POST)

POST /api/v2
Content-Type: application/x-www-form-urlencoded

key=your_api_key&action=refill_status&refill=1

# veya

POST /api
Content-Type: application/x-www-form-urlencoded

key=your_api_key&action=refill_status&refill=1

Tekli Refill Durumu - Başarılı Yanıt

{ "refill": "23", "status": "completed" }

Tekli Refill Durumu - Olası Status Değerleri

  • completed - Tamamlandı
  • pending - Beklemede
  • rejected - Reddedildi

Çoklu Refill Durumu - Örnek İstek (GET)

GET /api/v2?key=your_api_key&action=refill_status&refills=1,2,3
GET /api?key=your_api_key&action=refill_status&refills=1,2,3

Çoklu Refill Durumu - Örnek İstek (POST)

POST /api/v2
Content-Type: application/x-www-form-urlencoded

key=your_api_key&action=refill_status&refills=1,2,3

# veya

POST /api
Content-Type: application/x-www-form-urlencoded

key=your_api_key&action=refill_status&refills=1,2,3

Çoklu Refill Durumu - Başarılı Yanıt

[
    { "refill": "1", "status": "completed" },
    { "refill": "2", "status": "pending" },
    { "refill": "3", "status": "rejected" }
]

Hata Yanıtları

// Refill bulunamadı (Tekli)
{ "error": "Refill not found" }

// Refill bulunamadı (Çoklu)
[
    { "refill": "1", "status": "completed" },
    { "refill": "2", "error": "Refill not found" }
]

// Yetkisiz erişim
{ "error": "Unauthorized" }

// Geçersiz refill ID
{ "error": "Invalid refill ID" }

PHP Örnek Kodu

api_key = 'your_api_key';

// Tek bir refill durumu sorgula
$result = $api->refillStatus(1);
if (isset($result->status)) {
    echo "Refill Durumu: " . $result->status;
} else {
    echo "Hata: " . $result->error;
}

// Birden fazla refill durumu sorgula
$refillIds = [1, 2, 3];
$results = $api->multiRefillStatus($refillIds);

foreach ($results as $result) {
    if (isset($result['status'])) {
        echo "Refill {$result['refill']}: {$result['status']}\n";
    } else {
        echo "Refill {$result['refill']}: Hata - " . $result['error'] . "\n";
    }
}
?>

cURL Örnek Kodu

# Tekli refill durumu
curl -X GET "https://roketbayim.com/api/v2?key=your_api_key&action=refill_status&refill=1"

# Çoklu refill durumu
curl -X POST "https://roketbayim.com/api/v2" \
  -d "key=your_api_key" \
  -d "action=refill_status" \
  -d "refills=1,2,3"

JavaScript (Fetch API) Örnek Kodu

// Tekli refill durumu
async function getRefillStatus(refillId) {
    const response = await fetch(
        `https://roketbayim.com/api/v2?key=your_api_key&action=refill_status&refill=${refillId}`
    );
    const data = await response.json();
    return data;
}

// Çoklu refill durumu
async function getMultipleRefillStatus(refillIds) {
    const formData = new FormData();
    formData.append('key', 'your_api_key');
    formData.append('action', 'refill_status');
    formData.append('refills', refillIds.join(','));
    
    const response = await fetch('https://roketbayim.com/api/v2', {
        method: 'POST',
        body: formData
    });
    const data = await response.json();
    return data;
}

// Kullanım
getRefillStatus(1).then(result => {
    console.log('Refill Durumu:', result.status);
});

getMultipleRefillStatus([1, 2, 3]).then(results => {
    results.forEach(result => {
        console.log(`Refill ${result.refill}: ${result.status}`);
    });
});
POST GET

Sipariş İptali (Cancel)

ParametrelerAçıklama
keyAPI Anahtarınız
actioncancel
ordersSipariş ID'leri (Virgül ile)

Başarılı Yanıt

[
    { "order": 9, "cancel": { "error": "Incorrect order ID" } },
    { "order": 2, "cancel": 1 }
]
POST GET

Bakiye Sorgulama (Balance)

ParametrelerAçıklama
keyAPI Anahtarınız
actionbalance

Başarılı Yanıt

{ "balance": "100.84", "currency": "USD" }

Örnek PHP Sınıfı

Bu sınıfı kullanarak API ile hızlıca bağlantı kurabilirsiniz.

 $this->api_key, 'action' => 'add'], $data);
        return json_decode((string)$this->connect($post));
    }

    public function bulkOrder($orders) {
        $post = [
            'key' => $this->api_key,
            'action' => 'add_bulk',
            'orders' => json_encode($orders)
        ];
        return json_decode((string)$this->connect($post), true);
    }

    public function status($order_id) {
        return json_decode($this->connect([
            'key' => $this->api_key,
            'action' => 'status',
            'order' => $order_id
        ]));
    }

    public function multiStatus($order_ids) {
        return json_decode($this->connect([
            'key' => $this->api_key,
            'action' => 'status',
            'orders' => implode(",", (array)$order_ids)
        ]));
    }

    public function services() {
        return json_decode($this->connect([
            'key' => $this->api_key,
            'action' => 'services',
        ]));
    }

    public function refill(int $orderId) {
        return json_decode($this->connect([
            'key' => $this->api_key,
            'action' => 'refill',
            'order' => $orderId,
        ]));
    }

    public function multiRefill(array $orderIds) {
        return json_decode($this->connect([
            'key' => $this->api_key,
            'action' => 'refill',
            'orders' => implode(',', $orderIds),
        ]), true);
    }

    public function refillStatus(int $refillId) {
         return json_decode($this->connect([
            'key' => $this->api_key,
            'action' => 'refill_status',
            'refill' => $refillId,
        ]));
    }

    public function multiRefillStatus(array $refillIds) {
         return json_decode($this->connect([
            'key' => $this->api_key,
            'action' => 'refill_status',
            'refills' => implode(',', $refillIds),
        ]), true);
    }

    public function cancel(array $orderIds) {
        return json_decode($this->connect([
            'key' => $this->api_key,
            'action' => 'cancel',
            'orders' => implode(',', $orderIds),
        ]), true);
    }

    public function balance() {
        return json_decode($this->connect([
            'key' => $this->api_key,
            'action' => 'balance',
        ]));
    }

    private function connect($post) {
        $_post = [];
        if (is_array($post)) {
            foreach ($post as $name => $value) {
                $_post[] = $name . '=' . urlencode($value);
            }
        }
        $ch = curl_init($this->api_url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        if (is_array($post)) {
            curl_setopt($ch, CURLOPT_POSTFIELDS, join('&', $_post));
        }
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
        $result = curl_exec($ch);
        if (curl_errno($ch) != 0 && empty($result)) {
            $result = false;
        }
        curl_close($ch);
        return $result;
    }
}
?>