REST API v1

Mikro Kurye Kurumsal API

Kurumsal sistemlerinizden sipariş oluşturma, takip ve raporlama için JSON REST API.

API kullanımı

Tüm korumalı uçlara istek atarken API anahtarınızı şu başlıkla gönderin:

Authorization: Bearer <API_ANAHTARI>

Anahtarları kurumsal panelden oluşturabilirsiniz. Test ve canlı anahtarlar ayrıdır; test anahtarıyla oluşturulan siparişler canlı kurye havuzuna düşmez.

Temel uçlar

MethodPathAçıklama
GET/api/v1/healthSağlık kontrolü (kimlik doğrulama gerekmez)
POST/api/v1/ordersSipariş oluştur
GET/api/v1/ordersSipariş listesi
GET/api/v1/orders/{id}Sipariş detayı
POST/api/v1/orders/{id}/cancelSipariş iptal
GET/api/v1/orders/{id}/trackingCanlı takip
GET/api/v1/reports/summaryRapor özeti
GET/api/v1/statements/{y}/{m}Dönem ekstresi

Çoklu teslimat (rota)

stops[] veya deliveries[] ile 2+ varış gönderin. Tek çıkış noktası; her durak ayrı teslimat kodu alır (OrderGroup). Tek-durak alanları (dropoff_address …) geriye uyumlu kalır.

{
  "pickup_address": "Kadıköy, İstanbul",
  "payment_type": "cari",
  "stops": [
    {
      "address": "Beşiktaş, İstanbul",
      "recipient_name": "Ayşe Yılmaz",
      "recipient_phone": "05321234567",
      "note": "Kat 3"
    },
    {
      "address": "Şişli, İstanbul",
      "recipient_name": "Can Demir",
      "recipient_phone": "05339876543"
    }
  ]
}

Yanıtta group_id, stop_count, total_price_try ve orders[] döner. Tek-durakta yanıt düz sipariş objesi olarak kalır.

Entegrasyon örnekleri

<API_ANAHTARI> yerine panelden aldığınız anahtarı yazın. Aşağıda sağlık kontrolü ve sipariş oluşturma iskeleti var.

cURL — GET health + POST orders
# Sağlık (auth gerekmez)
curl -s https://api.mikrokurye.net/api/v1/health

# Sipariş oluştur
curl -X POST https://api.mikrokurye.net/api/v1/orders \
  -H "Authorization: Bearer <API_ANAHTARI>" \
  -H "Content-Type: application/json" \
  -d '{
    "pickup_address": "Kadıköy, İstanbul",
    "dropoff_address": "Beşiktaş, İstanbul",
    "recipient_name": "Ayşe Yılmaz",
    "recipient_phone": "05321234567",
    "product_type": "evrak"
  }'
Python (requests)
import requests

BASE = "https://api.mikrokurye.net/api/v1"
API_KEY = "<API_ANAHTARI>"

# Sağlık
print(requests.get(f"{BASE}/health").json())

# Sipariş oluştur
r = requests.post(
    f"{BASE}/orders",
    headers={
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json",
    },
    json={
        "pickup_address": "Kadıköy, İstanbul",
        "dropoff_address": "Beşiktaş, İstanbul",
        "recipient_name": "Ayşe Yılmaz",
        "recipient_phone": "05321234567",
        "product_type": "evrak",
    },
)
print(r.status_code, r.json())
Node.js (fetch)
const BASE = "https://api.mikrokurye.net/api/v1";
const API_KEY = "<API_ANAHTARI>";

// Sağlık
const health = await fetch(`${BASE}/health`);
console.log(await health.json());

// Sipariş oluştur
const res = await fetch(`${BASE}/orders`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    pickup_address: "Kadıköy, İstanbul",
    dropoff_address: "Beşiktaş, İstanbul",
    recipient_name: "Ayşe Yılmaz",
    recipient_phone: "05321234567",
    product_type: "evrak",
  }),
});
console.log(res.status, await res.json());
PHP (cURL)
<?php
$base = "https://api.mikrokurye.net/api/v1";
$apiKey = "<API_ANAHTARI>";

// Sipariş oluştur
$payload = json_encode([
    "pickup_address" => "Kadıköy, İstanbul",
    "dropoff_address" => "Beşiktaş, İstanbul",
    "recipient_name" => "Ayşe Yılmaz",
    "recipient_phone" => "05321234567",
    "product_type" => "evrak",
]);

$ch = curl_init("$base/orders");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $apiKey",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "$status\n$response\n";
C# (HttpClient)
using System.Net.Http.Headers;
using System.Net.Http.Json;

const string Base = "https://api.mikrokurye.net/api/v1";
const string ApiKey = "<API_ANAHTARI>";

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", ApiKey);

// Sipariş oluştur
var body = new {
    pickup_address = "Kadıköy, İstanbul",
    dropoff_address = "Beşiktaş, İstanbul",
    recipient_name = "Ayşe Yılmaz",
    recipient_phone = "05321234567",
    product_type = "evrak",
};
var res = await client.PostAsJsonAsync($"{Base}/orders", body);
var json = await res.Content.ReadAsStringAsync();
Console.WriteLine($"{(int)res.StatusCode} {json}");
PowerShell
$Base = "https://api.mikrokurye.net/api/v1"
$ApiKey = "<API_ANAHTARI>"

# Sağlık
Invoke-RestMethod -Uri "$Base/health" -Method GET

# Sipariş oluştur
$headers = @{
  Authorization = "Bearer $ApiKey"
  "Content-Type" = "application/json"
}
$body = @{
  pickup_address = "Kadıköy, İstanbul"
  dropoff_address = "Beşiktaş, İstanbul"
  recipient_name = "Ayşe Yılmaz"
  recipient_phone = "05321234567"
  product_type = "evrak"
} | ConvertTo-Json

Invoke-RestMethod -Uri "$Base/orders" -Method POST -Headers $headers -Body $body