{
	"openapi": "3.0.3",
	"info": {
		"title": "FastEntegre API v2",
		"version": "2.0.0",
		"description": "Satıcı entegrasyon API’si (ERP/WMS). Bearer token: POST /oauth/token. Scope gönderilmezse veya users.apiTokenScopes boşsa token tüm KnownScopes’a sahiptir. expires_in döner fakat süre kesilmez; yeni token eskisini ezer. ApiController (Basic Auth, /api) deprecated’dir."
	},
	"servers": [
		{
			"url": "https://fastentegre.com",
			"description": "Production"
		}
	],
	"tags": [
		{"name": "Auth"},
		{"name": "Orders"},
		{"name": "Products"},
		{"name": "Stock"},
		{"name": "Invoices"},
		{"name": "Shipments"},
		{"name": "Stores"},
		{"name": "Customers"},
		{"name": "Docs"},
		{"name": "Extension"},
		{"name": "Questions", "description": "Pazaryeri müşteri soruları"}
	],
	"paths": {
		"/oauth/token": {
			"post": {
				"tags": ["Auth"],
				"summary": "Password grant — Bearer token",
				"security": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/x-www-form-urlencoded": {
							"schema": {"$ref": "#/components/schemas/TokenRequest"}
						},
						"application/json": {
							"schema": {"$ref": "#/components/schemas/TokenRequest"}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Token",
						"content": {
							"application/json": {
								"schema": {"$ref": "#/components/schemas/TokenResponse"}
							}
						}
					},
					"400": {
						"description": "OAuth error",
						"content": {
							"application/json": {
								"schema": {"$ref": "#/components/schemas/OAuthError"}
							}
						}
					}
				}
			}
		},
		"/apiV2/openapi.json": {
			"get": {
				"tags": ["Docs"],
				"summary": "OpenAPI 3 spec",
				"security": [],
				"responses": {
					"200": {
						"description": "OpenAPI JSON"
					}
				}
			}
		},
		"/apiV2/docs": {
			"get": {
				"tags": ["Docs"],
				"summary": "Swagger UI",
				"security": [],
				"responses": {
					"200": {
						"description": "HTML"
					}
				}
			}
		},
		"/apiV2/extension/platform-costs": {
			"get": {
				"tags": ["Extension"],
				"summary": "Chrome eklentisi pazaryeri maliyet tabloları",
				"description": "Public. Auth gerekmez. Cache-Control: public, max-age=3600. Geçersiz veya eksik belgede 404.",
				"security": [],
				"responses": {
					"200": {
						"description": "Maliyet belgesi",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"result": {"type": "string", "example": "success"},
										"content": {
											"type": "object",
											"required": ["version", "updatedAt", "platforms"],
											"properties": {
												"version": {"type": "integer"},
												"updatedAt": {"type": "string", "format": "date-time"},
												"platforms": {"type": "object"},
												"extensionSettings": {"type": "object"}
											}
										}
									}
								}
							}
						}
					},
					"404": {
						"description": "Belge yok veya doğrulanamadı"
					}
				}
			}
		},
		"/apiV2/order": {
			"get": {
				"tags": ["Orders"],
				"summary": "Sipariş listesi",
				"security": [{"oauth2": ["orders:read"], "bearer": ["orders:read"]}],
				"parameters": [
					{"$ref": "#/components/parameters/Page"},
					{"$ref": "#/components/parameters/OrderStatus"},
					{"$ref": "#/components/parameters/OrderStartDate"},
					{"$ref": "#/components/parameters/OrderEndDate"},
					{"$ref": "#/components/parameters/CreatedStartDate"},
					{"$ref": "#/components/parameters/CreatedEndDate"},
					{"$ref": "#/components/parameters/EditedStartDate"},
					{"$ref": "#/components/parameters/EditedEndDate"},
					{"$ref": "#/components/parameters/OrderBy"},
					{"$ref": "#/components/parameters/OrderByDesc"},
					{"$ref": "#/components/parameters/MainStoreId"}
				],
				"responses": {
					"200": {"$ref": "#/components/responses/ListSuccess"},
					"401": {"$ref": "#/components/responses/Unauthorized"},
					"403": {"$ref": "#/components/responses/InsufficientScope"}
				}
			}
		},
		"/apiV2/order/{id}": {
			"get": {
				"tags": ["Orders"],
				"summary": "Sipariş (orderId, platformShipmentCode veya diğer kimlik)",
				"security": [{"oauth2": ["orders:read"], "bearer": ["orders:read"]}],
				"parameters": [{"$ref": "#/components/parameters/IdPath"}],
				"responses": {
					"200": {"$ref": "#/components/responses/ItemSuccess"},
					"404": {"$ref": "#/components/responses/NotFound"},
					"403": {"$ref": "#/components/responses/InsufficientScope"}
				}
			}
		},
		"/apiV2/product": {
			"get": {
				"tags": ["Products"],
				"summary": "Ürün listesi",
				"security": [{"oauth2": ["products:read"], "bearer": ["products:read"]}],
				"parameters": [
					{"$ref": "#/components/parameters/Page"},
					{"$ref": "#/components/parameters/Sku"},
					{"$ref": "#/components/parameters/MainStoreId"},
					{"$ref": "#/components/parameters/CreatedStartDate"},
					{"$ref": "#/components/parameters/OrderBy"}
				],
				"responses": {
					"200": {"$ref": "#/components/responses/ListSuccess"},
					"403": {"$ref": "#/components/responses/InsufficientScope"}
				}
			}
		},
		"/apiV2/product/{id}": {
			"get": {
				"tags": ["Products"],
				"summary": "Ürün detay (productId)",
				"security": [{"oauth2": ["products:read"], "bearer": ["products:read"]}],
				"parameters": [{"$ref": "#/components/parameters/IdPath"}],
				"responses": {
					"200": {"$ref": "#/components/responses/ItemSuccess"},
					"404": {"$ref": "#/components/responses/NotFound"}
				}
			},
			"post": {
				"tags": ["Products"],
				"summary": "Toplu ürün oluştur (path id = mainStoreId)",
				"security": [{"oauth2": ["products:write"], "bearer": ["products:write"]}],
				"parameters": [{"$ref": "#/components/parameters/IdPath"}],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "array",
								"items": {"$ref": "#/components/schemas/ProductCreate"}
							}
						}
					}
				},
				"responses": {
					"200": {"$ref": "#/components/responses/ItemSuccess"},
					"403": {"$ref": "#/components/responses/InsufficientScope"}
				}
			}
		},
		"/apiV2/stock": {
			"get": {
				"tags": ["Stock"],
				"summary": "Satılabilir stok listesi (varyant/sanal ürün)",
				"security": [{"oauth2": ["stock:read"], "bearer": ["stock:read"]}],
				"parameters": [
					{"$ref": "#/components/parameters/Page"},
					{"$ref": "#/components/parameters/Sku"},
					{"name": "productId", "in": "query", "schema": {"type": "integer"}},
					{"name": "locationId", "in": "query", "schema": {"type": "integer"}},
					{"$ref": "#/components/parameters/MainStoreId"}
				],
				"responses": {
					"200": {"$ref": "#/components/responses/ListSuccess"},
					"403": {"$ref": "#/components/responses/InsufficientScope"}
				}
			}
		},
		"/apiV2/stock/{id}": {
			"get": {
				"tags": ["Stock"],
				"summary": "Tek ürün satılabilir stok",
				"security": [{"oauth2": ["stock:read"], "bearer": ["stock:read"]}],
				"parameters": [
					{"$ref": "#/components/parameters/IdPath"},
					{"name": "locationId", "in": "query", "schema": {"type": "integer"}}
				],
				"responses": {
					"200": {"$ref": "#/components/responses/ItemSuccess"},
					"404": {"$ref": "#/components/responses/NotFound"}
				}
			}
		},
		"/apiV2/updateStock": {
			"post": {
				"tags": ["Stock"],
				"summary": "Toplu stok (ve isteğe bağlı fiyat) güncelle",
				"security": [{"oauth2": ["stock:write"], "bearer": ["stock:write"]}],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {"$ref": "#/components/schemas/UpdateStockRequest"}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Güncelleme özeti",
						"content": {
							"application/json": {
								"schema": {"$ref": "#/components/schemas/UpdateStockResponse"}
							}
						}
					},
					"403": {"$ref": "#/components/responses/InsufficientScope"}
				}
			}
		},
		"/apiV2/invoice": {
			"get": {
				"tags": ["Invoices"],
				"summary": "Fatura listesi",
				"security": [{"oauth2": ["orders:invoice"], "bearer": ["orders:invoice"]}],
				"parameters": [{"$ref": "#/components/parameters/Page"}, {"$ref": "#/components/parameters/CreatedStartDate"}],
				"responses": {"200": {"$ref": "#/components/responses/ListSuccess"}}
			}
		},
		"/apiV2/invoice/{id}": {
			"get": {
				"tags": ["Invoices"],
				"summary": "Fatura detay",
				"security": [{"oauth2": ["orders:invoice"], "bearer": ["orders:invoice"]}],
				"parameters": [{"$ref": "#/components/parameters/IdPath"}],
				"responses": {"200": {"$ref": "#/components/responses/ItemSuccess"}, "404": {"$ref": "#/components/responses/NotFound"}}
			}
		},
		"/apiV2/shipment": {
			"get": {
				"tags": ["Shipments"],
				"summary": "Kargo listesi",
				"security": [{"oauth2": ["orders:shipment"], "bearer": ["orders:shipment"]}],
				"parameters": [{"$ref": "#/components/parameters/Page"}],
				"responses": {"200": {"$ref": "#/components/responses/ListSuccess"}}
			}
		},
		"/apiV2/shipment/{id}": {
			"get": {
				"tags": ["Shipments"],
				"summary": "Kargo detay",
				"security": [{"oauth2": ["orders:shipment"], "bearer": ["orders:shipment"]}],
				"parameters": [{"$ref": "#/components/parameters/IdPath"}],
				"responses": {"200": {"$ref": "#/components/responses/ItemSuccess"}, "404": {"$ref": "#/components/responses/NotFound"}}
			}
		},
		"/apiV2/sendShipment/{platformShipmentCode}": {
			"post": {
				"tags": ["Shipments"],
				"summary": "Kargo gönderimini tetikle",
				"security": [{"oauth2": ["orders:shipment"], "bearer": ["orders:shipment"]}],
				"parameters": [{"name": "platformShipmentCode", "in": "path", "required": true, "schema": {"type": "string"}}],
				"responses": {
					"200": {"$ref": "#/components/responses/ActionSuccess"},
					"405": {"$ref": "#/components/responses/MethodNotAllowed"}
				}
			}
		},
		"/apiV2/sendInvoice/{platformShipmentCode}": {
			"post": {
				"tags": ["Invoices"],
				"summary": "e-Fatura gönderimini tetikle",
				"security": [{"oauth2": ["orders:invoice"], "bearer": ["orders:invoice"]}],
				"parameters": [{"name": "platformShipmentCode", "in": "path", "required": true, "schema": {"type": "string"}}],
				"responses": {"200": {"$ref": "#/components/responses/ActionSuccess"}}
			}
		},
		"/apiV2/productAcceptance": {
			"get": {
				"tags": ["Stock"],
				"summary": "Mal kabul listesi",
				"security": [{"oauth2": ["stock:read"], "bearer": ["stock:read"]}],
				"parameters": [{"$ref": "#/components/parameters/Page"}],
				"responses": {"200": {"$ref": "#/components/responses/ListSuccess"}}
			}
		},
		"/apiV2/productAcceptance/{id}": {
			"get": {
				"tags": ["Stock"],
				"summary": "Mal kabul detay",
				"security": [{"oauth2": ["stock:read"], "bearer": ["stock:read"]}],
				"parameters": [{"$ref": "#/components/parameters/IdPath"}],
				"responses": {"200": {"$ref": "#/components/responses/ItemSuccess"}, "404": {"$ref": "#/components/responses/NotFound"}}
			}
		},
		"/apiV2/mainStore": {
			"get": {
				"tags": ["Stores"],
				"summary": "Ana mağaza listesi",
				"security": [{"oauth2": ["stores:read"], "bearer": ["stores:read"]}],
				"parameters": [{"$ref": "#/components/parameters/Page"}],
				"responses": {"200": {"$ref": "#/components/responses/ListSuccess"}}
			},
			"post": {
				"tags": ["Stores"],
				"summary": "Satıcı için ana mağaza aç (yalnızca partner hesabı)",
				"description": "Idempotent: aynı mainStoreName mevcut kaydı existing=true ile döner.",
				"security": [{"oauth2": ["stores:write"], "bearer": ["stores:write"]}],
				"requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MainStoreCreate"}}}},
				"responses": {
					"200": {"description": "Mevcut ana mağaza (existing=true)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MainStoreCreateEnvelope"}}}},
					"201": {"description": "Oluşturuldu", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MainStoreCreateEnvelope"}}}},
					"403": {"$ref": "#/components/responses/PartnerOnly"},
					"422": {"$ref": "#/components/responses/InvalidRequest"}
				}
			}
		},
		"/apiV2/mainStore/{id}": {
			"get": {
				"tags": ["Stores"],
				"summary": "Ana mağaza detay",
				"security": [{"oauth2": ["stores:read"], "bearer": ["stores:read"]}],
				"parameters": [{"$ref": "#/components/parameters/IdPath"}],
				"responses": {"200": {"$ref": "#/components/responses/ItemSuccess"}}
			}
		},
		"/apiV2/store": {
			"get": {
				"tags": ["Stores"],
				"summary": "Mağaza listesi",
				"description": "Her kayıtta status: active / pending_oauth / inactive. Partner için pending_oauth kayıtlarında authorizeUrl.",
				"security": [{"oauth2": ["stores:read"], "bearer": ["stores:read"]}],
				"parameters": [{"$ref": "#/components/parameters/Page"}, {"$ref": "#/components/parameters/MainStoreId"}],
				"responses": {"200": {"$ref": "#/components/responses/ListSuccess"}}
			},
			"post": {
				"tags": ["Stores"],
				"summary": "Ana mağazaya pazaryeri entegrasyonu ekle (yalnızca partner hesabı)",
				"description": "storeId yoksa her çağrı yeni mağaza açar; bir ana mağazada aynı pazaryerinden birden fazla hesap olabilir. Aynı hesap (ör. aynı Trendyol sellerId) ikinci kez gönderilirse 409 duplicate_store. storeId verilirse o mağazanın bilgileri güncellenir. Bağlantı API ile doğrulanır; başarısızsa yeni kayıt oluşturulmaz (422). İdeasoft: status=pending_oauth ve authorizeUrl döner.",
				"security": [{"oauth2": ["stores:write"], "bearer": ["stores:write"]}],
				"requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/StoreCreate"}}}},
				"responses": {
					"200": {"description": "Mağaza güncellendi (storeId gönderildi)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/StoreCreateEnvelope"}}}},
					"201": {"description": "Oluşturuldu", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/StoreCreateEnvelope"}}}},
					"403": {"$ref": "#/components/responses/PartnerOnly"},
					"404": {"$ref": "#/components/responses/NotFound"},
					"409": {"description": "Aynı pazaryeri hesabı zaten bağlı (duplicate_store)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}},
					"422": {"$ref": "#/components/responses/InvalidRequest"}
				}
			}
		},
		"/apiV2/store/{id}": {
			"get": {
				"tags": ["Stores"],
				"summary": "Mağaza detay",
				"security": [{"oauth2": ["stores:read"], "bearer": ["stores:read"]}],
				"parameters": [{"$ref": "#/components/parameters/IdPath"}],
				"responses": {"200": {"$ref": "#/components/responses/ItemSuccess"}}
			}
		},
		"/apiV2/customer": {
			"get": {
				"tags": ["Customers"],
				"summary": "Müşteri listesi",
				"security": [{"oauth2": ["customers:read"], "bearer": ["customers:read"]}],
				"parameters": [{"$ref": "#/components/parameters/Page"}],
				"responses": {"200": {"$ref": "#/components/responses/ListSuccess"}}
			},
			"post": {
				"tags": ["Customers"],
				"summary": "Müşteri oluştur",
				"security": [{"oauth2": ["customers:write"], "bearer": ["customers:write"]}],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {"$ref": "#/components/schemas/StakeholderCreate"}
						}
					}
				},
				"responses": {"200": {"$ref": "#/components/responses/ItemSuccess"}}
			}
		},
		"/apiV2/customer/{id}": {
			"get": {
				"tags": ["Customers"],
				"summary": "Müşteri detay",
				"security": [{"oauth2": ["customers:read"], "bearer": ["customers:read"]}],
				"parameters": [{"$ref": "#/components/parameters/IdPath"}],
				"responses": {"200": {"$ref": "#/components/responses/ItemSuccess"}, "404": {"$ref": "#/components/responses/NotFound"}}
			}
		},
		"/apiV2/supplier": {
			"get": {
				"tags": ["Customers"],
				"summary": "Tedarikçi listesi",
				"security": [{"oauth2": ["customers:read"], "bearer": ["customers:read"]}],
				"parameters": [{"$ref": "#/components/parameters/Page"}],
				"responses": {"200": {"$ref": "#/components/responses/ListSuccess"}}
			},
			"post": {
				"tags": ["Customers"],
				"summary": "Tedarikçi oluştur",
				"security": [{"oauth2": ["customers:write"], "bearer": ["customers:write"]}],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {"$ref": "#/components/schemas/StakeholderCreate"}
						}
					}
				},
				"responses": {"200": {"$ref": "#/components/responses/ItemSuccess"}}
			}
		},
		"/apiV2/getProductByStoreProductCode/{code}/{mainStoreId}": {
			"get": {
				"tags": ["Products"],
				"summary": "Mağaza ürün kodu ile ürün",
				"security": [{"oauth2": ["products:read"], "bearer": ["products:read"]}],
				"parameters": [
					{"name": "code", "in": "path", "required": true, "schema": {"type": "string"}},
					{"name": "mainStoreId", "in": "path", "required": true, "schema": {"type": "integer"}}
				],
				"responses": {"200": {"$ref": "#/components/responses/ItemSuccess"}, "404": {"$ref": "#/components/responses/NotFound"}}
			}
		},
		"/apiV2/question": {
			"get": {
				"tags": ["Questions"],
				"summary": "Pazaryeri müşteri soruları (sayfalı)",
				"description": "Partner token: sahibi olunan tüm ana mağazaların soruları. Satıcı token: token ana mağazasındaki yetkili mağazaların soruları. Periyodik çekim: 5 dakikada bir createdStartDate = şimdi - 30 dk; kayıtlar questionId ile upsert edilmeli.",
				"security": [{"oauth2": ["questions:read"], "bearer": ["questions:read"]}],
				"parameters": [
					{"$ref": "#/components/parameters/Page"},
					{"name": "pageSize", "in": "query", "schema": {"type": "integer", "default": 50, "maximum": 200}},
					{"name": "storeId", "in": "query", "description": "Virgülle çoklu", "schema": {"type": "string"}},
					{"name": "mainStoreId", "in": "query", "description": "Virgülle çoklu", "schema": {"type": "string"}},
					{"name": "platformId", "in": "query", "description": "Virgülle çoklu", "schema": {"type": "string"}},
					{"name": "questionStatus", "in": "query", "description": "New, Answered, Reported, Rejected (virgülle çoklu)", "schema": {"type": "string"}},
					{"name": "isArchived", "in": "query", "schema": {"type": "integer", "enum": [0, 1]}},
					{"name": "createdStartDate", "in": "query", "description": "Sorunun FastEntegre'ye geliş zamanı (created) >=; periyodik çekim için önerilen", "schema": {"type": "string", "example": "2026-10-28 10:00:00"}},
					{"name": "createdEndDate", "in": "query", "description": "created <", "schema": {"type": "string"}},
					{"name": "questionStartDate", "in": "query", "description": "Sorunun pazaryerindeki tarihi (creationDate) >=", "schema": {"type": "string"}},
					{"name": "questionEndDate", "in": "query", "description": "creationDate <", "schema": {"type": "string"}},
					{"name": "editedStartDate", "in": "query", "description": "Son güncelleme (edited) >=", "schema": {"type": "string"}},
					{"name": "editedEndDate", "in": "query", "description": "edited <", "schema": {"type": "string"}},
					{"name": "answerStartDate", "in": "query", "description": "answerDate >=", "schema": {"type": "string"}},
					{"name": "answerEndDate", "in": "query", "description": "answerDate <", "schema": {"type": "string"}},
					{"name": "sort", "in": "query", "schema": {"type": "string", "enum": ["edited", "created", "creationDate", "answerDate", "questionId"], "default": "edited"}},
					{"name": "direction", "in": "query", "schema": {"type": "string", "enum": ["ASC", "DESC"], "default": "ASC"}}
				],
				"responses": {
					"200": {"description": "Soru listesi", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/QuestionListEnvelope"}}}},
					"403": {"$ref": "#/components/responses/InsufficientScope"},
					"422": {"$ref": "#/components/responses/InvalidRequest"}
				}
			}
		},
		"/apiV2/question/{id}": {
			"get": {
				"tags": ["Questions"],
				"summary": "Soru detay (FastEntegre questionId)",
				"security": [{"oauth2": ["questions:read"], "bearer": ["questions:read"]}],
				"parameters": [{"$ref": "#/components/parameters/IdPath"}],
				"responses": {
					"200": {"description": "Soru", "content": {"application/json": {"schema": {"type": "object", "properties": {"result": {"type": "string"}, "content": {"$ref": "#/components/schemas/Question"}}}}}},
					"404": {"$ref": "#/components/responses/NotFound"}
				}
			}
		},
		"/apiV2/answerQuestion/{id}": {
			"post": {
				"tags": ["Questions"],
				"summary": "Soruyu cevapla (düz metin veya dosyalı)",
				"description": "Düz cevap: application/json. Dosyalı cevap: multipart/form-data (answerText + file); yalnızca supportsAnswerMedia=true olan sorularda (Hepsiburada).",
				"security": [{"oauth2": ["questions:write"], "bearer": ["questions:write"]}],
				"parameters": [{"$ref": "#/components/parameters/IdPath"}],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {"schema": {"$ref": "#/components/schemas/AnswerRequest"}},
						"multipart/form-data": {"schema": {"type": "object", "required": ["answerText"], "properties": {"answerText": {"type": "string", "maxLength": 4000}, "file": {"type": "string", "format": "binary", "description": "Tek görsel (jpeg/png/gif/webp, en fazla 10 MB)"}}}}
					}
				},
				"responses": {
					"200": {"description": "Cevap platforma iletildi", "content": {"application/json": {"schema": {"type": "object", "properties": {"result": {"type": "string"}, "content": {"type": "object", "properties": {"questionId": {"type": "integer"}, "questionStatus": {"type": "string"}, "answerText": {"type": "string"}, "answerDate": {"type": "string", "nullable": true}}}}}}}},
					"404": {"$ref": "#/components/responses/NotFound"},
					"409": {"description": "Soru cevaplanabilir durumda değil (already_answered)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}},
					"422": {"$ref": "#/components/responses/InvalidRequest"},
					"502": {"description": "Platform cevabı reddetti (platform_error)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}
				}
			}
		}
	},
	"components": {
		"securitySchemes": {
			"bearer": {
				"type": "http",
				"scheme": "bearer",
				"bearerFormat": "hex",
				"description": "Authorization: Bearer <access_token>"
			},
			"oauth2": {
				"type": "oauth2",
				"flows": {
					"password": {
						"tokenUrl": "/oauth/token",
						"scopes": {
							"orders:read": "Sipariş okuma",
							"orders:invoice": "Fatura okuma ve gönderme",
							"orders:shipment": "Kargo okuma ve gönderme",
							"products:read": "Ürün okuma",
							"products:write": "Ürün oluşturma",
							"stock:read": "Stok / mal kabul okuma",
							"stock:write": "Stok güncelleme (fiyat alanları dahil)",
							"customers:read": "Müşteri / tedarikçi okuma",
							"customers:write": "Müşteri / tedarikçi oluşturma",
							"stores:read": "Ana mağaza / mağaza okuma",
							"stores:write": "Ana mağaza / mağaza oluşturma (partner)",
							"questions:read": "Müşteri soruları okuma",
							"questions:write": "Müşteri sorularını cevaplama"
						}
					}
				}
			}
		},
		"parameters": {
			"Page": {"name": "page", "in": "query", "schema": {"type": "integer", "default": 1}},
			"IdPath": {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}},
			"Sku": {"name": "sku", "in": "query", "schema": {"type": "string"}},
			"MainStoreId": {"name": "mainStoreId", "in": "query", "schema": {"type": "integer"}},
			"OrderStatus": {"name": "orderStatus", "in": "query", "schema": {"type": "integer"}},
			"OrderStartDate": {"name": "orderStartDate", "in": "query", "schema": {"type": "string"}},
			"OrderEndDate": {"name": "orderEndDate", "in": "query", "schema": {"type": "string"}},
			"CreatedStartDate": {"name": "createdStartDate", "in": "query", "schema": {"type": "string"}},
			"CreatedEndDate": {"name": "createdEndDate", "in": "query", "schema": {"type": "string"}},
			"EditedStartDate": {"name": "editedStartDate", "in": "query", "schema": {"type": "string"}},
			"EditedEndDate": {"name": "editedEndDate", "in": "query", "schema": {"type": "string"}},
			"OrderBy": {"name": "orderBy", "in": "query", "schema": {"type": "string"}},
			"OrderByDesc": {"name": "orderByDesc", "in": "query", "schema": {"type": "string"}}
		},
		"schemas": {
			"TokenRequest": {
				"type": "object",
				"required": ["username", "password"],
				"properties": {
					"username": {"type": "string"},
					"password": {"type": "string", "format": "password"},
					"scope": {"type": "string", "description": "Boşlukla ayrılmış KnownScopes. Yoksa tüm scope’lar (unrestricted)."}
				}
			},
			"TokenResponse": {
				"type": "object",
				"properties": {
					"access_token": {"type": "string"},
					"token_type": {"type": "string", "example": "Bearer"},
					"expires_in": {"type": "integer", "example": 3600, "description": "Dönülür; sunucu expiry uygulamaz."},
					"scope": {"type": "string"}
				}
			},
			"OAuthError": {
				"type": "object",
				"properties": {
					"error": {"type": "string"},
					"error_description": {"type": "string"}
				}
			},
			"ListEnvelope": {
				"type": "object",
				"properties": {
					"result": {"type": "string", "example": "success"},
					"content": {"type": "array", "items": {"type": "object", "additionalProperties": true}},
					"page": {"type": "integer"},
					"pageSize": {"type": "integer", "example": 50},
					"hasMore": {"type": "boolean"}
				}
			},
			"ItemEnvelope": {
				"type": "object",
				"properties": {
					"result": {"type": "string", "example": "success"},
					"content": {"type": "object", "additionalProperties": true}
				}
			},
			"ErrorEnvelope": {
				"type": "object",
				"properties": {
					"result": {"type": "string", "example": "danger"},
					"error": {"type": "string"},
					"message": {"type": "string"}
				}
			},
			"InsufficientScope": {
				"type": "object",
				"properties": {
					"error": {"type": "string", "example": "insufficient_scope"},
					"error_description": {"type": "string", "example": "orders:read"}
				}
			},
			"UpdateStockRequest": {
				"type": "object",
				"required": ["items"],
				"properties": {
					"items": {
						"type": "array",
						"items": {
							"type": "object",
							"required": ["quantity"],
							"properties": {
								"productId": {"type": "integer"},
								"sku": {"type": "string"},
								"quantity": {"type": "number"},
								"locationId": {"type": "integer"},
								"salePrice": {"type": "number", "description": "Perakende satış fiyatı (KDV dahil)"},
								"wholesalePrice": {"type": "number", "description": "Toptan satış fiyatı (KDV hariç)"},
								"costPrice": {"type": "number", "description": "Maliyet fiyatı (KDV hariç)"},
								"vatRate": {"type": "number", "description": "Satış KDV oranı (%)"},
								"purchaseVatRate": {"type": ["number", "null"], "description": "Alış KDV oranı (%); boşsa satış KDV oranı ile aynı"}
							}
						}
					}
				}
			},
			"UpdateStockResponse": {
				"type": "object",
				"properties": {
					"result": {"type": "string", "example": "success"},
					"updated": {"type": "integer"},
					"errorProducts": {"type": "array", "items": {"type": "object"}}
				}
			},
			"ProductCreate": {
				"type": "object",
				"additionalProperties": true,
				"properties": {
					"productName": {"type": "string"},
					"productSku": {"type": "string"},
					"variants": {"type": "array", "items": {"type": "object", "additionalProperties": true}}
				}
			},
			"StakeholderCreate": {
				"type": "object",
				"required": ["name", "address", "taxHouse", "taxId"],
				"properties": {
					"name": {"type": "string"},
					"address": {"type": "string"},
					"taxHouse": {"type": "string"},
					"taxId": {"type": "string"},
					"phone": {"type": "string"},
					"email": {"type": "string"},
					"country": {"type": "string", "example": "TR"}
				}
			},
			"Question": {
				"type": "object",
				"properties": {
					"questionId": {"type": "integer", "description": "FastEntegre soru ID (cevaplamada kullanılır)"},
					"storeId": {"type": "integer"},
					"mainStoreId": {"type": "integer", "nullable": true},
					"platformId": {"type": "integer", "nullable": true},
					"platformName": {"type": "string"},
					"platformQuestionId": {"type": "string"},
					"questionStatus": {"type": "string", "enum": ["New", "Answered", "Reported", "Rejected"]},
					"questionText": {"type": "string"},
					"customerName": {"type": "string", "nullable": true},
					"isPublic": {"type": "boolean", "nullable": true},
					"isArchived": {"type": "boolean"},
					"answerText": {"type": "string", "nullable": true},
					"creationDate": {"type": "string", "nullable": true, "description": "Pazaryerindeki soru tarihi"},
					"created": {"type": "string", "description": "FastEntegre'ye geliş zamanı"},
					"answerDate": {"type": "string", "nullable": true},
					"edited": {"type": "string", "description": "Son güncelleme"},
					"canAnswer": {"type": "boolean"},
					"supportsAnswerMedia": {"type": "boolean"},
					"product": {
						"type": "object",
						"properties": {
							"productId": {"type": "integer", "nullable": true},
							"name": {"type": "string", "nullable": true},
							"url": {"type": "string", "nullable": true},
							"imageUrl": {"type": "string", "nullable": true}
						}
					}
				}
			},
			"QuestionListEnvelope": {
				"type": "object",
				"properties": {
					"result": {"type": "string", "example": "success"},
					"content": {"type": "array", "items": {"$ref": "#/components/schemas/Question"}},
					"page": {"type": "integer"},
					"pageSize": {"type": "integer"},
					"hasMore": {"type": "boolean"}
				}
			},
			"AnswerRequest": {
				"type": "object",
				"required": ["answerText"],
				"properties": {"answerText": {"type": "string", "maxLength": 4000}}
			},
			"MainStoreCreate": {
				"type": "object",
				"required": ["mainStoreName"],
				"properties": {
					"mainStoreName": {"type": "string", "description": "Partner altında benzersiz; idempotency anahtarı"},
					"companyName": {"type": "string", "description": "Boşsa mainStoreName"},
					"senderVkn": {"type": "string", "description": "VKN (10) / TCKN (11)"},
					"taxHouse": {"type": "string"},
					"phone": {"type": "string", "example": "+905321234567"},
					"email": {"type": "string"},
					"addressCityId": {"type": "string"},
					"addressDistrictId": {"type": "string"},
					"addressDetail": {"type": "string"}
				}
			},
			"MainStoreCreateEnvelope": {
				"type": "object",
				"properties": {
					"result": {"type": "string"},
					"content": {
						"type": "object",
						"properties": {
							"mainStoreId": {"type": "integer"},
							"mainStoreName": {"type": "string"},
							"plan": {"type": "string", "nullable": true},
							"storeIds": {"type": "array", "items": {"type": "integer"}},
							"existing": {"type": "boolean"}
						}
					}
				}
			},
			"StoreCreate": {
				"type": "object",
				"required": ["mainStoreId", "platform", "credentials"],
				"properties": {
					"mainStoreId": {"type": "integer"},
					"platform": {"type": "string", "description": "Platform adı veya ID: Trendyol (12), N11 (11), HepsiBurada (13), CicekSepeti (14), Pazarama (26), Beymen (28), Idefix (29), Ideasoft (121)"},
					"storeName": {"type": "string"},
					"storeId": {"type": "integer", "description": "Verilirse bu mağazanın bilgileri güncellenir (ör. API anahtarı yenilendiğinde)"},
					"credentials": {
						"type": "object",
						"description": "Trendyol: sellerId, apiKey, apiSecret · N11: apiKey, apiSecret · HepsiBurada: merchantId, serviceKey · CicekSepeti: apiKey · Beymen: apiKey, apiPassword · Idefix: vendorId, apiKey, apiSecret · Pazarama: sellerId, apiKey, apiSecret · Ideasoft: storeUrl, clientId, clientSecret",
						"additionalProperties": {"type": "string"}
					}
				}
			},
			"StoreCreateEnvelope": {
				"type": "object",
				"properties": {
					"result": {"type": "string"},
					"content": {
						"type": "object",
						"properties": {
							"storeId": {"type": "integer"},
							"integrationId": {"type": "integer"},
							"mainStoreId": {"type": "integer"},
							"platformId": {"type": "integer"},
							"platformName": {"type": "string"},
							"storeName": {"type": "string"},
							"status": {"type": "string", "enum": ["active", "pending_oauth", "inactive"]},
							"questionsSupported": {"type": "boolean"},
							"created": {"type": "boolean"},
							"authorizeUrl": {"type": "string", "description": "Yalnızca pending_oauth: satıcının açacağı link"},
							"healthMessage": {"type": "string"}
						}
					}
				}
			}
		},
		"responses": {
			"ListSuccess": {
				"description": "Sayfalı liste",
				"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ListEnvelope"}}}
			},
			"ItemSuccess": {
				"description": "Tek kayıt",
				"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ItemEnvelope"}}}
			},
			"ActionSuccess": {
				"description": "İşlem sonucu",
				"content": {"application/json": {"schema": {"type": "object", "additionalProperties": true}}}
			},
			"Unauthorized": {
				"description": "Geçersiz token",
				"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}
			},
			"NotFound": {
				"description": "Bulunamadı",
				"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}
			},
			"MethodNotAllowed": {
				"description": "Yalnızca POST",
				"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}
			},
			"InsufficientScope": {
				"description": "Token scope yetersiz",
				"content": {"application/json": {"schema": {"$ref": "#/components/schemas/InsufficientScope"}}}
			},
			"InvalidRequest": {
				"description": "Geçersiz istek veya doğrulama hatası",
				"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}
			},
			"PartnerOnly": {
				"description": "Yalnızca partner hesapları (partner_only)",
				"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}
			}
		}
	}
}
