> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nekt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mabang ERP as a data source

> Bring your Mabang ERP orders, order items, return orders, products, stock per warehouse, warehouses, shops and logistics channels to Nekt.

Mabang ERP (马帮ERP) is an ERP for cross-border e-commerce sellers that centralizes orders, products, stock and shipping across marketplaces such as Amazon, Shopee, TikTok Shop, AliExpress and Mercado Livre. This connector reads your company's data through the Mabang Open Platform API and brings your sales orders with their items, return orders, stock SKUs (products), the stock of each SKU in each warehouse, and your warehouses, shops and logistics channels.

> [!NOTE]
>
> The connector only reads data. It never creates, changes or deletes anything in Mabang.

## Configuring Mabang ERP as a Source

In the [Sources](https://app.nekt.ai/sources) tab, click on the "Add source" button located on the top right of your screen. Then, select the Mabang ERP option from the list of connectors.

Click **Next** and you'll be prompted to add your access.

### 1. Add account access

The connector signs in with your company's **AppKey** and **App secret** from the Mabang Open Platform. Someone with the company's **main** Mabang account gets them:

**1. Open the Mabang Open Platform**

Go to [gwapi.mabangerp.com/web](https://gwapi.mabangerp.com/web), log in with the company's main Mabang account and open the **Control Center** (控制中台).

**2. Check the enabled APIs**

Under **Purchased APIs** (已购买API), check that the APIs listed for each table in [Fields by stream](#fields-by-stream) are there. Mabang sells access to its API; an API that is not enabled, or whose subscription expired, is refused. If one is missing, the tables that need it are skipped and the others keep syncing.

**3. Copy the AppKey and App secret**

Under **Developer** (开发者), copy the **AppKey** and the **App secret** (Mabang asks for your login password again to show the secret).

**4. Check the IP whitelist**

The **Developer** page also has an optional IP whitelist. If it is filled, add Nekt's addresses `34.24.209.97`, `34.74.81.117` and `34.138.230.39`; if it is empty, nothing needs to be done.

> [!WARNING]
>
> The AppKey and App secret give access to all of the company's data in Mabang. If you need a new App secret, Mabang support resets it.

The following configurations are available:

* **AppKey**: The AppKey of your company in the Mabang Open Platform.
* **App Secret**: The App secret shown next to the AppKey.
* **Start Date**: Earliest date read on the first sync and on full syncs: orders by update date (or payment date, for orders older than four months) and return orders by update date. The other tables are always read in full.
* **Archive Re-read Days** (advanced, default 14): Mabang moves orders older than four months to an archive. Every sync reads this many payment days of the archive again and updates the archived orders that changed since the previous sync (a late refund, for example). Older archived orders are only refreshed by a full sync. 0 turns it off.

Once you're done, click **Next**.

### 2. Select streams

Choose which data streams you want to sync. For faster extractions, select only the streams that are relevant to your analysis. You can select entire groups of streams or pick specific ones.

> Tip: The stream can be found more easily by typing its name.

Select the streams and click **Next**.

### 3. Configure data streams

Customize how you want your data to appear in your catalog. Select the desired layer where the data will be placed, a folder to organize it inside the layer, a name for each table (which will effectively contain the fetched data) and the type of sync.

* **Layer**: choose between the existing layers on your catalog. This is where you will find your new extracted tables as the extraction runs successfully.
* **Folder**: a folder can be created inside the selected layer to group all tables being created from this new data source.
* **Table name**: we suggest a name, but feel free to customize it. You have the option to add a **prefix** to all tables at once and make this process faster!
* **Sync Type**: you can choose between INCREMENTAL and FULL\_TABLE.
  * Incremental: every time the extraction happens, we'll get only the new data, which is good if, for example, you want to keep every record ever fetched.
  * Full table: every time the extraction happens, we'll get the current state of the data, which is good if, for example, you don't want to have deleted data in your catalog.

Once you are done configuring, click **Next**.

### 4. Configure data source

Describe your data source for easy identification within your organization, not exceeding 140 characters.

To define your [Trigger](https://docs.nekt.com/runs/scheduling-and-triggers.md), consider how often you want data to be extracted from this source. This decision usually depends on how frequently you need the new table data updated (every day, once a week, or only at specific times).

> [!WARNING]
>
> **Schedule every sync of this source between 08:00 and 20:00 Brasília time.** Between 07:00 and 19:00 China time (20:00 to 08:00 in Brasília), Mabang only serves orders changed in the last day; outside those hours it serves the last four months. Each sync re-reads a little before the previous one, so even a **daily** sync scheduled between 20:00 and 08:00 Brasília asks for more than one day and fails every time, with a message saying so. The first sync and full syncs read the whole history and must finish inside that window too.

Optionally, you can define some additional settings:

* Configure Delta Log Retention and determine for how long we should store old states of this table as it gets updated. Read more about this resource [here](https://docs.nekt.com/get-started/core-concepts/resource-control).
* Determine when to execute an **Additional [Full Sync](https://docs.nekt.com/get-started/core-concepts/types-of-sync#additional-full-sync)**. This will complement the incremental data extractions, ensuring that your data is completely synchronized with your source every once in a while. For Mabang we recommend a monthly full sync (between 08:00 and 20:00 Brasília time): it refreshes archived orders that changed more than **Archive Re-read Days** after being archived.

Once you are ready, click **Next** to finalize the setup.

### 5. Check your new source

You can view your new source on the [Sources](https://app.nekt.ai/sources) page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.

> [!WARNING]
>
> For you to be able to see it on your [Catalog](https://app.nekt.ai/catalog), you need at least one successful source run.

> [!NOTE]
>
> Mabang allows 300 requests per minute per API, shared with any other tool that uses the same AppKey. Orders are read one day at a time (two requests per day, plus one per 1,000 orders), and Mabang keeps only the last four months in its order list: older orders come from its order archive, read one payment day at a time. A first sync with a start date one year back makes about 1,500 requests, roughly seven minutes. All dates and times are converted from China time to UTC.

> [!NOTE]
>
> The archive keeps fewer details than the recent order list (for example, payment type, custom order number and close date are not in it), so those columns are empty for orders read from the archive (`source_api` = `get-history-order-list`). Two kinds of orders can be missing after a full sync: orders older than four months that Mabang has not moved to the archive yet and that did not change in the last four months, and archived orders without a payment date (the archive is read by payment day).

## Fields by stream

> [!NOTE]
>
> Nested data (addresses, item lines, fees, per-warehouse settings) arrives as JSON text in one column. Every table also has an `extra_fields` column with any field Mabang sends that has no column of its own. Amounts ending in `_cny` are in Chinese yuan; the others are in the order currency (`currency`).

### Orders and returns

> [accordion] Orders
>
> Sales orders from every marketplace shop connected to Mabang, with buyer, address, amounts (in the order currency and in CNY), fees, logistics and status. The current item lines of each order are also in `order_items` (JSON).
>
> Table: `orders` · Primary key: `erp_order_id` · Sync: Incremental (`update_time`) · Mabang API to enable: Order API: `order-get-order-list-new`; for orders older than four months also `get-history-order-list` (without it, only the last four months are synced, and a full sync keeps only those four months)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `erp_order_id` | Integer | Mabang identifier of the order. |
> | `platform_order_id` | String | Order number in Mabang. |
> | `sales_record_number` | String | Transaction number of the order on the marketplace. |
> | `custom_order_number` | String | Custom order number. |
> | `source` | Integer | How the order entered Mabang: 1 manually, 2 upload, 3 API. |
> | `order_status` | Integer | Order status: 2 pending or allocating (see is\_new\_order), 3 shipped, 4 completed, 5 voided. |
> | `is_new_order` | Integer | 1 pending (not processed yet), 2 allocating stock. |
> | `status_before_void` | Integer | Order status before it was voided. |
> | `can_send` | Integer | Whether the order is normal or abnormal: 1 normal, 2 abnormal. |
> | `can_send_before_void` | Integer | Normal/abnormal flag before the order was voided: 1 normal, 2 abnormal. |
> | `order_type` | String | Order exception categories, as text. |
> | `abnormal_type` | String | Exception after shipping: 4 refund, 5 buyer cancelled, 6 partial refund, 7 refunding, 8 cancelling, 9 partial cancel, 10 delivery failed, 11 refund cancelled. |
> | `exception_reason_id` | Integer | Id of the resend reason (see the categories list in Mabang). |
> | `risk_type` | String | Risk level of the order: high, middle, low or none. |
> | `platform_order_status` | String | Order status on the marketplace, as the marketplace sends it. |
> | `platform_fulfillment_status` | String | Fulfilment status on the marketplace. |
> | `platform_id` | String | Marketplace platform of the order. |
> | `platform_code` | String | Marketplace platform code of the order. |
> | `shop_id` | Integer | Identifier of the shop the order belongs to. |
> | `shop_name` | String | Name of the shop the order belongs to. |
> | `is_returned` | Integer | Return flag: 1 returned, 2 not returned, 3 return completed. |
> | `is_refund` | Integer | Refund flag: 1 refunded, 2 not refunded. |
> | `tracking_online_status` | Integer | Carrier tracking status: 0 not online, 1 online, 2 overdue, 3 online with problems. |
> | `delivery_confirmation` | Integer | Delivery confirmation: 1 by the platform, 11 manual, 2 not delivered, 3 partially delivered. |
> | `carrier_booking_status` | Integer | Carrier booking status: 0 not called, 1 started, 2 in progress, 3 booked, 98 failed, 99 validation failed. |
> | `platform_sync_status` | Integer | Shipment sync to the marketplace: 1 not synced, 2 waiting, 6 not needed, 7 failed, 9 synced. |
> | `is_merged` | Integer | Merged order: 1 yes, 2 no. |
> | `is_split` | Integer | Split order: 1 yes, 2 no. |
> | `is_resend` | Integer | Resent order: 1 yes, 2 no. |
> | `is_replacement_order` | String | Amazon exchange order flag (true or false). |
> | `is_virtual_shipment` | Integer | Virtual (fake) shipment order: 1 yes, 2 no. |
> | `is_urgent` | Integer | Urgent order: 1 yes, 2 no. |
> | `is_evaluation` | Integer | Review (evaluation) order: 1 yes, 2 no. |
> | `is_preorder` | Integer | Pre-sale order: 1 yes, 2 no. |
> | `is_sample_order` | Integer | Sample order: 1 yes, 2 no. |
> | `is_live_gift_order` | Integer | TikTok live gift order: 1 yes, 2 no. |
> | `is_business_order` | String | Amazon Business order flag: 1 yes. |
> | `is_cod` | Integer | Cash-on-delivery order: 1 yes, 0 no. |
> | `cod_flag` | Integer | COD marker: 1 default, 10 COD, 11 WE, 12 COD and WE. |
> | `is_wms` | Integer | Handled in the Mabang WMS: 1 yes, 2 no. |
> | `is_platform_fulfilled` | Integer | Fulfilled by the platform (FBA and similar): 1 no, 2 yes. |
> | `fba_order_type` | Integer | FBA conversion: 0 not converted, 1 original order, 2 converted to FBA. |
> | `fba_order_id` | String | FBA order identifier. |
> | `has_battery` | Integer | Contains a battery: 1 yes, 2 no. |
> | `has_infringement` | Integer | Contains infringing goods: 1 yes, 2 no. |
> | `has_powder` | Integer | Contains powder: 1 yes, 2 no. |
> | `has_magnetic` | Integer | Contains magnetic goods: 1 yes, 2 no. |
> | `platform_order_tags` | String | Order tags from the marketplace. |
> | `platform_order_ads` | String | Advertising order marker (some platforms only). |
> | `buyer_user_id` | String | Buyer account on the marketplace. |
> | `buyer_name` | String | Buyer name. |
> | `buyer_email` | String | Buyer email. |
> | `phone1` | String | Buyer phone 1. |
> | `phone2` | String | Buyer phone 2. |
> | `country_code` | String | Destination country (two-letter code). |
> | `country_name_en` | String | Destination country name in English. |
> | `country_name_cn` | String | Destination country name in Chinese. |
> | `province` | String | Destination province or state. |
> | `city` | String | Destination city. |
> | `district` | String | Destination district. |
> | `town` | String | Destination town. |
> | `street1` | String | Destination street, line 1. |
> | `street2` | String | Destination street, line 2. |
> | `door_code` | String | House number. |
> | `post_code` | String | Destination postal code. |
> | `company_street` | String | Company street. |
> | `short_address` | String | Saudi short address. |
> | `billing_address` | String | Billing address. |
> | `receiver_address` | String (JSON) | Recipient address as one object: country, region, streets, city, postcode, phones, email, coordinates (JSON). |
> | `customer_abn_number` | String | ABN number on the order details. |
> | `currency` | String | Currency of the order (original amounts use it). |
> | `currency_rate` | Number | Exchange rate of the order currency to CNY. |
> | `order_amount_cny` | Number | Order amount in CNY. |
> | `order_cost_cny` | Number | Order cost in CNY. |
> | `total_amount` | Number | Order total in the order currency. |
> | `platform_total_price` | Number | Total before points are deducted (Rakuten). |
> | `item_total_cny` | Number | Item sales total in CNY. |
> | `item_total` | Number | Item sales total in the order currency. |
> | `item_total_cost_cny` | Number | Item cost total in CNY. |
> | `shipping_income_cny` | Number | Shipping charged to the buyer, in CNY. |
> | `shipping_income` | Number | Shipping charged to the buyer, in the order currency. |
> | `shipping_cost_cny` | Number | Actual shipping cost in CNY. |
> | `shipping_estimated_cost_cny` | Number | Estimated shipping cost in CNY. |
> | `first_leg_shipping_cny` | Number | First-leg (head haul) shipping cost. |
> | `platform_fee_cny` | Number | Platform fee in CNY. |
> | `platform_fee` | Number | Platform fee in the order currency. |
> | `paypal_fee_cny` | Number | PayPal transfer fee in CNY. |
> | `paypal_fee` | Number | Transfer fee in the order currency. |
> | `insurance_fee_cny` | Number | Insurance fee in CNY. |
> | `insurance_fee` | Number | Insurance fee in the order currency. |
> | `package_fee_cny` | Number | Packaging material cost in CNY. |
> | `discount_cny` | Number | Discount in CNY. |
> | `discount` | Number | Discount in the order currency. |
> | `affiliate_fee_cny` | Number | Advertising/affiliate fee in CNY. |
> | `affiliate_fee` | Number | Advertising/affiliate fee in the order currency. |
> | `voucher_cny` | Number | Coupon amount in CNY. |
> | `voucher` | Number | Coupon amount in the order currency. |
> | `subsidy_cny` | Number | Subsidy amount in CNY. |
> | `subsidy` | Number | Subsidy amount in the order currency. |
> | `subsidy_and_voucher` | String (JSON) | Seller discount and platform subsidy (TikTok), JSON object. |
> | `cod_charge_cny` | Number | Cash-on-delivery fee in CNY. |
> | `cod_amount` | Number | Amount the buyer actually paid, in its currency (some platforms). |
> | `cod_amount_currency` | String | Currency of cod\_amount. |
> | `other_expense_cny` | Number | Other expenses in CNY. |
> | `other_expense` | Number | Other expenses in the order currency. |
> | `other_income_cny` | Number | Other income in CNY. |
> | `other_income` | Number | Other income in the order currency. |
> | `vat_cny` | Number | VAT in CNY. |
> | `vat` | Number | VAT in the order currency. |
> | `goods_tax` | Number | Goods tax in the order currency. |
> | `evaluation_fee_cny` | Number | Review (evaluation) cost in CNY. |
> | `refund_amount` | Number | Refunded amount. |
> | `refund_currency` | String | Currency of the refunded amount. |
> | `shipping_chargeback` | Number | Shipping credit-card chargeback, in the order currency. |
> | `variable_closing_fee` | Number | Variable closing fee, in the order currency. |
> | `fba_per_order_fee` | Number | FBA per-order fulfilment fee. |
> | `fba_commission_cny` | Number | Amazon commission in CNY (FBA orders). |
> | `fba_per_unit_fee_cny` | Number | FBA per-unit fulfilment fee in CNY. |
> | `fba_weight_based_fee_cny` | Number | FBA weight-based fee in CNY. |
> | `contribution_type` | Integer | Who funded the discount: 1 buyer, 2 platform, 0 default. |
> | `order_weight` | Number | Order weight. |
> | `package_weight` | Number | Package weight. |
> | `shipping_weight` | Number | Shipping weight. |
> | `package_length` | Number | Package length (cm). |
> | `package_width` | Number | Package width (cm). |
> | `package_height` | Number | Package height (cm). |
> | `package_volume` | Number | Package volume. |
> | `logistics_channel_id` | Integer | Identifier of the logistics channel. |
> | `logistics_channel_name` | String | Name of the logistics channel. |
> | `logistics_company_id` | Integer | Identifier of the logistics company. |
> | `logistics_company_name` | String | Name of the logistics company. |
> | `track_number` | String | Carrier tracking number. |
> | `internal_track_number` | String | Internal tracking number. |
> | `virtual_track_number` | String | Virtual tracking number. |
> | `carrier_code` | String | FBA carrier. |
> | `buyer_shipping_service` | String | Shipping service the buyer chose. |
> | `buyer_shipping_provider` | String | Carrier the buyer chose. |
> | `buyer_shipping_provider_id` | String | Identifier of the carrier the buyer chose. |
> | `platform_warehouse` | String | Platform warehouse the order ships from. |
> | `platform_warehouse_id` | String | Identifier of the platform warehouse. |
> | `outlet_code` | String | Outlet (network point) code. |
> | `forecast_status` | String | Forecast status: 1 success, 2 failed. |
> | `self_ship_status` | Integer | Self-ship delivery status: 201/202 to ship, 203 shipped, 204 completed, 205 voided. |
> | `overseas_warehouse_intercept` | String | Overseas-warehouse intercept result: success or error. |
> | `logistics_intercept` | String | Carrier intercept result: success or error. |
> | `paypal_id` | String | PayPal transaction id. |
> | `paypal_email` | String | Receiving account. |
> | `payment_type` | String | Payment type. |
> | `payment_reference_id` | String | Payment reference number. |
> | `print_count` | Integer | Times the label was printed. |
> | `print_preview_count` | Integer | Times the label was previewed. |
> | `shipper_employee_id` | Integer | Employee id of who shipped the order. |
> | `seller_name` | String | Seller (salesperson) name, on some platforms. |
> | `remark` | String | Order remark. |
> | `delivery_remark` | String | Shipping remark. |
> | `seller_message` | String | Seller note. |
> | `buyer_message` | String | Buyer note. |
> | `order_categories` | String (JSON) | Normal and abnormal categories of the order (JSON object). |
> | `extended_attributes` | String (JSON) | Extended attributes (JSON array of key and value). |
> | `is_settled` | String | Settlement flag: 1 settled, 2 not settled. |
> | `settlement` | String (JSON) | Settlement date and time zone (JSON object). |
> | `invoices` | String (JSON) | Invoices of the order (JSON array). |
> | `platform_invoice_info` | String (JSON) | Invoice details from the marketplace (JSON object, some platforms). |
> | `item_declarations` | String (JSON) | Customs declaration of the items (JSON array). |
> | `order_items` | String (JSON) | Every item line of the order as Mabang sent it (JSON array); the current lines of the order. |
> | `split_source_order_id` | String | Order this one was split from. |
> | `resend_source_order_number` | String | Order number this order was resent from. |
> | `forwarded_order_number` | String | Forwarded order number. |
> | `multichannel_source_order_number` | String | Source order number of a multi-channel order. |
> | `multichannel_source_shop` | String | Source shop of a multi-channel order. |
> | `fba_push_shop_name` | String | FBA shipping shop name. |
> | `fba_seller_document_number` | String | FBA seller document number. |
> | `fba_outbound_number` | String | Amazon FBA document number. |
> | `fbt_flag` | String | Converted to FBT: 1 yes, other values failed, empty not converted. |
> | `distributor_platform_id` | String | Distributor order platform id. |
> | `distributor_shop_id` | String | Distributor order shop id. |
> | `tms_customer_id` | String | TMS customer id. |
> | `tiktok_order_channel` | String | TikTok order channel. |
> | `source_shop_name` | String | Source shop name (DSers orders). |
> | `source_customer_email` | String | Source customer email (DSers orders). |
> | `latest_delivery_date` | String | Latest delivery date. |
> | `ship_date` | String | Scheduled delivery date (some companies). |
> | `ship_time` | String | Delivery time slot. |
> | `platform_arrival_time` | String | Arrival time on the platform (Amazon). |
> | `platform_buffer_date` | String | Platform buffer date. |
> | `created_at` | Datetime | When the order was created (UTC). |
> | `paid_at` | Datetime | When the order was paid (UTC). |
> | `shipped_at` | Datetime | When the order was shipped (UTC). |
> | `carrier_booked_at` | Datetime | When the order was handed to the carrier system (UTC). |
> | `allocated_at` | Datetime | When stock was allocated to the order (UTC). |
> | `printed_at` | Datetime | When the label was printed (UTC). |
> | `operated_at` | Datetime | Last operation time (UTC). |
> | `closed_at` | Datetime | When the transaction closed (UTC). |
> | `voided_at` | Datetime | When the order was voided (UTC; archived orders). |
> | `fba_delivery_start_at` | Datetime | FBA delivery start (UTC). |
> | `fba_delivery_end_at` | Datetime | FBA delivery end (UTC). |
> | `loan_at` | Datetime | Loan time (UTC). |
> | `update_time` | Datetime | When the order last changed in Mabang (UTC); the incremental replication key. |
> | `source_api` | String | Mabang API the row was read from: order-get-order-list-new (last four months) or get-history-order-list (archive). |
> | `extra_fields` | String (JSON) | Every other key Mabang returned for this record that has no column of its own, as a JSON object. |

> [accordion] Order items
>
> One row per item line of each order, read together with the order (no extra request). A line removed from an order stays in this table with the order's previous update time: keep only the rows whose `order_update_time` equals the order's `update_time`.
>
> Table: `order_items` · Primary key: `erp_order_id`, `order_item_id` · Sync: Incremental (`order_update_time`) · Mabang API to enable: Same as Orders
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `erp_order_id` | Integer | Mabang identifier of the order the line belongs to. |
> | `order_item_id` | String | Mabang identifier of the item line. |
> | `erp_order_item_id` | Integer | ERP identifier of the item line. |
> | `stock_sku` | String | Stock SKU of the item. |
> | `stock_sku_id` | Integer | Mabang identifier of the stock SKU. |
> | `platform_sku` | String | SKU on the marketplace. |
> | `manufacturer_sku` | String | Manufacturer SKU (distribution). |
> | `title` | String | Item title. |
> | `original_title` | String | Original title on the marketplace. |
> | `item_id` | String | Item (child product) id on the marketplace; on Shopee the parent product id. |
> | `platform_product_id` | String | Parent product id on the marketplace. |
> | `asin` | String | Amazon ASIN, or the online product link on other platforms. |
> | `transaction_id` | String | Marketplace transaction id of the line. |
> | `sales_record_number` | String | Marketplace transaction number. |
> | `barcode` | String | Barcode. |
> | `product_unit` | String | Unit of the product. |
> | `specifics` | String (JSON) | Item attributes such as color and size (JSON text). |
> | `quantity` | Number | Quantity. |
> | `platform_quantity` | Number | Quantity as sent by the marketplace. |
> | `combo_quantity` | Number | Quantity of the combo SKU. |
> | `status` | Integer | Line status: 1 unpaid, 2 not shipped, 3 shipped, 4 voided. |
> | `platform_item_status` | String | Line status on the marketplace, as sent. |
> | `sell_price_cny` | Number | Sale price in CNY. |
> | `sell_price` | Number | Sale price in the order currency. |
> | `cost_price_cny` | Number | Cost price in CNY. |
> | `platform_fee_cny` | Number | Platform fee in CNY. |
> | `platform_fee` | Number | Platform fee in the order currency. |
> | `first_leg_shipping` | Number | First-leg (head haul) shipping cost. |
> | `paid_amount` | Number | Amount paid for the line in the order currency. |
> | `paid_unit_price` | Number | Paid unit price in the order currency. |
> | `retail_price` | Number | Retail price in the order currency. |
> | `discount_unit_price` | Number | Discounted unit price in the order currency. |
> | `tax` | Number | Item tax in the order currency. |
> | `platform_item_discount` | Number | Platform item discount in the order currency. |
> | `platform_shipping_discount` | Number | Platform shipping discount in the order currency. |
> | `discount` | Number | Discount in the order currency (archived orders). |
> | `discount_cny` | Number | Discount in CNY (archived orders). |
> | `shipping_income` | Number | Shipping income in the order currency (archived orders). |
> | `shipping_income_cny` | Number | Shipping income in CNY (archived orders). |
> | `currency` | String | Currency (archived orders). |
> | `currency_rate` | Number | Exchange rate to CNY (archived orders). |
> | `financial_details` | String (JSON) | Fee breakdown of the line: fee type, amount and currency (JSON array). |
> | `warehouse_id` | Integer | Identifier of the warehouse the line ships from. |
> | `warehouse_name` | String | Name of the warehouse the line ships from. |
> | `bin_code` | String | Storage bin. |
> | `platform_warehouse_name` | String | Marketplace warehouse of the line. |
> | `is_combo` | Integer | Combo SKU: 1 yes, 2 no. |
> | `combo_sku_id` | String | Combo SKU id. |
> | `combo_serial_no` | String | Combo line number. |
> | `is_gift` | Integer | Gift: 1 yes, 2 no. |
> | `is_repeat_item` | Integer | SKU repeated because of a split: 1 yes, 0 no. |
> | `stock_availability` | Integer | Stock: 0 calculating, 1 in stock, 2 out of stock, 3 restocked. |
> | `sku_status` | Integer | SKU status: 1 auto-created, 2 awaiting development, 3 normal, 4 clearance, 5 discontinued. |
> | `unit_weight` | Number | Unit weight. |
> | `origin_order_id` | String | ERP order id the line is linked to. |
> | `picker_employee_id` | Integer | Employee id of the picker. |
> | `salesperson_employee_id` | Integer | Employee id of the salesperson. |
> | `operator_employee_id` | Integer | Employee id of the operator. |
> | `operated_at` | Datetime | Last operation time (UTC). |
> | `picture_url` | String | Item image URL. |
> | `original_picture_url` | String | Marketplace image URL. |
> | `customization_url` | String | Amazon buyer customization information. |
> | `platform_customization` | String (JSON) | Marketplace customization information (JSON). |
> | `item_remark` | String | Line remark. |
> | `serial_numbers` | String (JSON) | Serial numbers (JSON array). |
> | `platform_extend_info` | String (JSON) | Original marketplace information of the line (JSON). |
> | `platform_vendor` | String | Marketplace vendor. |
> | `pallet_supplier_id` | Integer | Pallet supplier id. |
> | `fba_msku_quantity` | String | Quantity converted to FBA MSKU. |
> | `liquid_cosmetic` | Integer | 0 non-liquid, 1 non-liquid cosmetic, 2 liquid cosmetic, 3 liquid non-cosmetic. |
> | `is_paste` | Integer | Paste: 1 yes, 2 no. |
> | `is_knife` | Integer | Knife: 1 yes, 2 no. |
> | `is_flammable` | Integer | Flammable: 1 yes, 2 no. |
> | `order_update_time` | Datetime | Last update time of the order when the line was read (UTC); the incremental replication key. |
> | `source_api` | String | Mabang API the order was read from. |
> | `extra_fields` | String (JSON) | Every other key Mabang returned for this line that has no column of its own, as a JSON object. |

> [accordion] Return orders
>
> Return orders (RMA) with their status, receipt, carrier and claim details. The returned items are in `items` (JSON).
>
> Table: `return_orders` · Primary key: `refunds_order_id` · Sync: Incremental (`update_time`) · Mabang API to enable: Order API: `order-get-return-order-list-v2`
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `refunds_order_id` | Integer | Mabang identifier of the return order. |
> | `return_order_number` | String | Return order number in Mabang. |
> | `platform_return_order_number` | String | Return order number on the marketplace. |
> | `platform_order_id` | String | Order number of the returned order. |
> | `sales_record_number` | String | Marketplace transaction number of the returned order. |
> | `status` | Integer | Return status: 1 pending, 2 refunded, 3 resent, 4 completed, 5 voided. |
> | `receipt_status` | Integer | Receipt status: 1 awaiting receipt, 2 partially received, 3 received. |
> | `approval_status` | Integer | Approval: 1 pending, 2 in review, 3 approved, 4 rejected, 5 not required. |
> | `return_status` | Integer | Return status code. |
> | `return_type` | String | Return type: 1 returned by the post office, 2 returned by the buyer, other values custom. |
> | `business_type` | Integer | Business type: 1 regular return, 2 local COD return. |
> | `source` | Integer | Origin: 101 added manually, 201 from the platform, 202 external API, 203 WMS API. |
> | `shop_id` | Integer | Identifier of the shop. |
> | `shop_name` | String | Name of the shop. |
> | `platform_id` | String | Marketplace platform. |
> | `buyer_user_id` | String | Buyer account. |
> | `buyer_name` | String | Buyer name. |
> | `country_code` | String | Country (two-letter code). |
> | `country_name_en` | String | Country name in English. |
> | `country_name_cn` | String | Country name in Chinese. |
> | `return_address` | String | Return address. |
> | `logistics_channel_id` | Integer | Identifier of the logistics channel of the original shipment. |
> | `logistics_channel_name` | String | Name of the logistics channel of the original shipment. |
> | `logistics_company_id` | Integer | Identifier of the logistics company. |
> | `logistics_company_name` | String | Name of the logistics company. |
> | `track_number` | String | Tracking number of the original shipment. |
> | `return_track_number` | String | Tracking number of the return shipment. |
> | `return_carrier` | String | Carrier of the return shipment. |
> | `return_tracking` | String (JSON) | Return shipments: carrier and tracking number (JSON array). |
> | `fba_flag` | Integer | FBA flag. |
> | `order_weight` | Number | Weight of the order. |
> | `order_amount` | Number | Order amount. |
> | `currency` | String | Currency. |
> | `currency_rate` | Number | Exchange rate. |
> | `total_amount` | Number | Order total in the original currency. |
> | `claim_state` | Integer | Claim status. |
> | `claim_total` | Number | Total claimed amount. |
> | `claimed_at` | Datetime | When the claim was made (UTC). |
> | `claim_remark` | String | Claim remark. |
> | `package_damaged` | Integer | Package damaged: 0 no, 1 yes. |
> | `is_platform_settlement` | Integer | Settled by the platform: 1 yes, 0 no. |
> | `is_tracked_online` | Integer | Tracked online: 0 no, 1 yes. |
> | `received` | Integer | Received flag. |
> | `real_inbound_status` | String | Whether the goods were actually put back in stock. |
> | `delivery_status` | Integer | Delivery status. |
> | `delivery_remark` | String | Delivery remark. |
> | `forecast_channel` | String | Forecast channel. |
> | `forecast_status` | String | Forecast status. |
> | `pushed_third_party_logistics_id` | Integer | Third-party logistics company the return was pushed to. |
> | `push_status` | Integer | Push status. |
> | `push_result` | String | Push result. |
> | `push_extend_info` | String (JSON) | Push extended information (JSON). |
> | `third_party_order_status` | String | Third-party order status. |
> | `third_party_asn_number` | String | Third-party ASN number. |
> | `warehouse_name_push_status` | String | Warehouse name push status. |
> | `snapshot_platform_status` | String | Snapshot of the platform status. |
> | `return_unique_id` | String | Unique return identifier. |
> | `aftersale_relationship_id` | String | Linked after-sale order id. |
> | `extend_number` | String | Extended number. |
> | `registered_by` | String | Employee who registered the return. |
> | `voided_by` | String | Employee who voided the return. |
> | `second_review_employee_id` | String | Employee id of the second review. |
> | `remark` | String | Remark. |
> | `items` | String (JSON) | Returned items with quantities, prices and stock-in details (JSON array). |
> | `paid_at` | Datetime | When the original order was paid (UTC). |
> | `shipped_at` | Datetime | When the original order was shipped (UTC). |
> | `created_at` | Datetime | When the return order was created (UTC). |
> | `refunded_at` | Datetime | When the refund was made (UTC). |
> | `last_inbound_at` | Datetime | Last time returned goods were put in stock (UTC). |
> | `real_inbound_at` | Datetime | When the goods were actually put in stock (UTC). |
> | `second_review_at` | Datetime | When the second review happened (UTC). |
> | `update_time` | Datetime | When the return order last changed (UTC); the incremental replication key. |
> | `extra_fields` | String (JSON) | Every other key Mabang returned for this record that has no column of its own, as a JSON object. |

### Products and stock

> [accordion] Products
>
> Every stock SKU of the company, with names, brand and category, prices and costs, dimensions, customs data, people in charge and per-warehouse settings (JSON).
>
> Table: `products` · Primary key: `id` · Sync: Full table · Mabang API to enable: Commodity API: `stock-do-search-sku-list-new`
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Mabang identifier of the stock SKU. |
> | `stock_sku` | String | Stock SKU code. |
> | `sales_sku` | String | Main (sales) SKU code the stock SKU belongs to. |
> | `name_cn` | String | Chinese name of the product. |
> | `name_en` | String | English name of the product. |
> | `status` | Integer | SKU status: 1 auto-created, 2 awaiting development, 3 on sale, 4 clearance, 5 discontinued. |
> | `stock_type` | String | Product form: 1 physical, 2 virtual. |
> | `original_sku` | String | Manufacturer's original SKU. |
> | `parent_brand_name` | String | First-level brand name. |
> | `brand_name` | String | Second-level brand name. |
> | `parent_category_name` | String | First-level category. |
> | `category_name` | String | Second-level category. |
> | `third_category_name` | String | Third-level category. |
> | `default_cost` | Number | Unified cost price. |
> | `purchase_price` | Number | Latest purchase price. |
> | `standard_price` | Number | Standard purchase price. |
> | `sale_price` | Number | Sale price. |
> | `declare_value` | Number | Customs declared value. |
> | `forecast_day_sale` | Number | Forecast daily sales. |
> | `liveness_type` | Integer | Sales activity: 0 not calculated, 1 best seller, 2 hot, 3 average, 4 slow-moving. |
> | `is_new` | Integer | Whether it is a new product: 0 no, 1 yes. |
> | `is_infringing` | Integer | Whether the product infringes intellectual property: 1 yes, 2 no. |
> | `has_battery` | Integer | Whether the product contains a battery: 1 yes, 2 no. |
> | `battery_type` | Integer | Battery type (when it has one): 0 not set, 1 battery only, 2 built-in non-removable, 3 built-in removable. |
> | `magnetic` | Integer | Whether the product is magnetic: 0 not set, 1 yes, 2 no. |
> | `powder` | Integer | Whether the product contains powder: 0 not set, 1 yes, 2 no. |
> | `is_paste` | Integer | Whether the product is a paste: 1 yes, 2 no. |
> | `liquid_cosmetic` | Integer | Liquid/cosmetic class: 0 neither, 1 non-liquid cosmetic, 2 liquid cosmetic, 3 liquid non-cosmetic. |
> | `is_flammable` | Integer | Whether the product is flammable: 1 yes, 2 no. |
> | `is_knife` | Integer | Whether the product is a knife: 1 yes, 2 no. |
> | `can_be_gift` | Integer | Whether it can be used as a gift: 0 not set, 1 yes, 2 no. |
> | `length` | Number | Length of the product (cm). |
> | `width` | Number | Width of the product (cm). |
> | `height` | Number | Height of the product (cm). |
> | `weight` | Number | Weight of the product. |
> | `packaging_length` | Number | Length after packaging (cm). |
> | `packaging_width` | Number | Width after packaging (cm). |
> | `packaging_height` | Number | Height after packaging (cm). |
> | `packing_weight` | Number | Weight after packaging (kg). |
> | `packing_gross_weight` | Number | Gross weight of a full carton (kg). |
> | `packing_quantity` | Number | Units per carton. |
> | `packing_length` | Number | Carton length (cm). |
> | `packing_width` | Number | Carton width (cm). |
> | `packing_height` | Number | Carton height (cm). |
> | `order_package_material` | String | Packaging material used for orders. |
> | `order_package_count` | Integer | Units the order packaging material holds. |
> | `goods_package_material` | String | Product packaging material names (comma-separated). |
> | `goods_package_count` | Integer | Units the product packaging material holds. |
> | `declare_name` | String | Chinese customs declaration name. |
> | `declare_name_en` | String | English customs declaration name. |
> | `declare_code` | String | Customs (HS) code. |
> | `declare_unit_id` | Integer | Customs declaration unit id. |
> | `spec_model` | String | Customs specification and model. |
> | `origin_country` | String | Country of origin. |
> | `domestic_source` | String | Domestic source of the goods. |
> | `levy_exemption` | String | Duty exemption method. |
> | `manufacturer` | String | Manufacturer. |
> | `trademark_register_no` | String | Trademark registration number. |
> | `trademark_register_date` | String | Trademark registration date. |
> | `trademark_expire_date` | String | Trademark expiry date. |
> | `shelf_life_days` | Integer | Shelf life in days. |
> | `expiry_management` | Integer | Whether expiry-date management is on: 0 off, 1 on. |
> | `expiry_warning_days` | Integer | Days before expiry that raise a warning. |
> | `m_pid` | String | Merchant product identification code (M-PID). |
> | `ns_pid` | String | Non-standard manufacturer product code (NS-PID). |
> | `s_pid` | String | International standard product code (S-PID). |
> | `finance_code` | String | Finance code of the product. |
> | `commodity_use` | String | What the product is used for. |
> | `commodity_material` | String | Material of the product. |
> | `remark` | String | Product remark. |
> | `sale_remark` | String | Sales remark. |
> | `purchase_remark` | String | Purchasing remark. |
> | `stock_picture` | String | Image URL shown in the ERP. |
> | `sale_picture` | String | Original product image URL. |
> | `sale_url` | String | Sales link. |
> | `detail_images` | String (JSON) | Detail image URLs (JSON array). |
> | `create_oper_id` | Integer | Employee id of who created the stock SKU. |
> | `developer_id` | Integer | Employee id of the product developer. |
> | `developer_name` | String | Name of the product developer. |
> | `buyer_id` | Integer | Employee id of the buyer. |
> | `buyer_name` | String | Name of the buyer. |
> | `art_designer_id` | Integer | Employee id of the art designer. |
> | `art_designer_name` | String | Name of the art designer. |
> | `salespeople` | String (JSON) | Salespeople linked to the SKU (JSON array of id, name and link date). |
> | `default_supplier` | String | Name of the default supplier. |
> | `default_supplier_link` | String | Purchase link of the product at the default supplier. |
> | `purchase_type` | Integer | Purchase calculation: 1 per warehouse, 2 multi-warehouse (only some companies). |
> | `warehouses` | String (JSON) | Per-warehouse settings: cost, default bin, warning stock, purchase days and more (JSON array). |
> | `virtual_skus` | String (JSON) | Virtual SKUs of the stock SKU (JSON array). |
> | `is_kit` | Integer | Whether the SKU is assembled from components: 1 yes, 2 no. |
> | `process_cost` | Number | Assembly cost. |
> | `kit_components` | String (JSON) | Components of an assembled SKU (JSON array). |
> | `labels` | String (JSON) | Custom labels of the SKU (JSON array of id and name). |
> | `attributes` | String (JSON) | Multi-attribute values of the SKU, such as color and size (JSON array). |
> | `extend` | String (JSON) | Extended information of the SKU (JSON object). |
> | `time_created` | Datetime | When the stock SKU was created (UTC). |
> | `time_modified` | Datetime | When the stock SKU was modified (UTC). |
> | `last_updated` | Datetime | When the stock SKU was last updated (UTC). |
> | `extra_fields` | String (JSON) | Every other key Mabang returned for this record that has no column of its own, as a JSON object. |

> [accordion] Inventory
>
> Current stock of every stock SKU in every warehouse: total, available, reserved and in-transit quantities. Each sync writes a new snapshot; `snapshot_at` tells when it was read.
>
> Table: `inventory` · Primary key: `stock_sku`, `warehouse_id` · Sync: Full table · Mabang API to enable: Commodity API: `stock-do-search-sku-list-new` and `stock-get-stock-quantity`
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `stock_sku` | String | Stock SKU code. |
> | `warehouse_id` | Integer | Mabang identifier of the warehouse. |
> | `warehouse_name` | String | Name of the warehouse. |
> | `bin_code` | String | Storage bin of the SKU in the warehouse. |
> | `stock_quantity` | Number | Total quantity in stock in the warehouse. |
> | `available_quantity` | Number | Quantity available for new orders. |
> | `unshipped_order_quantity` | Number | Quantity reserved by own orders not shipped yet. |
> | `purchase_in_transit_quantity` | Number | Quantity on the way from purchase orders. |
> | `transfer_in_transit_quantity` | Number | Quantity in transit between warehouses. |
> | `overseas_transfer_in_transit_quantity` | Number | Quantity in transit to an overseas warehouse. |
> | `transfer_unshipped_quantity` | Number | Quantity on warehouse transfers not shipped yet. |
> | `fba_unshipped_quantity` | Number | Quantity on FBA and overseas-warehouse transfers not shipped yet. |
> | `overseas_incoming_quantity` | Number | Quantity expected to arrive at the overseas warehouse. |
> | `transfer_incoming_quantity` | Number | Quantity expected to arrive by warehouse transfer. |
> | `kit_waiting_quantity` | Number | Quantity waiting to be allocated to assembly. |
> | `kit_in_progress_quantity` | Number | Quantity in assembly. |
> | `manual_outbound_pending_quantity` | Number | Quantity on manual outbound orders not shipped yet. |
> | `manual_inbound_in_transit_quantity` | Number | Quantity on manual inbound orders in transit. |
> | `last_inbound_at` | Datetime | Last time stock came into the warehouse (UTC). |
> | `last_outbound_at` | Datetime | Last time stock left the warehouse (UTC). |
> | `sku_total_stock_quantity` | Number | Total quantity of the SKU in stock across all warehouses. |
> | `snapshot_at` | Datetime | When this sync read the stock (UTC); every row of a run has the same value. |
> | `extra_fields` | String (JSON) | Every other key Mabang returned for this SKU and warehouse that has no column of its own, as a JSON object. |

### Reference data

> [accordion] Warehouses
>
> Every warehouse of the company (own, third-party, FBA and platform), enabled and disabled.
>
> Table: `warehouses` · Primary key: `id` · Sync: Full table · Mabang API to enable: System API: `sys-get-warehouse-list`
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Mabang identifier of the warehouse. |
> | `parent_warehouse_id` | Integer | Identifier of the parent warehouse; 0 when it has none or the parent is disabled. |
> | `name` | String | Name of the warehouse. |
> | `code` | String | Warehouse number in Mabang. |
> | `finance_code` | String | Warehouse code used in finance. |
> | `status` | Integer | Status: 1 enabled, 2 disabled. |
> | `type` | Integer | Warehouse type: 1 own warehouse, 2 third-party warehouse, 3 FBA warehouse, 4 platform warehouse. |
> | `is_virtual` | Integer | Whether it is a virtual warehouse: 1 virtual, 2 regular. |
> | `is_default` | Integer | Whether it is the default warehouse: 1 yes, 2 no. |
> | `contact` | String | Contact person of the warehouse. |
> | `country_code` | String | Country of the warehouse (two-letter code). |
> | `province` | String | Province or state of the warehouse. |
> | `city` | String | City of the warehouse. |
> | `area` | String | District of the warehouse. |
> | `address` | String | Street address of the warehouse. |
> | `zipcode` | String | Postal code of the warehouse. |
> | `telephone` | String | Landline phone number of the warehouse. |
> | `phone` | String | Mobile phone number of the warehouse. |
> | `rejects_warehouse_id` | Integer | Identifier of the warehouse designated for defective goods. |
> | `remark` | String | Free-text remark on the warehouse. |
> | `platform_id` | String | Marketplace platform identifier (platform warehouses only). |
> | `shop_id` | String | Shop identifier (platform warehouses only). |
> | `time_created` | Datetime | When the warehouse was created (UTC). |
> | `time_last_modified` | Datetime | When the warehouse was last modified (UTC). |
> | `extra_fields` | String (JSON) | Every other key Mabang returned for this record that has no column of its own, as a JSON object. |

> [accordion] Shops
>
> Every marketplace shop connected to Mabang, enabled and disabled.
>
> Table: `shops` · Primary key: `id` · Sync: Full table · Mabang API to enable: System API: `sys-get-shop-list`
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Mabang identifier of the shop. |
> | `name` | String | Name of the shop. |
> | `status` | Integer | Status: 1 enabled, 2 disabled. |
> | `platform_id` | String | Identifier of the marketplace platform of the shop. |
> | `platform_name` | String | Name of the marketplace platform of the shop. |
> | `platform_shop_id` | String | Seller id of the shop on the platform (Shopee, Lazada and TikTok only). |
> | `short_code` | String | Short code of the shop (Shopee and Lazada only). |
> | `account_username` | String | Account name of the shop on the platform. |
> | `amazon_site` | String | Marketplace site of the shop. |
> | `timezone` | String | Time zone of the shop. |
> | `finance_code` | String | Finance code of the shop. |
> | `create_oper_id` | Integer | Employee id of who created the shop. |
> | `shop_employee_id` | Integer | Employee id of the shop manager. |
> | `fba_warehouse_id` | String | FBA warehouse identifier (shared across shops of a European pan-EU account). |
> | `platform_warehouse_list` | String (JSON) | Platform warehouses linked to the shop (JSON array of id, name and code). |
> | `shop_label_list` | String (JSON) | Custom categories of the shop (JSON array of labelId and labelName). |
> | `time_created` | Datetime | When the shop was created (UTC). |
> | `time_last_modified` | Datetime | When the shop was last modified (UTC). |
> | `extra_fields` | String (JSON) | Every other key Mabang returned for this record that has no column of its own, as a JSON object. |

> [accordion] Logistics channels
>
> Logistics channels (carrier services) configured in Mabang, enabled and disabled.
>
> Table: `logistics_channels` · Primary key: `logistics_channel_id` · Sync: Full table · Mabang API to enable: Logistics API: `wl-get-mylogisticschannel`
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `logistics_channel_id` | Integer | Mabang identifier of the logistics channel. |
> | `logistics_channel_name` | String | Name of the logistics channel. |
> | `logistics_company_id` | Integer | Identifier of the logistics company the channel belongs to. |
> | `logistics_company_name` | String | Name of the logistics company the channel belongs to. |
> | `code` | String | Code of the logistics channel. |
> | `open_flag` | Integer | Whether the channel is enabled: 1 enabled, 2 disabled. |
> | `channel_flag` | String | Customer sorting code of the channel. |
> | `is_overseas_warehouse` | String | Whether the channel is an overseas-warehouse channel. |
> | `extra_fields` | String (JSON) | Every other key Mabang returned for this record that has no column of its own, as a JSON object. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.