{
    "openapi": "3.1.0",
    "info": {
        "title": "İnfudex E-Ticaret Otomasyon API",
        "version": "v1",
        "description": "Siparişlerinizi, ürünlerinizi ve stoklarınızı kendi yazılımınızdan yönetin. Ayrıntılı rehber: https://infudex.com/developers"
    },
    "servers": [
        {
            "url": "https://infudex.com/api/v1"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "paths": {
        "/me": {
            "get": {
                "operationId": "me",
                "tags": [
                    "Hesap"
                ],
                "summary": "Bağlantıyı doğrula",
                "description": "Anahtarın bağlı olduğu çalışma alanını, anahtarın izinlerini ve istek sınırını döner. Entegrasyonunuzu kurarken ilk bu uçla deneyin.",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": {
                                        "workspace": {
                                            "name": "Atölye Nar",
                                            "currency": "TRY",
                                            "timezone": "Europe/Istanbul"
                                        },
                                        "key": {
                                            "name": "ERP entegrasyonu",
                                            "prefix": "ifx_AbCdEfGhIjKl…",
                                            "scopes": [
                                                "orders:read",
                                                "orders:write"
                                            ],
                                            "expires_at": null
                                        },
                                        "rate_limit": {
                                            "requests_per_minute": 120
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/shops": {
            "get": {
                "operationId": "shops",
                "tags": [
                    "Hesap"
                ],
                "summary": "Satış kanallarını listele",
                "description": "Çalışma alanına bağlı pazaryeri ve mağazalar. Sipariş listesini kanala göre süzmek için buradaki id kullanılır.\n\nGerekli izin: shops:read",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Sayfa numarası (varsayılan 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Sayfa başına kayıt, 1-100 (varsayılan 25).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "id": "0199c3f2-0000-7000-8000-00000000a001",
                                            "name": "Trendyol mağazam",
                                            "platform": "trendyol",
                                            "platform_name": "Trendyol",
                                            "status": "connected",
                                            "currency": "TRY",
                                            "is_demo": false,
                                            "last_synced_at": "2026-10-10T09:55:00+03:00",
                                            "syncable": true,
                                            "sync": {
                                                "queued": false,
                                                "error": null
                                            }
                                        }
                                    ],
                                    "meta": {
                                        "page": 1,
                                        "per_page": 25,
                                        "total": 1,
                                        "last_page": 1
                                    },
                                    "links": {
                                        "next": null,
                                        "prev": null
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/shops/{id}": {
            "get": {
                "operationId": "shops_show",
                "tags": [
                    "Hesap"
                ],
                "summary": "Kanal ayrıntısı ve senkron durumu",
                "description": "sync.queued true ise senkron sırada ya da çalışıyor; bitince last_synced_at güncellenir. sync.error son senkron hatasıdır.\n\nGerekli izin: shops:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": {
                                        "id": "0199c3f2-0000-7000-8000-00000000a001",
                                        "name": "Trendyol mağazam",
                                        "platform": "trendyol",
                                        "platform_name": "Trendyol",
                                        "status": "connected",
                                        "currency": "TRY",
                                        "is_demo": false,
                                        "last_synced_at": "2026-10-10T09:55:00+03:00",
                                        "syncable": true,
                                        "sync": {
                                            "queued": false,
                                            "error": null
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/shops/{id}/sync": {
            "post": {
                "operationId": "shops_sync",
                "tags": [
                    "Hesap"
                ],
                "summary": "Pazaryerinden siparişleri çek (senkron başlat)",
                "description": "Kanalın yeni siparişlerini, durum değişikliklerini ve ürünlerini pazaryerinden panele çekmeyi arka planda başlatır; panelin düzenli otomatik senkronunu beklemeden. Yanıt hemen 202 döner; bitişini GET /shops/{id} ile izleyin. Aynı kanalda son senkrondan 5 dakika geçmeden yenisi başlatılamaz (429 sync_too_soon). Özel, manuel ve CSV kanallar senkronlanmaz.\n\nGerekli izin: shops:sync",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": {
                                        "queued": true,
                                        "already_queued": false,
                                        "shop": {
                                            "id": "0199c3f2-0000-7000-8000-00000000a001",
                                            "name": "Trendyol mağazam",
                                            "platform": "trendyol",
                                            "platform_name": "Trendyol",
                                            "status": "connected",
                                            "currency": "TRY",
                                            "is_demo": false,
                                            "last_synced_at": "2026-10-10T09:55:00+03:00",
                                            "syncable": true,
                                            "sync": {
                                                "queued": true,
                                                "error": null
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/carriers": {
            "get": {
                "operationId": "carriers",
                "tags": [
                    "Hesap"
                ],
                "summary": "Kargo firmalarını listele",
                "description": "Gönderi eklerken carrier alanında kullanılabilecek kargo firması anahtarları.",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "key": "yurtici",
                                            "name": "Yurtiçi Kargo"
                                        },
                                        {
                                            "key": "aras",
                                            "name": "Aras Kargo"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orders": {
            "get": {
                "operationId": "orders_list",
                "tags": [
                    "Siparişler"
                ],
                "summary": "Siparişleri listele",
                "description": "Bütün kanallardaki siparişler, kalemleri ve gönderileriyle. Değişenleri düzenli çekmek için updated_since ve sort=updated_at birlikte kullanın; son aldığınız kaydın updated_at değerini bir sonraki istekte gönderin.\n\nGerekli izin: orders:read",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Virgülle ayrılmış durumlar: paid, processing, shipped, delivered, completed, canceled, refunded.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "shop_id",
                        "in": "query",
                        "required": false,
                        "description": "Yalnızca bu kanalın siparişleri (/shops).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "ordered_since",
                        "in": "query",
                        "required": false,
                        "description": "Bu tarihten (dahil) sonra verilen siparişler. ISO 8601, ör. 2026-10-01T00:00:00+03:00.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "ordered_until",
                        "in": "query",
                        "required": false,
                        "description": "Bu tarihe (dahil) kadar verilen siparişler.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "description": "Bu tarihten sonra değişen siparişler (durum, kargo, adres…).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "required": false,
                        "description": "-ordered_at (varsayılan, yeniden eskiye), ordered_at, updated_at, -updated_at.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Sayfa numarası (varsayılan 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Sayfa başına kayıt, 1-100 (varsayılan 25).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "id": "0199c3f2-7b1a-7c3e-9f10-2a4b6c8d0e12",
                                            "number": "283534307",
                                            "external_id": "3099b7db-6a35-498d",
                                            "shop": {
                                                "id": "0199c3f2-0000-7000-8000-00000000a001",
                                                "name": "Trendyol mağazam",
                                                "platform": "trendyol"
                                            },
                                            "status": "paid",
                                            "is_paid": true,
                                            "is_gift": false,
                                            "gift_message": null,
                                            "buyer_note": null,
                                            "buyer": {
                                                "name": "Ayşe Yılmaz",
                                                "email": "ayse@example.com"
                                            },
                                            "shipping_address": {
                                                "name": "Ayşe Yılmaz",
                                                "line1": "Moda Cad. 5",
                                                "line2": null,
                                                "city": "İstanbul",
                                                "state": "Kadıköy",
                                                "zip": "34710",
                                                "country": "TR",
                                                "phone": "05551112233"
                                            },
                                            "currency": "TRY",
                                            "subtotal": 30000,
                                            "shipping_cost": 3000,
                                            "tax": 0,
                                            "discount": 2000,
                                            "total": 31000,
                                            "items": [
                                                {
                                                    "external_id": "9001",
                                                    "title": "Keten gömlek",
                                                    "sku": "GML-M",
                                                    "quantity": 2,
                                                    "price": 15000,
                                                    "tax_rate": 20,
                                                    "variations": {
                                                        "Beden": "M"
                                                    },
                                                    "product_id": "0199c3f2-0000-7000-8000-00000000b001"
                                                }
                                            ],
                                            "shipments": [],
                                            "ordered_at": "2026-10-09T14:05:00+03:00",
                                            "shipped_at": null,
                                            "delivered_at": null,
                                            "created_at": "2026-10-09T14:06:12+03:00",
                                            "updated_at": "2026-10-09T14:06:12+03:00"
                                        }
                                    ],
                                    "meta": {
                                        "page": 1,
                                        "per_page": 25,
                                        "total": 1,
                                        "last_page": 1
                                    },
                                    "links": {
                                        "next": null,
                                        "prev": null
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "orders_create",
                "tags": [
                    "Siparişler"
                ],
                "summary": "Siparişi panele aktar (kendi sitenizden)",
                "description": "Kendi sitenizde, mağazanızda ya da yazılımınızda oluşan siparişi bir özel kanala kaydeder (Kanallar → Kanal ekle → Özel kanal). Sipariş pazaryeri siparişleriyle aynı şekilde işlenir: SKU ya da product_id ile eşleşen ürünlerin stoğu düşer (stok senkronu açıksa), otomatik fatura ve yeni sipariş bildirimi çalışır, aylık sipariş limitine sayılır. external_id sizin sisteminizdeki sipariş numarasıdır; aynı kanalda tekrar gönderilirse 409 order_exists ve mevcut siparişin id’si döner, böylece tekrar denemelerde çift kayıt oluşmaz.\n\nGerekli izin: orders:write",
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Yeniden denemelerde aynı işlemin iki kez yapılmaması için 8-100 karakterlik benzersiz değer.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": {
                                        "id": "0199c3f2-7b1a-7c3e-9f10-2a4b6c8d0e12",
                                        "number": "WEB-10045",
                                        "external_id": "WEB-10045",
                                        "shop": {
                                            "id": "0199c3f2-0000-7000-8000-00000000a009",
                                            "name": "Web sitem",
                                            "platform": "custom"
                                        },
                                        "status": "paid",
                                        "is_paid": true,
                                        "is_gift": false,
                                        "gift_message": null,
                                        "buyer_note": null,
                                        "buyer": {
                                            "name": "Ayşe Yılmaz",
                                            "email": "ayse@example.com"
                                        },
                                        "shipping_address": {
                                            "name": "Ayşe Yılmaz",
                                            "line1": "Moda Cad. 5",
                                            "line2": null,
                                            "city": "İstanbul",
                                            "state": "Kadıköy",
                                            "zip": "34710",
                                            "country": "TR",
                                            "phone": "05551112233"
                                        },
                                        "currency": "TRY",
                                        "subtotal": 30000,
                                        "shipping_cost": 3000,
                                        "tax": 0,
                                        "discount": 2000,
                                        "total": 31000,
                                        "items": [
                                            {
                                                "external_id": "9001",
                                                "title": "Keten gömlek",
                                                "sku": "GML-M",
                                                "quantity": 2,
                                                "price": 15000,
                                                "tax_rate": 20,
                                                "variations": {
                                                    "Beden": "M"
                                                },
                                                "product_id": "0199c3f2-0000-7000-8000-00000000b001"
                                            }
                                        ],
                                        "shipments": [],
                                        "ordered_at": "2026-10-09T14:05:00+03:00",
                                        "shipped_at": null,
                                        "delivered_at": null,
                                        "created_at": "2026-10-09T14:06:12+03:00",
                                        "updated_at": "2026-10-09T14:06:12+03:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "external_id": {
                                        "type": "string",
                                        "description": "Sizin sisteminizdeki sipariş kimliği (kanal içinde benzersiz), en çok 100 karakter."
                                    },
                                    "shop_id": {
                                        "type": "string",
                                        "format": "uuid",
                                        "description": "Özel kanalın id’si (kanal sayfasında yazar). Tek özel kanalınız varsa gönderilmeyebilir."
                                    },
                                    "number": {
                                        "type": "string",
                                        "description": "Panelde görünecek sipariş numarası (varsayılan external_id)."
                                    },
                                    "status": {
                                        "type": "string",
                                        "description": "paid (varsayılan), processing, shipped, delivered."
                                    },
                                    "ordered_at": {
                                        "type": "string",
                                        "format": "date-time",
                                        "description": "Sipariş zamanı (varsayılan şimdi)."
                                    },
                                    "currency": {
                                        "type": "string",
                                        "description": "Para birimi, ör. TRY (varsayılan kanalın para birimi)."
                                    },
                                    "buyer.name": {
                                        "type": "string",
                                        "description": "Alıcı adı."
                                    },
                                    "buyer.email": {
                                        "type": "string",
                                        "description": "Alıcı e-postası."
                                    },
                                    "shipping_address": {
                                        "type": "object",
                                        "description": "name, line1, line2, city, state (ilçe), zip, country (ISO 2 harf), phone."
                                    },
                                    "items": {
                                        "type": "array",
                                        "items": {
                                            "type": "object"
                                        },
                                        "description": "1-200 kalem: product_id ya da sku (stok kalemiyle eşleşme), title (product_id yoksa zorunlu), quantity, price (küçük birim, birim fiyat), tax_rate, variations (ör. {\"Beden\": \"M\"})."
                                    },
                                    "shipping_cost": {
                                        "type": "integer",
                                        "description": "Kargo ücreti (küçük birim)."
                                    },
                                    "discount": {
                                        "type": "integer",
                                        "description": "Toplam indirim (küçük birim)."
                                    },
                                    "tax": {
                                        "type": "integer",
                                        "description": "Fiyatlara dahil değilse vergi tutarı (küçük birim)."
                                    },
                                    "buyer_note": {
                                        "type": "string",
                                        "description": "Alıcı notu."
                                    },
                                    "is_paid": {
                                        "type": "boolean",
                                        "description": "Ödendi mi (varsayılan true)."
                                    }
                                },
                                "required": [
                                    "external_id",
                                    "buyer.name",
                                    "items"
                                ]
                            },
                            "example": {
                                "external_id": "WEB-10045",
                                "buyer": {
                                    "name": "Ayşe Yılmaz",
                                    "email": "ayse@example.com"
                                },
                                "shipping_address": {
                                    "line1": "Moda Cad. 5",
                                    "city": "İstanbul",
                                    "state": "Kadıköy",
                                    "zip": "34710",
                                    "country": "TR",
                                    "phone": "05551112233"
                                },
                                "items": [
                                    {
                                        "sku": "GML-M",
                                        "title": "Keten gömlek",
                                        "quantity": 2,
                                        "price": 15000,
                                        "variations": {
                                            "Beden": "M"
                                        }
                                    }
                                ],
                                "shipping_cost": 3000,
                                "discount": 2000
                            }
                        }
                    }
                }
            }
        },
        "/orders/{id}": {
            "get": {
                "operationId": "orders_show",
                "tags": [
                    "Siparişler"
                ],
                "summary": "Sipariş ayrıntısı",
                "description": "Tek sipariş; id, listede dönen UUID’dir.\n\nGerekli izin: orders:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": {
                                        "id": "0199c3f2-7b1a-7c3e-9f10-2a4b6c8d0e12",
                                        "number": "283534307",
                                        "external_id": "3099b7db-6a35-498d",
                                        "shop": {
                                            "id": "0199c3f2-0000-7000-8000-00000000a001",
                                            "name": "Trendyol mağazam",
                                            "platform": "trendyol"
                                        },
                                        "status": "paid",
                                        "is_paid": true,
                                        "is_gift": false,
                                        "gift_message": null,
                                        "buyer_note": null,
                                        "buyer": {
                                            "name": "Ayşe Yılmaz",
                                            "email": "ayse@example.com"
                                        },
                                        "shipping_address": {
                                            "name": "Ayşe Yılmaz",
                                            "line1": "Moda Cad. 5",
                                            "line2": null,
                                            "city": "İstanbul",
                                            "state": "Kadıköy",
                                            "zip": "34710",
                                            "country": "TR",
                                            "phone": "05551112233"
                                        },
                                        "currency": "TRY",
                                        "subtotal": 30000,
                                        "shipping_cost": 3000,
                                        "tax": 0,
                                        "discount": 2000,
                                        "total": 31000,
                                        "items": [
                                            {
                                                "external_id": "9001",
                                                "title": "Keten gömlek",
                                                "sku": "GML-M",
                                                "quantity": 2,
                                                "price": 15000,
                                                "tax_rate": 20,
                                                "variations": {
                                                    "Beden": "M"
                                                },
                                                "product_id": "0199c3f2-0000-7000-8000-00000000b001"
                                            }
                                        ],
                                        "shipments": [],
                                        "ordered_at": "2026-10-09T14:05:00+03:00",
                                        "shipped_at": null,
                                        "delivered_at": null,
                                        "created_at": "2026-10-09T14:06:12+03:00",
                                        "updated_at": "2026-10-09T14:06:12+03:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orders/{id}/status": {
            "post": {
                "operationId": "orders_status",
                "tags": [
                    "Siparişler"
                ],
                "summary": "Sipariş durumunu değiştir",
                "description": "Özel kanal siparişinin durumunu günceller: processing, shipped, delivered, canceled, refunded. İptal ve iadede düşülen stok geri eklenir; kargoya verilince otomatik fatura çalışır. Pazaryeri siparişlerinin durumu pazaryerinden gelir, bu uçla değiştirilemez (409 status_managed_by_channel). İptal / iade edilmiş sipariş yeniden açılamaz; teslim edilmiş sipariş yalnızca iptal ya da iade edilebilir.\n\nGerekli izin: orders:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": {
                                        "id": "0199c3f2-7b1a-7c3e-9f10-2a4b6c8d0e12",
                                        "number": "283534307",
                                        "external_id": "3099b7db-6a35-498d",
                                        "shop": {
                                            "id": "0199c3f2-0000-7000-8000-00000000a001",
                                            "name": "Trendyol mağazam",
                                            "platform": "trendyol"
                                        },
                                        "status": "canceled",
                                        "is_paid": true,
                                        "is_gift": false,
                                        "gift_message": null,
                                        "buyer_note": null,
                                        "buyer": {
                                            "name": "Ayşe Yılmaz",
                                            "email": "ayse@example.com"
                                        },
                                        "shipping_address": {
                                            "name": "Ayşe Yılmaz",
                                            "line1": "Moda Cad. 5",
                                            "line2": null,
                                            "city": "İstanbul",
                                            "state": "Kadıköy",
                                            "zip": "34710",
                                            "country": "TR",
                                            "phone": "05551112233"
                                        },
                                        "currency": "TRY",
                                        "subtotal": 30000,
                                        "shipping_cost": 3000,
                                        "tax": 0,
                                        "discount": 2000,
                                        "total": 31000,
                                        "items": [
                                            {
                                                "external_id": "9001",
                                                "title": "Keten gömlek",
                                                "sku": "GML-M",
                                                "quantity": 2,
                                                "price": 15000,
                                                "tax_rate": 20,
                                                "variations": {
                                                    "Beden": "M"
                                                },
                                                "product_id": "0199c3f2-0000-7000-8000-00000000b001"
                                            }
                                        ],
                                        "shipments": [],
                                        "ordered_at": "2026-10-09T14:05:00+03:00",
                                        "shipped_at": null,
                                        "delivered_at": null,
                                        "created_at": "2026-10-09T14:06:12+03:00",
                                        "updated_at": "2026-10-09T14:06:12+03:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "description": "processing, shipped, delivered, canceled ya da refunded."
                                    }
                                },
                                "required": [
                                    "status"
                                ]
                            },
                            "example": {
                                "status": "canceled"
                            }
                        }
                    }
                }
            }
        },
        "/orders/{id}/shipments": {
            "post": {
                "operationId": "orders_shipment",
                "tags": [
                    "Siparişler"
                ],
                "summary": "Siparişe kargo takip numarası ekle",
                "description": "Gönderiyi kaydeder, siparişi kargoda yapar ve takip numarasını siparişin geldiği pazaryerine iletir (kanal destekliyorsa). Aynı takip numarası aynı siparişe iki kez eklenemez. Yeniden deneme ihtimaline karşı Idempotency-Key başlığı gönderin.\n\nGerekli izin: orders:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Yeniden denemelerde aynı işlemin iki kez yapılmaması için 8-100 karakterlik benzersiz değer.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": {
                                        "id": "0199c3f2-0000-7000-8000-00000000c001",
                                        "carrier": "yurtici",
                                        "carrier_name": "Yurtiçi Kargo",
                                        "service": null,
                                        "tracking_number": "YK123456789",
                                        "tracking_url": "https://www.yurticikargo.com/tr/online-servisler/gonderi-sorgula?code=YK123456789",
                                        "status": "in_transit",
                                        "shipped_at": "2026-10-10T10:00:00+03:00",
                                        "delivered_at": null,
                                        "pushed_to_channel_at": "2026-10-10T10:00:02+03:00",
                                        "created_at": "2026-10-10T10:00:00+03:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "carrier": {
                                        "type": "string",
                                        "description": "Kargo firması anahtarı (/carriers), ör. yurtici."
                                    },
                                    "tracking_number": {
                                        "type": "string",
                                        "description": "Takip numarası, 4-64 karakter; harf, rakam, boşluk ve - _ . / içerebilir."
                                    },
                                    "notify_buyer": {
                                        "type": "boolean",
                                        "description": "Alıcıya kargo e-postası gönderilsin mi (varsayılan false)."
                                    }
                                },
                                "required": [
                                    "carrier",
                                    "tracking_number"
                                ]
                            },
                            "example": {
                                "carrier": "yurtici",
                                "tracking_number": "YK123456789",
                                "notify_buyer": false
                            }
                        }
                    }
                }
            }
        },
        "/products": {
            "get": {
                "operationId": "products_list",
                "tags": [
                    "Ürünler ve stok"
                ],
                "summary": "Ürünleri listele",
                "description": "Merkezi stok kalemleri ve her birinin kanallardaki ilanları. stock, stok takibi kapalı üründe null döner.\n\nGerekli izin: products:read",
                "parameters": [
                    {
                        "name": "sku",
                        "in": "query",
                        "required": false,
                        "description": "Tam SKU eşleşmesi.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "description": "Bu tarihten sonra değişen ürünler.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "include_archived",
                        "in": "query",
                        "required": false,
                        "description": "Arşivlenmiş ürünler de gelsin (varsayılan false).",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Sayfa numarası (varsayılan 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Sayfa başına kayıt, 1-100 (varsayılan 25).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "id": "0199c3f2-0000-7000-8000-00000000b001",
                                            "sku": "GML-M",
                                            "title": "Keten gömlek — M",
                                            "kind": "physical",
                                            "image_url": "https://…/gomlek.jpg",
                                            "track_stock": true,
                                            "stock": 12,
                                            "low_stock_threshold": 3,
                                            "is_group": false,
                                            "is_archived": false,
                                            "weight_grams": 250,
                                            "tax_rate": 20,
                                            "listings": [
                                                {
                                                    "id": "0199c3f2-0000-7000-8000-00000000d001",
                                                    "shop": {
                                                        "id": "0199c3f2-0000-7000-8000-00000000a001",
                                                        "name": "Trendyol mağazam",
                                                        "platform": "trendyol"
                                                    },
                                                    "external_id": "8680001112223",
                                                    "title": "Keten gömlek",
                                                    "state": "active",
                                                    "price": 15000,
                                                    "currency": "TRY",
                                                    "quantity": 12,
                                                    "url": null
                                                }
                                            ],
                                            "created_at": "2026-09-01T09:00:00+03:00",
                                            "updated_at": "2026-10-10T10:00:00+03:00"
                                        }
                                    ],
                                    "meta": {
                                        "page": 1,
                                        "per_page": 25,
                                        "total": 1,
                                        "last_page": 1
                                    },
                                    "links": {
                                        "next": null,
                                        "prev": null
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "products_create",
                "tags": [
                    "Ürünler ve stok"
                ],
                "summary": "Ürün oluştur",
                "description": "Yeni stok kalemi açar. SKU çalışma alanında benzersizdir (büyük-küçük harf farkı gözetilmez); varsa 409 sku_exists ve mevcut ürünün id’si döner. Pazaryeri ilanları senkronda SKU ile bu ürüne bağlanır.\n\nGerekli izin: products:write",
                "parameters": [],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": {
                                        "id": "0199c3f2-0000-7000-8000-00000000b001",
                                        "sku": "GML-L",
                                        "title": "Keten gömlek — L",
                                        "kind": "physical",
                                        "image_url": "https://…/gomlek.jpg",
                                        "track_stock": true,
                                        "stock": 8,
                                        "low_stock_threshold": 3,
                                        "is_group": false,
                                        "is_archived": false,
                                        "weight_grams": 250,
                                        "tax_rate": 20,
                                        "listings": [],
                                        "created_at": "2026-09-01T09:00:00+03:00",
                                        "updated_at": "2026-10-10T10:00:00+03:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "sku": {
                                        "type": "string",
                                        "description": "Stok kodu, en çok 80 karakter."
                                    },
                                    "title": {
                                        "type": "string",
                                        "description": "Ürün adı."
                                    },
                                    "stock": {
                                        "type": "integer",
                                        "description": "Başlangıç stoğu (varsayılan 0)."
                                    },
                                    "track_stock": {
                                        "type": "boolean",
                                        "description": "Stok takibi (varsayılan true)."
                                    },
                                    "low_stock_threshold": {
                                        "type": "integer",
                                        "description": "Az stok uyarı eşiği (varsayılan 3)."
                                    },
                                    "cost": {
                                        "type": "integer",
                                        "description": "Birim maliyet (küçük birim); kâr hesabında kullanılır."
                                    },
                                    "packaging_cost": {
                                        "type": "integer",
                                        "description": "Paketleme maliyeti (küçük birim)."
                                    },
                                    "cost_currency": {
                                        "type": "string",
                                        "description": "Maliyet para birimi (varsayılan çalışma alanınınki)."
                                    },
                                    "weight_grams": {
                                        "type": "integer",
                                        "description": "Ağırlık (gram)."
                                    },
                                    "tax_rate": {
                                        "type": "number",
                                        "description": "KDV oranı (%)."
                                    },
                                    "image_url": {
                                        "type": "string",
                                        "description": "Görsel adresi (https)."
                                    }
                                },
                                "required": [
                                    "sku",
                                    "title"
                                ]
                            },
                            "example": {
                                "sku": "GML-L",
                                "title": "Keten gömlek — L",
                                "stock": 8,
                                "cost": 6500,
                                "weight_grams": 260
                            }
                        }
                    }
                }
            }
        },
        "/products/{id}": {
            "get": {
                "operationId": "products_show",
                "tags": [
                    "Ürünler ve stok"
                ],
                "summary": "Ürün ayrıntısı",
                "description": "Tek ürün ve ilanları.\n\nGerekli izin: products:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": {
                                        "id": "0199c3f2-0000-7000-8000-00000000b001",
                                        "sku": "GML-M",
                                        "title": "Keten gömlek — M",
                                        "kind": "physical",
                                        "image_url": "https://…/gomlek.jpg",
                                        "track_stock": true,
                                        "stock": 12,
                                        "low_stock_threshold": 3,
                                        "is_group": false,
                                        "is_archived": false,
                                        "weight_grams": 250,
                                        "tax_rate": 20,
                                        "listings": [
                                            {
                                                "id": "0199c3f2-0000-7000-8000-00000000d001",
                                                "shop": {
                                                    "id": "0199c3f2-0000-7000-8000-00000000a001",
                                                    "name": "Trendyol mağazam",
                                                    "platform": "trendyol"
                                                },
                                                "external_id": "8680001112223",
                                                "title": "Keten gömlek",
                                                "state": "active",
                                                "price": 15000,
                                                "currency": "TRY",
                                                "quantity": 12,
                                                "url": null
                                            }
                                        ],
                                        "created_at": "2026-09-01T09:00:00+03:00",
                                        "updated_at": "2026-10-10T10:00:00+03:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "products_update",
                "tags": [
                    "Ürünler ve stok"
                ],
                "summary": "Ürünü güncelle",
                "description": "Yalnızca gönderdiğiniz alanlar değişir: sku, title, cost, packaging_cost, cost_currency, weight_grams, tax_rate, low_stock_threshold, track_stock, image_url, is_archived. Stok bu uçla değişmez; PUT /products/{id}/stock kullanın.\n\nGerekli izin: products:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": {
                                        "id": "0199c3f2-0000-7000-8000-00000000b001",
                                        "sku": "GML-M",
                                        "title": "Keten gömlek — M",
                                        "kind": "physical",
                                        "image_url": "https://…/gomlek.jpg",
                                        "track_stock": true,
                                        "stock": 12,
                                        "low_stock_threshold": 3,
                                        "is_group": false,
                                        "is_archived": false,
                                        "weight_grams": 250,
                                        "tax_rate": 20,
                                        "listings": [
                                            {
                                                "id": "0199c3f2-0000-7000-8000-00000000d001",
                                                "shop": {
                                                    "id": "0199c3f2-0000-7000-8000-00000000a001",
                                                    "name": "Trendyol mağazam",
                                                    "platform": "trendyol"
                                                },
                                                "external_id": "8680001112223",
                                                "title": "Keten gömlek",
                                                "state": "active",
                                                "price": 15000,
                                                "currency": "TRY",
                                                "quantity": 12,
                                                "url": null
                                            }
                                        ],
                                        "created_at": "2026-09-01T09:00:00+03:00",
                                        "updated_at": "2026-10-10T10:00:00+03:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "description": "Ürün adı."
                                    },
                                    "cost": {
                                        "type": "integer",
                                        "description": "Birim maliyet (küçük birim)."
                                    },
                                    "is_archived": {
                                        "type": "boolean",
                                        "description": "Arşive al / çıkar."
                                    }
                                },
                                "required": []
                            },
                            "example": {
                                "cost": 7000,
                                "low_stock_threshold": 5
                            }
                        }
                    }
                }
            }
        },
        "/products/{id}/stock": {
            "put": {
                "operationId": "products_stock",
                "tags": [
                    "Ürünler ve stok"
                ],
                "summary": "Stoğu güncelle",
                "description": "Stoğu verilen adede ayarlar (stock) ya da verilen miktar kadar artırır / azaltır (adjust). İkisinden yalnızca biri gönderilir. adjust eşzamanlı isteklerde güvenlidir (satır kilitlenir). Değişiklik, stok gönderimi açık olan kanallara kendiliğinden iletilir.\n\nGerekli izin: products:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Yeniden denemelerde aynı işlemin iki kez yapılmaması için 8-100 karakterlik benzersiz değer.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": {
                                        "id": "0199c3f2-0000-7000-8000-00000000b001",
                                        "sku": "GML-M",
                                        "title": "Keten gömlek — M",
                                        "kind": "physical",
                                        "image_url": "https://…/gomlek.jpg",
                                        "track_stock": true,
                                        "stock": 10,
                                        "low_stock_threshold": 3,
                                        "is_group": false,
                                        "is_archived": false,
                                        "weight_grams": 250,
                                        "tax_rate": 20,
                                        "listings": [
                                            {
                                                "id": "0199c3f2-0000-7000-8000-00000000d001",
                                                "shop": {
                                                    "id": "0199c3f2-0000-7000-8000-00000000a001",
                                                    "name": "Trendyol mağazam",
                                                    "platform": "trendyol"
                                                },
                                                "external_id": "8680001112223",
                                                "title": "Keten gömlek",
                                                "state": "active",
                                                "price": 15000,
                                                "currency": "TRY",
                                                "quantity": 12,
                                                "url": null
                                            }
                                        ],
                                        "created_at": "2026-09-01T09:00:00+03:00",
                                        "updated_at": "2026-10-10T10:00:00+03:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Hata",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "stock": {
                                        "type": "integer",
                                        "description": "Yeni stok adedi (0 ya da pozitif)."
                                    },
                                    "adjust": {
                                        "type": "integer",
                                        "description": "Değişim miktarı, ör. -2 ya da 10 (0 olamaz). Sonuç eksiye düşerse istek reddedilir."
                                    }
                                },
                                "required": []
                            },
                            "example": {
                                "adjust": -2
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "Ayarlar → API sayfasında oluşturulan anahtar (ifx_…)."
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "error"
                ],
                "properties": {
                    "error": {
                        "type": "object",
                        "required": [
                            "code",
                            "message"
                        ],
                        "properties": {
                            "code": {
                                "type": "string",
                                "enum": [
                                    "missing_token",
                                    "invalid_token",
                                    "token_revoked",
                                    "token_expired",
                                    "token_owner_inactive",
                                    "https_required",
                                    "ip_not_allowed",
                                    "insufficient_scope",
                                    "insufficient_role",
                                    "workspace_suspended",
                                    "plan_feature_missing",
                                    "order_limit_reached",
                                    "not_found",
                                    "method_not_allowed",
                                    "order_not_shippable",
                                    "order_exists",
                                    "order_in_progress",
                                    "status_managed_by_channel",
                                    "invalid_status_transition",
                                    "shop_not_syncable",
                                    "shop_disconnected",
                                    "sku_exists",
                                    "duplicate_tracking_number",
                                    "product_is_group",
                                    "idempotency_in_progress",
                                    "validation_failed",
                                    "invalid_idempotency_key",
                                    "idempotency_key_reused",
                                    "shipment_failed",
                                    "stock_would_be_negative",
                                    "no_custom_channel",
                                    "rate_limited",
                                    "too_many_failed_attempts",
                                    "sync_too_soon",
                                    "server_error"
                                ]
                            },
                            "message": {
                                "type": "string"
                            },
                            "details": {
                                "type": "object"
                            },
                            "request_id": {
                                "type": "string",
                                "format": "uuid"
                            }
                        }
                    }
                }
            }
        }
    }
}