KargoEvi API Dokümantasyonu
Platformunuza KargoEvi'ni entegre edin. Güçlü API'miz ile kargo süreçlerinizi otomatikleştirin.
Hızlı Başlangıç
5 dakikada API'yi kullanmaya başlayın.
İlk İsteğinizi Gönderin
Aşağıdaki örnekleri kullanarak test edin.
Entegrasyonu Tamamlayın
Production'a geçin ve otomasyonun keyfini çıkarın.
Örnek İstek
curl -X POST https://api.kargoevi.com/v1/calculate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"origin_country": "TR",
"destination_country": "US",
"weight": 2.5,
"length": 30,
"width": 20,
"height": 15
}'
Kimlik Doğrulama
Tüm API istekleri Bearer Token ile doğrulanır.
API Anahtarınızı Kullanın
Her istekte Authorization header'ına Bearer token olarak API anahtarınızı ekleyin:
Authorization: Bearer sk_live_xxxxxxxxxxxxxxxx
API anahtarınızı asla istemci tarafında (frontend JavaScript) kullanmayın. Anahtarlarınızı sunucu tarafında saklayın.
Test ve Production Anahtarları
sk_test_xxxxxxxxxx
Geliştirme ve test için
sk_live_xxxxxxxxxx
Canlı ortam için
API Endpoints
Mevcut tüm API endpoint'leri ve kullanım örnekleri.
https://api.kargoevi.com/v1
Fiyat Hesaplama
Kargo fiyatını hesaplayın.
/calculate
Request Body
{
"origin_country": "TR",
"destination_country": "US",
"weight": 2.5, // kg cinsinden
"length": 30, // cm cinsinden
"width": 20, // cm cinsinden
"height": 15, // cm cinsinden
"service_type": "express" // "express" veya "economy"
}
Response
{
"success": true,
"data": {
"price": 245.50,
"currency": "TRY",
"delivery_time": "3-5 gün",
"volumetric_weight": 2.7,
"actual_weight": 2.5,
"chargeable_weight": 2.7
}
}
Gönderi Oluşturma
Yeni bir kargo gönderisi oluşturun.
/shipments
Request Body
{
"sender": {
"name": "Ahmet Yılmaz",
"phone": "+905551234567",
"address": "Atatürk Cad. No:123",
"city": "Istanbul",
"country": "TR",
"postal_code": "34000"
},
"recipient": {
"name": "John Doe",
"phone": "+12025550123",
"address": "123 Main St",
"city": "New York",
"country": "US",
"postal_code": "10001"
},
"package": {
"weight": 2.5,
"length": 30,
"width": 20,
"height": 15,
"description": "Electronics"
},
"service_type": "express"
}
Response
{
"success": true,
"data": {
"shipment_id": "SHP_20250115_001234",
"tracking_number": "KE1234567890TR",
"status": "created",
"label_url": "https://api.kargoevi.com/labels/xxx.pdf",
"estimated_delivery": "2025-11-20"
}
}
Gönderi Takibi
Kargo durumunu sorgulayın.
/track/{tracking_number}
Response
{
"success": true,
"data": {
"tracking_number": "KE1234567890TR",
"status": "in_transit",
"current_location": "New York, US",
"estimated_delivery": "2025-11-20",
"events": [
{
"date": "2025-11-15 10:30",
"location": "Istanbul, TR",
"status": "picked_up",
"description": "Kargo alındı"
},
{
"date": "2025-11-16 08:15",
"location": "Frankfurt, DE",
"status": "in_transit",
"description": "Aktarma noktasında"
}
]
}
}
Kod Örnekleri
Farklı dillerde hazır kod örnekleri ile hızlıca başlayın.
PHP
'TR',
'destination_country' => 'US',
'weight' => 2.5,
'length' => 30,
'width' => 20,
'height' => 15
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $api_key,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
echo "Fiyat: " . $result['data']['price'] . " TRY";
?>
JavaScript (Node.js)
const axios = require('axios');
const apiKey = 'sk_live_xxxxxxxxxxxxxxxx';
const url = 'https://api.kargoevi.com/v1/calculate';
const data = {
origin_country: 'TR',
destination_country: 'US',
weight: 2.5,
length: 30,
width: 20,
height: 15
};
axios.post(url, data, {
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log('Fiyat:', response.data.data.price, 'TRY');
})
.catch(error => {
console.error('Hata:', error.response.data);
});
Python
import requests
import json
api_key = 'sk_live_xxxxxxxxxxxxxxxx'
url = 'https://api.kargoevi.com/v1/calculate'
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
data = {
'origin_country': 'TR',
'destination_country': 'US',
'weight': 2.5,
'length': 30,
'width': 20,
'height': 15
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(f"Fiyat: {result['data']['price']} TRY")
Başlamaya Hazır mısınız?
API anahtarınızı alın ve entegrasyona hemen başlayın.