MapEx Cargo API V1 Dokümantasyonu
Kendi ERP, e-ticaret veya WMS sisteminizden MapEx üzerinde gönderi oluşturabilir, takip bilgisini okuyabilir ve hazır etiketleri alabilirsiniz.
Base URL
https://api.mapcargo.com.tr
Hızlı Başlangıç
Müşteri panelinizdeki API Entegrasyonu sayfasından bir API kaydı oluşturun. Size gösterilen API Key yalnızca bir kez görünür; bu değeri entegrasyon sisteminizde güvenli şekilde saklayın ve sunucu IP adresinizi whitelist alanına ekleyin.
curl -X GET "https://api.mapcargo.com.tr/v1/ping"
Kimlik Doğrulama
| Header | Açıklama |
|---|---|
X-Mapex-Client-Id | API Entegrasyonu sayfanızda oluşturulan Client ID. |
X-Mapex-Api-Key | Oluşturma veya yenileme anında bir kez gösterilen gizli API anahtarı. |
Idempotency-Key | Sadece POST /v1/shipments için zorunlu. Aynı kargo bilgilerinin tekrar gönderilmesi halinde çift gönderi oluşmasını engeller. |
Endpointler
| Method | Path | Açıklama |
|---|---|---|
| GET | /v1/ping | Servis sağlık kontrolü. |
| POST | /v1/shipments | Hesabınızda yeni gönderi oluşturur. Taşıyıcı seçimi ülke, paket ölçüleri ve hesabınızın fiyat seviyesine göre sistem tarafından otomatik yapılır. |
| GET | /v1/shipments | Hesabınıza ait gönderileri listeler. |
| GET | /v1/shipments/{shipment_no} | Gönderi detayını döndürür. |
| GET | /v1/shipments/{shipment_no}/tracking | Takip olaylarını ve varsa paket görsellerini döndürür. Takip metinlerinde operasyon markası yerine taşıyıcı ifadesi kullanılır. |
| GET | /v1/shipments/{shipment_no}/images/{image_id} | Paket görselini döndürür. Görsel URLleri de aynı API headerları ile çağrılmalıdır. |
| GET | /v1/shipments/{shipment_no}/label | Varsa taşıyıcı etiketi, yoksa varsayılan PDF etiketi döndürür. MapEx fallback etikette logo, müşteri hesabındaki QR Etikette Logo ayarına göre gösterilir. |
| DELETE | /v1/shipments/{shipment_no} | Sadece created durumundaki gönderiyi iptal eder. |
Gönderi Oluşturma
Taşıyıcı kodu göndermeniz gerekmez. Sistem varış ülkesi, paket ölçüleri, toplam desi ve hesabınızın fiyat seviyesine göre uygun taşıyıcıyı otomatik seçer. Gönderi sisteme kaydedilir; AWB ve etiket işlemleri operasyon akışında ilerler.
Örnek Payload
{
"external_reference": "CARGO-10001",
"origin_country": "TR",
"destination_country": "AE",
"shipment_type": "SALE",
"valuation_currency": "USD",
"sender": {
"entity_type": "COMPANY",
"company_name": "Sender Company",
"contact_name": "Sender Name",
"phone_country_code": "+90",
"phone": "5551112233",
"address_line1": "Istanbul warehouse",
"country_code": "TR",
"city": "Istanbul",
"postal_code": "34000"
},
"recipient": {
"entity_type": "PERSON",
"full_name": "Receiver Name",
"phone_country_code": "+971",
"phone": "501112233",
"email": "receiver@example.com",
"address_line1": "Business Bay",
"country_code": "AE",
"city": "Dubai",
"postal_code": "00000"
},
"packages": [
{
"quantity": 1,
"length_cm": 30,
"width_cm": 20,
"height_cm": 10,
"weight_kg": 2.5
}
],
"products": [
{
"product_name_en": "Cotton T-Shirt",
"product_name_tr": "Pamuk Tişört",
"hs_code": "610910",
"origin_country": "TR",
"quantity": 2,
"unit_price": 12.5,
"currency": "USD"
}
],
"note": "Test gönderisi"
}
Gönderilecek Alanlar
| Alan adı / tipi | Açıklama | Zorunlu | Kısıtlar |
|---|---|---|---|
external_reference (string) | Entegrasyon sisteminizdeki benzersiz referans. Aynı gönderiyi kendi sisteminizle eşleştirmek için kullanılır. | Evet | En fazla 120 karakter. Aynı müşteri için benzersiz olmalıdır. |
origin_country (string) | Çıkış ülkesi ISO-2 kodu. | Hayır | V1 için varsayılan TR kabul edilir. |
destination_country (string) | Varış ülkesi ISO-2 kodu. | Evet | 2 karakter. Örn: AE, CA, US. |
shipment_type (string) | Gönderi türü. | Hayır | Varsayılan SALE. Kabul edilen değerler: SALE, SAMPLE, GIFT, MICRO_EXPORT. |
valuation_currency (string) | Ürün değerlerinin para birimi. | Hayır | Varsayılan USD. Kullanılabilecek kodlar: USD - Amerikan Doları, EUR - Euro, GBP - İngiliz Sterlini, CAD - Kanada Doları, SAR - Suudi Arabistan Riyali. |
note (string) | Operasyon notu. | Hayır | En fazla 500 karakter önerilir. |
sender (object) | Gönderici bilgileri. | Evet | Aşağıdaki sender.* alanlarını içerir. |
sender.entity_type (string) | Gönderici tipi. | Evet | Zorunlu. PERSON veya COMPANY. |
sender.full_name (string) | Kişi gönderici adı. | Duruma bağlı | sender.entity_type PERSON ise zorunlu. En fazla 160 karakter. |
sender.company_name (string) | Firma gönderici adı. | Duruma bağlı | sender.entity_type COMPANY ise zorunlu. En fazla 180 karakter. |
sender.contact_name (string) | Firma yetkilisi veya iletişim kişisi. | Hayır | En fazla 160 karakter. |
sender.phone_country_code (string) | Telefon ülke kodu. | Hayır | Örn: +90. En fazla 10 karakter. |
sender.phone (string) | Telefon numarası. | Evet | En fazla 30 karakter. |
sender.email (string) | Gönderici e-posta adresi. | Hayır | Geçerli e-posta formatı önerilir. |
sender.address_line1 (string) | Gönderici adres satırı 1. | Evet | En fazla 190 karakter. |
sender.address_line2/3 (string) | Ek adres satırları. | Hayır | Her biri en fazla 190 karakter. |
sender.country_code (string) | Gönderici ülke kodu. | Evet | V1 için TR olmalıdır. |
sender.city (string) | Gönderici şehir. | Evet | En fazla 120 karakter. |
sender.postal_code (string) | Gönderici posta kodu. | Hayır | En fazla 20 karakter. |
recipient (object) | Alıcı bilgileri. | Evet | Aşağıdaki recipient.* alanlarını içerir. |
recipient.entity_type (string) | Alıcı tipi. | Evet | Zorunlu. PERSON veya COMPANY. |
recipient.full_name (string) | Kişi alıcı adı. | Duruma bağlı | recipient.entity_type PERSON ise zorunlu. En fazla 160 karakter. |
recipient.company_name (string) | Firma alıcı adı. | Duruma bağlı | recipient.entity_type COMPANY ise zorunlu. En fazla 180 karakter. |
recipient.contact_name (string) | Firma yetkilisi veya iletişim kişisi. | Hayır | En fazla 160 karakter. |
recipient.phone_country_code (string) | Alıcı telefon ülke kodu. | Hayır | Örn: +971, +1. |
recipient.phone (string) | Alıcı telefon numarası. | Evet | En fazla 30 karakter. |
recipient.email (string) | Alıcı e-posta adresi. | Hayır | Her müşteride zorunlu değildir. |
recipient.address_line1 (string) | Alıcı adres satırı 1. | Evet | En fazla 190 karakter. |
recipient.address_line2/3 (string) | Ek adres satırları. | Hayır | Her biri en fazla 190 karakter. |
recipient.country_code (string) | Alıcı ülke kodu. | Evet | destination_country ile aynı olmalıdır. |
recipient.state_code/state_name (string) | Eyalet veya bölge bilgisi. | Duruma bağlı | US/CA gibi ülkelerde önerilir. |
recipient.city (string) | Alıcı şehir. | Evet | En fazla 120 karakter. |
recipient.postal_code (string) | Alıcı posta kodu. | Hayır | Ülkeye göre zorunlu olabilir. |
packages (array) | Paket/parça listesi. | Evet | En az 1, en fazla 100 satır. |
packages[].quantity (integer) | Aynı ölçü ve ağırlıktaki parça adedi. | Hayır | Varsayılan 1. En fazla 100. |
packages[].length_cm / width_cm / height_cm (integer) | Paket ölçüleri. | Evet | Santimetre cinsinden pozitif tam sayı. |
packages[].weight_kg (decimal) | Paket ağırlığı. | Evet | Kg cinsinden pozitif değer. En fazla 3 ondalık. |
products (array) | Ürün/içerik listesi. | Evet | En az 1 satır. |
products[].product_name_en / product_name_tr (string) | Ürün adı. | Evet | product_name_en zorunludur. product_name_tr gönderilmezse product_name_en kullanılır. |
products[].hs_code (string) | HS/GTIP kodu. | Evet | 4-20 hane olmalıdır. 6-12 hane önerilir. |
products[].origin_country (string) | Ürün menşe ülkesi. | Hayır | Varsayılan TR. ISO-2 kodu. |
products[].quantity (integer) | Ürün adedi. | Evet | Pozitif tam sayı. |
products[].unit_price (decimal) | Birim ürün değeri. | Evet | 0 kabul edilmez. Pozitif sayı olmalıdır; 0.01 kabul edilir. |
products[].currency (string) | Ürün para birimi. | Evet | Zorunlu. Kullanılabilecek kodlar: USD - Amerikan Doları, EUR - Euro, GBP - İngiliz Sterlini, CAD - Kanada Doları, SAR - Suudi Arabistan Riyali. |
Takip ve Paket Görselleri
/v1/shipments/{shipment_no}/tracking cevabında takip ekranı için güvenli özet bilgiler summary, takip hareketleri events, varsa paket görselleri package_images alanında döner. Paket görseli URLlerini indirirken aynı X-Mapex-Client-Id ve X-Mapex-Api-Key headerlarını göndermelisiniz.
{
"ok": true,
"shipment_no": "123456",
"status": "in_transit",
"tracking_number": "TRK123456789",
"carrier_tracking_code": "TRK123456789",
"summary": {
"package_count": 2,
"weight_kg": "47.00",
"origin_country": "TR",
"origin_country_name": "Turkey",
"destination_country": "CA",
"destination_country_name": "Canada",
"recipient_name": "Ja*** AT*****"
},
"events": [
{
"event_time": "2026-07-06 14:20:00",
"title": "Kayıt oluşturuldu",
"title_tr": "Kayıt oluşturuldu",
"title_en": "Shipment created",
"subtitle": "Gönderi bilgileri taşıyıcıya API üzerinden iletildi.",
"subtitle_tr": "Gönderi bilgileri taşıyıcıya API üzerinden iletildi.",
"subtitle_en": "Shipment details were sent to the carrier through the API.",
"location_text": "ISTANBUL TR",
"location_country_code": "TR",
"source": "SYSTEM",
"carrier_tracking_no": "TRK123456789"
}
],
"package_images": [
{
"image_id": 127,
"pack_no": 1,
"image_type": "PACKAGE",
"capture_method": "UPLOAD",
"file_name": "123456-1-example.jpg",
"file_ext": "jpg",
"mime_type": "image/jpeg",
"file_size_bytes": 424634,
"image_width": 2200,
"image_height": 1650,
"is_primary": true,
"url": "https://api.mapcargo.com.tr/v1/shipments/123456/images/127",
"thumbnail_url": "https://api.mapcargo.com.tr/v1/shipments/123456/images/127?size=thumb",
"created_at": "2026-07-06 14:25:00"
}
],
"request_id": "req_..."
}
Hata Formatı
{
"ok": false,
"error": {
"code": "validation_failed",
"message": "products.0.currency zorunludur ve şu kodlardan biri olmalıdır: USD, EUR, GBP, CAD, SAR.",
"details": {
"field": "products.0.currency",
"message_tr": "products.0.currency zorunludur ve şu kodlardan biri olmalıdır: USD, EUR, GBP, CAD, SAR.",
"message_en": "products.0.currency is required and must be one of these codes: USD, EUR, GBP, CAD, SAR.",
"allowed_values": ["USD", "EUR", "GBP", "CAD", "SAR"],
"allowed_currencies": {
"USD": {"tr": "Amerikan Doları", "en": "US Dollar"},
"EUR": {"tr": "Euro", "en": "Euro"},
"GBP": {"tr": "İngiliz Sterlini", "en": "British Pound Sterling"},
"CAD": {"tr": "Kanada Doları", "en": "Canadian Dollar"},
"SAR": {"tr": "Suudi Arabistan Riyali", "en": "Saudi Riyal"}
},
"received": null
}
},
"request_id": "req_..."
}
| Status | Anlam |
|---|---|
| 400 | Boş veya hatalı JSON. |
| 401 | Eksik veya geçersiz API kimliği. |
| 403 | IP whitelist veya pasif API erişimi hatası. |
| 409 | Idempotency veya gönderi durumu çakışması. |
| 422 | Payload doğrulama hatası. |
| 429 | Rate limit aşıldı. |
Kod Örnekleri
$payload = array (
'external_reference' => 'CARGO-10001',
'origin_country' => 'TR',
'destination_country' => 'AE',
'shipment_type' => 'SALE',
'valuation_currency' => 'USD',
'sender' =>
array (
'entity_type' => 'COMPANY',
'company_name' => 'Sender Company',
'contact_name' => 'Sender Name',
'phone_country_code' => '+90',
'phone' => '5551112233',
'address_line1' => 'Istanbul warehouse',
'country_code' => 'TR',
'city' => 'Istanbul',
'postal_code' => '34000',
),
'recipient' =>
array (
'entity_type' => 'PERSON',
'full_name' => 'Receiver Name',
'phone_country_code' => '+971',
'phone' => '501112233',
'email' => 'receiver@example.com',
'address_line1' => 'Business Bay',
'country_code' => 'AE',
'city' => 'Dubai',
'postal_code' => '00000',
),
'packages' =>
array (
0 =>
array (
'quantity' => 1,
'length_cm' => 30,
'width_cm' => 20,
'height_cm' => 10,
'weight_kg' => 2.5,
),
),
'products' =>
array (
0 =>
array (
'product_name_en' => 'Cotton T-Shirt',
'product_name_tr' => 'Pamuk Tişört',
'hs_code' => '610910',
'origin_country' => 'TR',
'quantity' => 2,
'unit_price' => 12.5,
'currency' => 'USD',
),
),
'note' => 'Test gönderisi',
);
$ch = curl_init("https://api.mapcargo.com.tr/v1/shipments");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Mapex-Client-Id: mxcl_xxxxxxxxxxxxxxxx",
"X-Mapex-Api-Key: mxsk_xxxxxxxxxxxxxxxx",
"Idempotency-Key: cargo-10001",
],
CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
]);
$response = curl_exec($ch);
$data = json_decode((string)$response, true);import requests
payload = {
"external_reference": "CARGO-10001",
"origin_country": "TR",
"destination_country": "AE",
"shipment_type": "SALE",
"valuation_currency": "USD",
"sender": {
"entity_type": "COMPANY",
"company_name": "Sender Company",
"contact_name": "Sender Name",
"phone_country_code": "+90",
"phone": "5551112233",
"address_line1": "Istanbul warehouse",
"country_code": "TR",
"city": "Istanbul",
"postal_code": "34000"
},
"recipient": {
"entity_type": "PERSON",
"full_name": "Receiver Name",
"phone_country_code": "+971",
"phone": "501112233",
"email": "receiver@example.com",
"address_line1": "Business Bay",
"country_code": "AE",
"city": "Dubai",
"postal_code": "00000"
},
"packages": [
{
"quantity": 1,
"length_cm": 30,
"width_cm": 20,
"height_cm": 10,
"weight_kg": 2.5
}
],
"products": [
{
"product_name_en": "Cotton T-Shirt",
"product_name_tr": "Pamuk Tişört",
"hs_code": "610910",
"origin_country": "TR",
"quantity": 2,
"unit_price": 12.5,
"currency": "USD"
}
],
"note": "Test gönderisi"
}
res = requests.post(
"https://api.mapcargo.com.tr/v1/shipments",
json=payload,
headers={
"X-Mapex-Client-Id": "mxcl_xxxxxxxxxxxxxxxx",
"X-Mapex-Api-Key": "mxsk_xxxxxxxxxxxxxxxx",
"Idempotency-Key": "cargo-10001",
},
timeout=20,
)
print(res.json())using System.Net.Http;
using System.Text;
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-Mapex-Client-Id", "mxcl_xxxxxxxxxxxxxxxx");
client.DefaultRequestHeaders.Add("X-Mapex-Api-Key", "mxsk_xxxxxxxxxxxxxxxx");
client.DefaultRequestHeaders.Add("Idempotency-Key", "cargo-10001");
var json = """
{
"external_reference": "CARGO-10001",
"origin_country": "TR",
"destination_country": "AE",
"shipment_type": "SALE",
"valuation_currency": "USD",
"sender": {
"entity_type": "COMPANY",
"company_name": "Sender Company",
"contact_name": "Sender Name",
"phone_country_code": "+90",
"phone": "5551112233",
"address_line1": "Istanbul warehouse",
"country_code": "TR",
"city": "Istanbul",
"postal_code": "34000"
},
"recipient": {
"entity_type": "PERSON",
"full_name": "Receiver Name",
"phone_country_code": "+971",
"phone": "501112233",
"email": "receiver@example.com",
"address_line1": "Business Bay",
"country_code": "AE",
"city": "Dubai",
"postal_code": "00000"
},
"packages": [
{
"quantity": 1,
"length_cm": 30,
"width_cm": 20,
"height_cm": 10,
"weight_kg": 2.5
}
],
"products": [
{
"product_name_en": "Cotton T-Shirt",
"product_name_tr": "Pamuk Tişört",
"hs_code": "610910",
"origin_country": "TR",
"quantity": 2,
"unit_price": 12.5,
"currency": "USD"
}
],
"note": "Test gönderisi"
}
""";
var response = await client.PostAsync(
"https://api.mapcargo.com.tr/v1/shipments",
new StringContent(json, Encoding.UTF8, "application/json")
);
var body = await response.Content.ReadAsStringAsync();const payload = {
"external_reference": "CARGO-10001",
"origin_country": "TR",
"destination_country": "AE",
"shipment_type": "SALE",
"valuation_currency": "USD",
"sender": {
"entity_type": "COMPANY",
"company_name": "Sender Company",
"contact_name": "Sender Name",
"phone_country_code": "+90",
"phone": "5551112233",
"address_line1": "Istanbul warehouse",
"country_code": "TR",
"city": "Istanbul",
"postal_code": "34000"
},
"recipient": {
"entity_type": "PERSON",
"full_name": "Receiver Name",
"phone_country_code": "+971",
"phone": "501112233",
"email": "receiver@example.com",
"address_line1": "Business Bay",
"country_code": "AE",
"city": "Dubai",
"postal_code": "00000"
},
"packages": [
{
"quantity": 1,
"length_cm": 30,
"width_cm": 20,
"height_cm": 10,
"weight_kg": 2.5
}
],
"products": [
{
"product_name_en": "Cotton T-Shirt",
"product_name_tr": "Pamuk Tişört",
"hs_code": "610910",
"origin_country": "TR",
"quantity": 2,
"unit_price": 12.5,
"currency": "USD"
}
],
"note": "Test gönderisi"
};
const response = await fetch("https://api.mapcargo.com.tr/v1/shipments", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Mapex-Client-Id": "mxcl_xxxxxxxxxxxxxxxx",
"X-Mapex-Api-Key": "mxsk_xxxxxxxxxxxxxxxx",
"Idempotency-Key": "cargo-10001"
},
body: JSON.stringify(payload)
});
const data = await response.json();
OpenAPI
Makine tarafından okunabilir şema: https://api.mapcargo.com.tr/openapi.json