n11 guide
@lonca/n11 covers the n11 seller API as n11 documents it on developer.n11.com: the REST services (products, price/stock, orders) and the SOAP services n11 still runs for questions, returns, partial cancels, invoice links, catalogue search, settlements and address lookups. You never write XML: SOAP calls go through the same typed client, errors and retries as REST.
Resources at a glance
Section titled “Resources at a glance”| Resource | Methods | Transport | Verified |
|---|---|---|---|
products |
6 | REST | Live (reads) + test store (create / update / delete / tasks) |
inventory |
2 | REST | Test store |
orders |
8 | REST, SOAP | Live (list); test orders (writes) |
categories |
2 | REST | Live |
catalog |
1 | SOAP | Test store |
questions |
3 | SOAP | Live (reads) + test store (answer) |
claims |
8 | SOAP | Live (reads); test order (return decisions) |
shipping |
1 | SOAP | Live |
finance |
2 | SOAP | Test store |
locations |
4 | SOAP | Test store |
Quick start
Section titled “Quick start”import { createN11Client } from '@lonca/n11';
const client = createN11Client({ appKey: process.env.N11_APP_KEY!, appSecret: process.env.N11_APP_SECRET!, env: 'prod', // n11 has no public sandbox integratorName: 'MyCompany',});
const page = await client.products.list({ saleStatus: 'On_Sale', limit: 100 });for (const p of page.items) { console.log(p.stockCode, p.quantity, p.salePrice);}Keys come from n11 Seller Office (so.n11.com). integratorName is your company name: n11 needs no registration but logs product writes by it, so send the same value every time, down to letter case and I/ı.
n11 has no sandbox. For integration tests, ask n11 seller-integration support for a test store: it lives on production, and test orders there are real (low-priced) orders.
Price and stock (async tasks)
Section titled “Price and stock (async tasks)”Every product write is an asynchronous task. inventory.updateAndWait splits the list into tasks of 1000, submits them one after another and waits for each:
const results = await client.inventory.updateAndWait([ { stockCode: 'SKU-1', quantity: 12 }, // stock only { stockCode: 'SKU-2', salePrice: 149.9, listPrice: 199 }, // price pair]);for (const task of results) { for (const item of task.items.filter((i) => i.status === 'FAIL')) { console.warn(item.stockCode, item.reasons); }}The SDK rejects before sending what n11 would fail anyway: a lone salePrice or listPrice, more than 2 decimals, listPrice below salePrice, more than 1000 items per task.
Creating products
Section titled “Creating products”const attrs = await client.categories.getAttributes('1001012');// attribute 1 is the brand ("Marka"); every isMandatory attribute is required
const task = await client.products.create([ { stockCode: 'SKU-NEW-1', title: 'Örnek Defter', description: '<p>…</p>', categoryId: '1001012', productMainId: 'MODEL-1', preparingDay: 3, shipmentTemplate: 'Standart', // a template name from Seller Office quantity: 10, salePrice: 149.9, listPrice: 149.9, vatRate: 20, images: [{ url: 'https://cdn.example.com/defter.jpg', order: 1 }], attributes: [{ id: 1, valueId: '2306398' }], },]);
// Create tasks can take from seconds to ~15 minutes.const result = await client.products.waitForTask(task.taskId, { timeoutMs: 20 * 60_000 });To list against an existing n11 catalogue product, look it up first and pass its catalogId or barcode:
const { items } = await client.catalog.search({ barcodes: ['8690000000001'] });Orders
Section titled “Orders”import { paginate } from '@lonca/core';import { normalizeStatus } from '@lonca/n11';
for await (const pkg of paginate((p) => client.orders.list({ ...p, status: 'Created' }))) { console.log(pkg.orderNumber, normalizeStatus(pkg.status).normalized); const results = await client.orders.approve(pkg.lines.map((l) => l.lineId)); // per-line results; a line id n11 does not know is left out, so compare with what you sent}orders.list takes a Date or epoch ms for startDate / endDate (n11 clamps the window to 15 days). Set orderByField: true to filter by last update instead of creation.
Other order operations: splitPackage, splitPackageByQuantity (n11 enables it per store on request), createCollectionRequest (Horoz / Ceva / Borusan pick-up), updateLaborCosts (jewellery), cancelItem (partial cancel of an approved line) and sendInvoiceLink.
Cargo labels
Section titled “Cargo labels”n11 has no label service: you cannot download a PDF or ZPL label over the API (n11, 2026-10-14: not planned for now). The label is the package’s campaign code, pkg.cargoTrackingNumber, printed as a CODE-128 barcode. Render it with any barcode library, or print the label from Seller Office.
Questions and returns
Section titled “Questions and returns”const open = await client.questions.list({ status: 'OPEN', startDate: new Date(Date.now() - 7 * 86_400_000), endDate: new Date(),});for (const q of open.items) { await client.questions.answer(q.id, 'Merhaba, ürün yarın kargoda.');}
const reasons = await client.claims.getReturnDenyReasons();await client.claims.denyReturn({ claimReturnId: '27000001', denyReasonId: reasons[0]!.id, note: 'Ürün kullanılmış olarak ulaştı.',});questions.list is limited by n11 to one call per minute; the client enforces it.
Settlements
Section titled “Settlements”n11 keeps finance on SOAP (SettlementService). finance.listSettlements lists settlement days in a window; finance.getSettlementDetail opens one day: its totals, the order lines behind it (commission rate, ad and service fees, seller discounts, deferments) and the deferred amounts.
const days = await client.finance.listSettlements({ startDate: new Date(Date.now() - 30 * 86_400_000), endDate: new Date(),});for (const day of days.items) { console.log(day.settlementDate, day.status, day.settlementAmount);}
for await (const line of paginate((p) => client.finance.getSettlementDetail('2026-10-01', p))) { console.log(line.orderNumber, line.lineId, line.commissionRate, line.settlementAmount);}Dates are YYYY-MM-DD here, unlike the DD/MM/YYYY of the other SOAP services; pass a Date and the SDK sends its Turkish calendar day. Both calls page by limit, at most 100. commissionRate is a percentage, not an amount.
Cities, districts and neighborhoods
Section titled “Cities, districts and neighborhoods”locations reads n11’s address data (SOAP CityService). Districts are looked up by the city’s plate code (code), not by n11’s id:
const cities = await client.locations.getCities(); // the 81 Turkish citiesconst istanbul = cities.find((c) => c.code === '34')!;const districts = await client.locations.getDistricts(istanbul.code);const neighborhoods = await client.locations.getNeighborhoods(districts[0]!.id);An unknown plate code or district id answers with an empty list; getCity throws ValidationError for an unknown code.
Errors and limits
Section titled “Errors and limits”Errors are the shared @lonca/core classes. n11 reports many client mistakes with HTTP 500 (TASK_ERR_* on product tasks, Java exception names on queries) or HTTP 200 (SOAP result.status: failure); the SDK maps them to ValidationError, NotFoundError or AuthError so they are not retried as server errors.
n11 sends no 429. Clients that fire requests milliseconds apart get their IP suspended, so keep bulk work sequential (as updateAndWait does) or inject a TokenBucketRateLimiter into a resource. Product creation is capped at 10,000 products per hour per store.
Testing
Section titled “Testing”import { createFakeN11Client } from '@lonca/n11/testing';
const client = createFakeN11Client({ handler: (req) => req.path === '/ms/product-query' ? { content: [{ n11ProductId: 1, stockCode: 'SKU-1', title: 'Örnek' }] } : undefined,});The fake runs the real client over an in-memory fetch: REST handlers return JSON, SOAP handlers (matched by req.soapOperation) return the inner XML of the response.
Unofficial. Lonca is an independent, community-maintained project — not affiliated with, endorsed by, or supported by Trendyol, Hepsiburada, or any other marketplace. All marketplace names and trademarks belong to their respective owners.