Skip to content

Hepsiburada guide

@lonca/hepsiburada covers every operation documented on developers.hepsiburada.com — 12 resources / 95 methods / live-verified against SIT. The repo’s sdks/hepsiburada/README.md keeps the most up-to-date per-resource cheat sheet; this guide hits the highlights.

ResourceMethodsSource
listings18OpenAPI spec
shipping4OpenAPI spec
claims6OpenAPI spec
testOrders1 (SIT only)OpenAPI spec
orders28Dev-portal /operations API ★
categories3Dev-portal /operations API ★
catalog11Dev-portal /operations API ★
productUpdates3Dev-portal /operations API ★
suppliers5Dev-portal /operations API ★
accounting1Dev-portal /operations API ★
questions6Dev-portal /operations API ★
promotions9Dev-portal /operations API ★

★ — Hepsiburada publishes machine-readable OpenAPI for only 5 of its 20 dev-portal products. The other 7 API-bearing products are typed from a hidden /api/v1/public/docs/{co}/{slug}/{ver}/operations[/{opId}] endpoint that returns the same OpenAPI shape.

import { createHepsiburadaClient } from '@lonca/hepsiburada';
const client = createHepsiburadaClient({
merchantId: process.env.HB_MERCHANT_ID!,
username: process.env.HB_API_USER!,
password: process.env.HB_API_PASS!,
env: 'sit', // or 'prod'
integratorName: 'MyCompany',
});
const page = await client.listings.list({ offset: 0, limit: 100 });
for (const l of page.listings) {
console.log(l.hepsiburadaSku, l.merchantSku, l.availableStock, l.price);
}

Bulk price update (async upload + polling)

Section titled “Bulk price update (async upload + polling)”

Every upload endpoint is asynchronous — Hepsiburada returns { id } synchronously, you poll the matching get*Upload(id) to read the outcome.

const { id } = await client.listings.uploadPrice([
{ hepsiburadaSku: 'HB-1', price: 199.9 },
{ hepsiburadaSku: 'HB-2', price: 249.0 },
]);
let result;
do {
await new Promise((r) => setTimeout(r, 2000));
result = await client.listings.getPriceUpload(id);
} while (result.status === 'PROCESSING');
for (const v of result.priceValidations ?? []) {
console.warn(`${v.hepsiburadaSku}: ${v.type} ${v.minPrice}${v.maxPrice}`);
}

The same pattern applies to uploadInventory, uploadStock, uploadShippingInfo, uploadAdditionalInfo.

// 1. Find paid orders awaiting packaging
const open = await client.orders.list({ limit: 100 });
// 2. Package + transition status
await client.orders.createPackages({ lineItems: ['L1', 'L2'], cargoCompany: 'ARAS' });
await client.orders.markPackageInTransit('HBP-123', { trackingNumber: 'TR-456' });
await client.orders.markPackageDelivered('HBP-123');
// 3. Reconcile invoice attachment
const missingInvoice = await client.orders.listMissingInvoicePackages({ limit: 100 });
console.log(`${missingInvoice.totalCount} shipped packages still missing invoice`);
// status is a strict union: NewRequest | Accepted | AwaitingAction | InDispute
// | Rejected | Refunded | Cancelled | AwaitingPreApproval
const awaiting = await client.claims.listByStatus('AwaitingAction', { limit: 100 });
for (const claim of awaiting) {
await client.claims.accept(claim.claimNumber!, { reasonCode: 'APPROVED' });
}

Hepsiburada’s hosts disagree on merchantId path-segment casing — the SDK picks the casing each host actually serves so you don’t need to think about it:

HostLowercase /merchantid/CamelCase /merchantId/SDK uses
listing-external[-sit]✓ 200✗ 400lowercase
oms-external[-sit]✓ 200✓ 200camelCase
mpop[-sit] (catalog)n/a (query)camelCase
shipping-external[-sit]n/acamelCase

Hepsiburada’s webhook model is endpoint-per-event — Hepsiburada PUTs to <baseUrl>/<eventName> for each event. 8 order events + 4 claim events = 12 total.

import express from 'express';
import { parseHepsiburadaWebhookEvent, ORDER_WEBHOOK_EVENTS } from '@lonca/hepsiburada';
const app = express();
app.use(express.json());
for (const event of ORDER_WEBHOOK_EVENTS) {
app.put(`/hb/${event}`, (req, res) => {
const { body } = parseHepsiburadaWebhookEvent(event, req.body);
// process the event...
res.status(204).end();
});
}

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.