eMAG Marketplace API Documentation v4
eMAG Marketplace API Documentation v4
2
Table of Contents
1. eMAG Marketplace API...........................................................................................................................................5
1.1. Conventions...........................................................................................................................................................5
1.2. Request, resources and actions.............................................................................................................................6
1.3. Pagination and filters.............................................................................................................................................7
1.4. Response...............................................................................................................................................................7
1.5. Rate limiting..........................................................................................................................................................8
1.6. Callback URLs.........................................................................................................................................................8
2. Publishing products and offers................................................................................................................................8
2.1. Reading categories, characteristics and family_types...........................................................................................9
2.2. Reading VAT rates...............................................................................................................................................11
2.3. Reading Handling Time values.............................................................................................................................11
2.4. Sending a new product........................................................................................................................................11
2.4.1. Example for a new product..........................................................................................................................16
2.5. Updating existing offer........................................................................................................................................16
2.6. Saving volume measurements on products.........................................................................................................17
2.7. Reading and counting products and offers..........................................................................................................17
2.8. Product validation responses..............................................................................................................................21
2.9. Matching products..............................................................................................................................................21
2.10. Attaching offers on existing products..................................................................................................................21
3. Processing orders..................................................................................................................................................24
3.1. Order fields..........................................................................................................................................................24
3.1.1. Product field in order details.......................................................................................................................27
3.1.2. Customer fields in order details...................................................................................................................27
3.1.3. Order invoices..............................................................................................................................................29
3.2. Order notification, acknowledgment and order filters........................................................................................29
3.3. Order status matrix.............................................................................................................................................30
3.4. Order filters.........................................................................................................................................................30
3.5. Updating orders...................................................................................................................................................32
3.5.1. Removing products from an order..............................................................................................................32
3.5.2. Adding products to an existing order..........................................................................................................32
3.5.3. Returned products and storno route...........................................................................................................32
4. Shipping orders.....................................................................................................................................................35
3
4.1. Saving AWB.........................................................................................................................................................36
4.2. Reading AWB.......................................................................................................................................................37
4.3. Reading AWB PDF files........................................................................................................................................39
4.4. Reading AWB ZPL type........................................................................................................................................39
4.5. Counting Localities..............................................................................................................................................40
4.6. Reading Localities................................................................................................................................................40
4.7. Reading courier accounts....................................................................................................................................41
5. Processing return requests....................................................................................................................................41
5.1. Return requests filters.........................................................................................................................................45
5.2. Status change permissions..................................................................................................................................46
5.3. Return request deliveries....................................................................................................................................46
5.4. Examples requests and responses.......................................................................................................................46
4
1. eMAG Marketplace API
eMAG Marketplace API is developed by eMAG for Marketplace partners in order to allow them to use their own
CRM’s / ERP’s. This document explains the methods for calling the API.
The API can be used in order to:
send products and offers
process orders
1.1. Conventions
We define MARKETPLACE_API_URL constant of being the API URL of the platform (ex: https://marketplace.emag.ro/api-
3)
We define MARKETPLACE_URL constant of being the URL of the platform (ex: https://marketplace.emag.ro)
We define DEFAULT_CURRENCY constant of being the default currency of the platform (ex: RON).
All API parameters are key-sensitive.
To access the API, simply make a Basic Authorization request with your username, password and a base64 computed
hash. Please note that user should be granted API rights in order to access the API.
5
1.2. Request, resources and actions
A Marketplace API call is represented by sending a request to API URL of platform. Every request consists of a POST to an
URL like:
MARKETPLACE_API_URL/resource/action
Ex: https://marketplace.emag.ro/api-3/product_offer/save
Below a code example using the resource "category" and the action "read"
The API needs authorization and has an IP level filtering. Before testing, sellers should provide a list of whitelisted IP’s.
eMAG Marketplace will only allow API calls only from those IP’s.
6
The POST data consist of 1 mandatory key:
REQUEST
Key Description
data Data to be passed to the API. The following document will describe keys.
In order to limit the number of items returned, read actions accept pagination by passing to POST data following
parameters:
PAGINATION
itemsPerPage Set number of items to be displayed in one page. Maximum is set to 100. 100 itemsPerPage=50
Also, filters can be included in POST to refine result set. Filters vary depending on the resource called and are exampled
on every resource section.
1.4. Response
When an API call is made, the server MUST reply with a response. The response will ALWAYS be JSON formatted and the
header 'Content-type: application/json' will always be passed.
RESPONSE
Key Description
IMPORTANT: Every API request must have a response and the response must contain the key “isError” and its value
must be “false”. For each call that does not have the key and “false” value, we recommend setting up alerts, as the call
most likely was not interpreted. We also recommend logging all calls and the corresponding API response for a 30 days
period.
Every request must have at most 4000 elements. If the call surpasses this limit the call will have a response with key
“isError:true” and “message: Maximum input vars of 4000 exceeded”.
In the event of an documentation error when saving a product, the API will return and “isError:true” message, but the
new offer will be saved and processed.
7
1.5. Rate limiting
Time throttling limit is exceeded Time throttling limit was not reached
Invalid requests will also be limited to a maximum number of 3 requests every 1 minute or 180 requests every 1 hour.
The following callback URLs can be activated from the Marketplace interface:
Context Description
New return & status change You will be notified for each new return request and select status changes (New, Acknowledged & Received)
AWB status change You will be notified for each AWB status change
8
We define an offer as a list of elements required for an offer to be available for a product. These elements are:
Price
VAT rate
Warranty
Numerical stock
Handling_time
Every eMAG product has to be included in a certain category. Sellers cannot create new categories or change existing
ones. Also, a seller can only post products and offers in its allowed categories list.
Reading categories without parameters will generate a response containing the first 100 categories. The read can be
paginated thus obtaining a full list of categories. Only active categories will be returned.
When passing a category id, the API will return the category name and the list of available characteristics and their
corresponding IDs, as well as the available product family_types and their corresponding IDs. Reading categories one by
one is important as it is the only way to identify the restrictive characteristics and corresponding allowed values.
You can read the categories and their characteristics through the API.
The resource is category and the available actions are read and count.
CATEGORY – read
9
is_warranty_mandatory Indicates if adding warranty is Integer is_warranty_mandat
mandatory when saving ory =1
products
1 = mandatory
0 = optional
Multiple values
characteristics:
2 = Numeric + unit of
measure ( ex. 30 cm, 45 m,
20 GB, 30 inch, etc)
11 = Text Fixed (max length
255 chars) (ex. Blue, Green,
Laptop, Notebook, Copil,
Man, Woman)
30 = Resolution ( Width x
Height ) (ex. 100 x 200, 640 x
480)
40 = Volume (Width x Height
x Depth - Depth 2) (ex. 30 x
40 x 50 - 10)
10
automatically validated.
values List the first 256 existing values Array 0 => 'Value 1'
of the current characteristic. 1 => 'Value 2'
When sending an offer, you have to send the VAT rate id by sending us a valid VAT id.
The resource is vat and the action is read. The API will return the list of available VAT rates and their corresponding id’s.
When sending an offer, you have to send the Handling Time by sending us a valid value.
The resource is handling_time and the action is read. The API will return the list of available handling_time values.
Sending a product for the first time requires you to send the entire product documentation and all the offer data. Please
note that creating new products implies human validation, so a new product will not be displayed in eMAG platform
immediately.
The products that are not compliant with eMAG Documentation Standard will not pass the human validation; in this
case you will be notified by our support team. The eMAG Documentation Standard that is available upon request for
each category, and it contains the best practices for documenting a product.
11
In order to send a new product, the resource is product_offer and the available action is save.
category_id Product category eMAG id. Required. Integer between 1 category _id=506
and 65535.
12
PRODUCT OFFER – save and create/update product
13
PRODUCT OFFER – save and create/update product
min_sale_price Seller’s min offer sale price Required on first product min_sale_price=40.6477
without VAT save. Decimal value greater
than 0. Up to four decimals.
max_sale_price Seller’s max offer sale price Required on first product max_sale_price=60.6477
without VAT save. Decimal value greater
than 0. Up to four decimals.
Must be greater than
min_sale_price.
14
PRODUCT OFFER – save and create/update product
vat_id Seller offer VAT rate id. Required. Integer. Ex: vat _id=1
Use /vat/read to display
possible values.
IMPORTANT:
During campaings with stock in site we will not allow the following:
o regular offer updates;
15
o updates sent during campaign time that have a start_date in the future;
o previously scheduled updates with start_date during campaign time.
You can save an offer update with currency_type different from the local Marketplace currency and start_date
before the end of the current month. Any update attempt with a start_date greater than the last day of the
current month will be rejected.
Be aware that prices published directly in the local Marketplace currencies will be overwritten by prices
published in other currencies when these are recalculated and published automatically on FX change at the
beginning of every month. The automated recalculation can be disabled on request.
Min / Max sale price keys are used for price check purposes and are mandatory for all calls used to create
product/offers for the first time. As a best practice we recommend sending these keys only when you want to
change their values.
Sale price will be validated against min_sale_price and max_sale_price. Any offer that is not within the specified
range will be rejected.
In order to change a previously sent product image or attachment the url should be different from the one
already sent. We reload the images only if the URL differs.
We recommend sending the product data only upon product create/update, as there is no need to resend
product unless it changed. Also we recommend sending the offer data upon changing (no matter the frequency)
and at least weekly (even if the offer is the same) rather using periodical sending (crons, agents). You should
program marketing campaigns using “start_date” campaign. Also please offer the possibility for an offer to be
attached to an existing eMAG product (using part_number_key).
In the event of an documentation error when saving a product, the API will return and “isError:true” message,
but the new offer will be saved and processed.
When adding a product to a family
o The category id of a product and the category id of its family type (family_type_id) must be the same.
o All characteristics that define a family must be present and must have a valid value
o All characteristics that define a family must have a single value
o If a family is not valid, you will receive a warning response, but the product will be saved/updated
o When moving a product from one family to another you only have to send the product with its new
family type, id and name and make sure you follow the same rules as above
When updating an existing offer for a product, you should send only the offer, without the documentation. Mandatory
when updating a product offer are the following keys:
id
status
16
sale_price
vat_id
handling_time
stock
Please note that although the API permits sending the entire documentation on each offer update (price change, out-of-
stock change, etc.) we do not recommend or encourage such a practice.
If you need to deactivate a valid offer on the website, you should send the offer with the “status = 0”.
In order to save volume measurements on existing products, the resource is measurements and the available action is
save. The measurement units for volume are millimeters and grams.
MEASUREMENTS – save
id Seller internal product id. This is the Required. Integer value between 1 and id=243409
primary key for identifying a product 16777215.
offer.
length The length of the product in millimeters Required. Decimal value between 0 and 999999. length=100
(mm) Up to two decimals.
width The width of the product in millimeters Required. Decimal value between 0 and 999999. width=122.50
(mm) Up to two decimals.
height The height of the product in millimeters Required. Decimal value between 0 and 999999. height=250
(mm) Up to two decimals.
weight The weight of the product in grams (g) Required. Decimal value between 0 and 999999. weight=1254.50
Up to two decimals.
In order to check the existing products (offers) and their status, the resource is product_offer and the available action
are read and count.
17
PRODUCT_OFFER – read
number_of_offers How many sellers have active offers on this product Integer number_of_offers=3
buy_button_rank The rank of the offer in its race to win the <Add to cart> Integer buy_button_rank=1
button
best_offer_sale_price Best selling price available in eMAG for the same Product Decimal best_offer_sale_price=
51.6477
best_offer_recommend The corresponding recommended price for the offer Decimal best_offer_recommen
ed_price holding the best selling price ded_price=54.6477
product_ranking* The class of product considering its performance across String performance_ranking=
category Hot
Super Hot
Hot
Regular
Cold
Super Cold
id Seller internal product id. This is the primary key for Integer id=243409
identifying a product offer.
recommended_price Seller offer recommended retail price before discount, Decimal recommended_price=
without VAT. 54.6477
18
PRODUCT_OFFER – read
ean Product barcode identifier (EAN -8, EAN-13, UPC-A, UPC- Array ean=Array('ean1',
E, JAN, ISBN-10, ISBN-13, ISSN, ISMN-10, ISMN-13, GTIN- 'ean2')
14).
general_stock The sum of the stock on all seller warehouses. Is Integer general_stock=20
decremented and incremented when orders are
processed.
estimated_stock This key takes into account the reserved stock on Integer estimated_stock=20
unacknowledged orders.
images List of
arrays
handling_time List of
arrays
value Handling time, in number of days counted from the day Integer value=0
the order was received.
19
PRODUCT_OFFER – read
The following filters are available when counting and reading products and offers:
id Displays the details for the corresponding Optional. Integer value between 1 and 4294967295.
ext_id.
status Returns only the offers with this status. Optional. Seller offer status.
1 – status active
0 – status inactive
20
Key Description Constraints
Reading products for which sellers do not have ownership over the documentation will not return the values sent by
sellers but the values that are displayed in the website.
After reading a product, all the elements previously sent are returned, along with the key doc_errors. The key is not null
for products that were rejected due to improper documentation. Below the list of possible errors, when they occur and
the possible actions you need to take.
Product
documetation error list.xlsx
In order to check if a product you sell already exists in eMAG catalog the resource is product_offer and the available
action is match. The matching action is similar to the saving action so you should simply send the entire product
documentation and all the offer data to the product matching resource. Please note that the matching action is available
only for one product at a time therefore the request must be encapsulated in a single array.
You can chose between using PNK (part_number_key) or EAN for attaching offers on existing eMAG products
If the product already exists in eMAG catalog, just add the key “part_number_key” with product’s part_number_key or
the “ean” key with a single EAN.
21
The part_number_key is the last key found in the URL of an eMAG product. It will ALWAYS have both numbers
and characters. Ex: for product http://www.emag.ro/telefon-mobil-nokia-105-black-105-black/pd/D5DD9BBBM/
the part_number_key is D5DD9BBBM.
min_sale_price Seller’s min offer sale price Required on first product min_sale_price=40.6477
without VAT save. Decimal value greater
than 0. Up to four decimals.
max_sale_price Seller’s max offer sale price Required on first product max_sale_price=60.6477
without VAT save. Decimal value greater
than 0. Up to four decimals.
22
PRODUCT OFFER – save and create/update product
vat_id Seller offer VAT rate id. Required. Integer. Ex: vat _id=1
Use /vat/read to display
possible values.
stock warehouse_id The id of the warehouse. Required inside stock array. warehouse_id=1
Use warehouse_id=1 for Integer.
only one warehouse.
stock value Offer available quantity. Required inside stock array. value=20
Integer between 0 and 65535.
23
PRODUCT OFFER – save and create/update product
3. Processing orders
An order consists of customer details, products and discounts from vouchers. It also has information about payment
method, shipping tax. Also, each order always has a status attached. The available statuses are:
0 – canceled
1 – new
2 – in progress
3 – prepared
4 – finalized
5 – returned
The resource is order and the available actions are read, save, count and acknowledge.
status The order processing status. Possible values: Required. Integer status=1
0 - cancelled value between 0
1 - new and 5.
2 - in progress
3 – prepared
4 - finalized
24
Key – level 1 Key – level 2 Description Constraints Example
5 - returned
is_complete A flag indicating if the order is complete (has all Optional. Integer is_complete=1
details necessary for processing) or not. Possible value.
values:
0 - incomplete;
1 - complete.
type A flag indicating if the order contains products Optional. Integer type=3
fulfilled by eMAG or by seller. Possible values: value.
2 – fulfilled by eMAG
3 – fulfilled by seller
payment_mode_id The order payment method. Possible values: Required. Integer. payment_mode_id=1
1 - COD (cash on delivery)
2 - bank transfer
3 - online card payment
delivery_mode The order delivery method. Possible values: Optional. String. delivery_mode=”courier”
“courier” – home delivery
“pickup” – locker delivery
details locker_id The pickup point id, if the locker delivery option Optional. String. locker_id=”dce0b7cf-
was selected by a customer. dc38-11e8-a7d8-
001a4a160153”
locker_name The pickup point name, if the locker delivery Optional. String. locker_name=”easybox
option was selected by a customer. eMAG Showroom”
payment_status The online payment status. Only used for online Required only for payment_status=0
payment methods. Possible values: online payment
0 - not paid methods. Integer.
1 - paid It is highly
recommended to
also interpret the
payment status
when reading
orders with Card
Online payment
method.
cashed_co The cashed amount from Card online payment Optional. Integer.
cashed_cod The cashed amount from cash on delivery payment Optional. Integer.
customer A list with the details about the customer, the Optional. List. The field list is detailed
shipping and the billing addresses. below.
products A list of arrays describing the products in the order. List. The field list is detailed
below.
25
Key – level 1 Key – level 2 Description Constraints Example
attachments A list of arrays describing the attachments in the List. The field list is detailed
order. below (chapter 3.1.3).
is_storno Mandatory key when products are returned for a Optional. Boolean. is_storno=true
finalized order. Further details here. True indicates
partial storno.
cancellation_reason The order cancellation reason. Possible values: Optional. Integer cancellation_reason=1
value between 1
1 - Out of stock and 5.
2 - Cancelled by the client
3 - The client can not be contacted
15 - Courier delivery term is too large
16 - Transport tax, is too large
17 - Large delivery term, until the product will
arrive in our warehouse
18 - Better offer in another store
19 - Payment order has not been paid
20 - Undelivered order, courier reasons
21 - Others
22 - Order Incomplete - automatic cancellation
23 - The customer changed his mind
24 - By customer request
25 - Failed delivery
26 - Late shipment
27 - Irrelevant Order
28 - Canceled by SuperAdmin on seller request
29 - Blacklisted customer
30 - No VAT invoice
31 - The eMAG Marketplace partner requested the
order cancellation
32 - The delivery estimate is too long
33 - The product is no longer available in the stock
of the eMAG Marketplace partner
34 - Other reasons
35 - The delivery is too expensive
36 - The customer found a better price elsewhere
37 - The customer registered another eMAG order
with a similar product
38 - The customer changed his mind, does not
need the product
39 - The customer can purchase the product only
by installments
26
3.1.1. Product field in order details
id eMAG internal order product line id. Any update Required. Integer value id=123
on order product lines must use this id. between 1 and 9999999.
id=243409
product_id Seller internal product id. This is the primary key Optional. Integer. product_id=3331
for identifying a product offer.
status The status of product of the order. Possible Required. Integer. status=1
values:
0 - cancelled
1 - active
part_number Manufacturer unique identifier for the product. Optional. String between 1 and part_number='682133frs'
128 characters.
created The date when the order product line was Optional. Text in YYYY-mm-dd created='2014-07-24 12:16:50'
created. HH:ii:ss format.
modified The date when the order product line was last Optional. Text in YYYY-mm-dd modified='2014-07-24
modified. HH:ii:ss format. 12:18:53'
status The status of product of the order. Possible Required. Integer. status=1
values:
0 - cancelled
1 - active
id The number that uniquely identifies a customer. Optional. Integer value id=1
between 1 and2147483647.
email This is a hash that uniquely identifies the Optional. Text. email=”[email protected]”
27
Key Description Constraints Example
customer’s email.
company The name of the company. For physical person it Optional. Text. company=”Company name
has the same value as name. ltd.”
legal_entity A flag indicating if the customer is physical or Optional. Integer value. legal_entity=1
juridical entity. Possible values:
0 - private entity;
1 - legal entity.
is_vat_payer A flag indicating it the customer is vat payer. Optional. Integer value. is_vat_payer=0
Possible values:
0 - the customer is not vat payer;
1 - the customer is vat payer.
shipping_contact The name of the contact person that will pick up Optional. Text. shipping_contact=”Name
the parcel. Should be printed on the AWB. Surname”
shipping_phone The phone used by the courrier to contact the Optional. Text. shipping_phone=”23125”
shipping person. Should be printed on the AWB.
28
Key Description Constraints Example
billing_locality_id This field uniquely identifies a locality in the Integer value between 1 billing_locality_id=”23”
eMAG database. and 4294967295.
It represents the billing locality.
shipping_locality_id This field uniquely identifies a locality in the Integer value between 1 shipping_locality_id=”23”
eMAG database. and 4294967295.
It represents the shipping locality.
When pushing orders into finalized status, you should also send the invoice PDF file location for the specific order.
The following keys should be sent in attachments array in order to display an invoice in the customer’s order details:
name, url, type.
order_id The number that uniquely identifies an order. Required. Integer value id=939393
between 1 and 4294967295.
name The name of the attachment displayed to the customer (in order Optional. String between 1 name='Invoice
history or in email) and 60 characters title'
type The type of document attached to the order. Possible values are: Integer. Optional. Default type=1
1 - invoice 1=”Invoice”. Only .pdf files
3 - warranty are accepted
4 - user manual
8 - user guide
10 - AWB
11 - proforma
force_downloa Flag used in order to force attachment download restrictions. If value Integer. Optional. Default force_download=0
d is 0 and the attachment URL has not changed, the attachment will not value 0. Possible values: 0,1.
be downloaded again.
29
When a new order is placed in eMAG Marketplace for the first time, it’s status is 1 (new) and a GET request with the
order id is automatically made to an URL you provide (call-back URL). Ex: http://valid_url/path?order_id=123
In the next step, you should read the order passing the id previously mentioned and after successfully saving the order in
your database you should notify us by calling back the API using the route MARKETPLACE _URL/api-
3/order/acknowledge/[orderId]. This stops the order notification system for the mentioned order. Unless acknowledged,
we will notify the new orders for up to 48 hours.
IMPORTANT:
Order acknowledge is the only method of marking the order status as “in progress”.
Clients may ask for an order to be canceled, this will be done by eMAG only if the order was not acknowledged
by the seller, thus some of the orders may be read directly with status 0 (canceled).
New status
1-
Actual status 2 - In progress 3 – Prepared 4 - Finalized 0 - Canceled 5 - Returned
New
Yes by ACK
1 - New No No No No No
only
2 - In progress No Yes Yes Yes Yes No
3 - Prepared No No Yes Yes Yes No
Yes in 48h
4 - Finalized No No Yes Yes in 48h max Yes in RT* + 5 days max
max
Yes in 48h Yes in 48h
0 - Canceled No Yes in 48h max Yes No
max max
5 - Returned No No No No No No
*RT = return time allowed to customers
IMPORTANT:
We recommend setting up a periodical /order/read (cron, agent) that should identify orders that were not
acknowledged. By default on /order/read we expose the last 100 orders, but you can request up to 1000 or use
pagination. Do not forget to test the order status matrix against your internal order workflow. As a best practice
you should either acknowledge the order prior the read or re-read the order after acknowledging it; an order
can be modified by eMAG employees upon the client’s request as long as it is not acknowledged.
You can only edit the order (add/remove products modify quantity or price) when in status 2 (in progress) or 3
(prepared).
Once an order is finalized, you can change its status back to status 3 (prepared) or 0 (canceled) only in the first
48 hours since finalization.
Order status “finalized” will be set automatically when issuing the first AWB for that order. See chapter Saving
AWB’s.
The order status “returned” is set automatically when all the products from the initial invoice are marked as
returned. The change is permitted only within the maximum return timeframe allowed to the customer.
You can read all your orders though the API, using filters. The following are available when counting orders:
30
Key Description Constraints
createdBefore Only the orders created before the specified date. Optional. Text in YYYY-mm-dd HH:ii:ss
Can only be set if “createdAfter” is present. Maximum 1 month format.
difference.
createdAfter Only the orders created after the specified date. Can only be set if Optional. Text in YYYY-mm-dd HH:ii:ss
“createdBefore” is present. Maximum 1 month difference. format.
modifiedBefore Only the orders modified before the specified date. Can only be set if Optional. Text in YYYY-mm-dd HH:ii:ss
“modifiedAfter” is present. Maximum 1 month difference. format.
modifiedAfter Only the orders after before the specified date. Can only be set if Optional. Text in YYYY-mm-dd HH:ii:ss
“modifiedBefore” is present. Maximum 1 month difference. format.
status Only the orders with the specified status. It is a single value or a list of Optional. Integer or list.
values.
payment_mode_ id Only the orders with the specified payment method id. It is a single Optional. Integer or list.
value or a list of values.
is_complete Only the orders with the specified completion status. Optional. Order completion status.
1 – complete orders
0 – incomplete orders
type Only the orders with the specified type Optional. Default value = 3.
2 – fulfilled by eMAG
3 – fulfilled by seller
itemsPerPage The maximum number of orders to return. Optional. Integer value between 1
and 100.
createdBefore Only the orders created before the specified date. Can only be set if Optional. Text in YYYY-mm-dd
“createdAfter” is present. Maximum 1 month difference. HH:ii:ss format.
createdAfter Only the orders created after the specified date. Optional. Text in YYYY-mm-dd
HH:ii:ss format.
modifiedBefore Only the orders modified before the specified date. Can only be set if Optional. Text in YYYY-mm-dd
“modifiedAfter” is present. Maximum 1 month difference. HH:ii:ss format.
modifiedAfter Only the orders after the specified date. Optional. Text in YYYY-mm-dd
HH:ii:ss format.
status Only the orders with the specified status. It is a single value or a list of values. Optional. Integer or list.
31
Key Description Constraints
payment_mode_i Only the orders with the specified payment method id. It is a single value or a Optional. Integer or list.
d list of values.
is_complete Only the orders with the specified completion status. Optional. Order completion status.
1 – complete orders
0 – incomplete orders
type Only the orders with the specified type Optional. Default value = 3.
2 – fulfilled by eMAG
3 – fulfilled by seller
You cannot create new orders through the API, you can only read and update them. When updating an order, the seller
should send ALL the fields initially read.
IMPORTANT:
Updating products by reducing their quantities for orders with Online Card payment method is no longer possible.
Updating product prices is no longer available
A canceled order can no longer be reactivated if more than 48 hours have passed since cancelation
To remove a product from the order send the status=0 for the product or do not send it at all. Products can be removed
from an order only while in status 2 or 3 (in progress or prepared) for orders with payment methods different than
Online card. For returned products (the order is in status 4, finalized), please use the storno route.
IMPORTANT: Removing products for orders with Online Card payment method is no longer possible.
To add a new product to an existing order, add it to the order by sending the product id (mandatory), name, status and
sale price.
IMPORTANT: virtual products such as internal discounts can be inserted in an order, even if they were not previously
sent to eMAG. Adding these products to an order will not make them available for purchase in the eMAG Marketplace
platform.
A finalized order cannot be modified, it can be fully reversed by changing the order status from finalized (4) to returned
(5) or have only some of the products reversed using a call with is_storno key true.
32
The following conditions must be met in order for a partial storno to occur:
Order must be in status 4
At least one product quantity was reduced
The following scenarios can be used as a guideline for returning products (partial storno) from a finalized order:
33
Current order status Request isError Order read
status' => 4, status' => 4, TRUE The request will be discarded, as you are
'products' => 'products' => trying to modify a finalized order without
array ( array ( is_storno key.
0 => 0 =>
array ( array (
'id' => 1, 'id' => 1,
'product_id' => '1', 'product_id' => '1',
'quantity' => 2, 'quantity' => 2,
'sale_price' => '123.4567', 'sale_price' => '123.4567',
'status' => 1, 'status' => 1,
), ),
1 => 1 =>
array ( array (
'id' => 2, 'id' => 2,
'product_id' => '2', 'product_id' => '2',
'quantity' => 2, 'quantity' => 1,
'sale_price' => '123.4567', 'sale_price' => '123.4567',
'status' => 1, 'status' => 1,
), ),
), ),
status' => 4, status' => 4, TRUE The request will be discarded, as you are
'products' => 'products' => sending is_storno key without any change
array ( array ( to an order line
0 => 0 =>
array ( array (
'id' => 1, 'id' => 1,
'product_id' => '1', 'product_id' => '1',
'quantity' => 2, 'quantity' => 2,
'sale_price' => '123.4567', 'sale_price' => '123.4567',
'status' => 1, 'status' => 1,
), ),
1 => 1 =>
array ( array (
'id' => 2, 'id' => 2,
'product_id' => '2', 'product_id' => '2',
'quantity' => 2, 'quantity' => 2,
'sale_price' => '123.4567', 'sale_price' => '123.4567',
'status' => 1, 'status' => 1,
), ),
), ),
'is_storno'=true
34
Current order status Request isError Order read
status' => 3, status' => 3, TRUE The request will be discarded, as you are
'products' => 'products' => sending is_storno key for an order with a
array ( array ( status different than 4
0 => 0 =>
array ( array (
'id' => 1, 'id' => 1,
'product_id' => '1', 'product_id' => '1',
'quantity' => 2, 'quantity' => 2,
'sale_price' => '123.4567', 'sale_price' => '123.4567',
'status' => 1, 'status' => 1,
), ),
1 => 1 =>
array ( array (
'id' => 2, 'id' => 2,
'product_id' => '2', 'product_id' => '2',
'quantity' => 2, 'quantity' => 2,
'sale_price' => '123.4567', 'sale_price' => '123.4567',
'status' => 1, 'status' => 1,
), ),
), ),
'is_storno'=true
status' => 4, status' => 4, TRUE The request will be discarded, as you are
'products' => 'products' => trying to send a negative quantity for a
array ( array ( product
0 => 0 =>
array ( array (
'id' => 1, 'id' => 1,
'product_id' => '1', 'product_id' => '1',
'quantity' => 2, 'quantity' => 2,
'sale_price' => '123.4567', 'sale_price' => '123.4567',
'status' => 1, 'status' => 1,
), ),
1 => 1 =>
array ( array (
'id' => 2, 'id' => 2,
'product_id' => '2', 'product_id' => '2',
'quantity' => 2, 'quantity' => 2,
'sale_price' => '123.4567', 'sale_price' => '123.4567',
'status' => 1, 'status' => 1,
), ),
), 2 =>
array (
'id' => 2,
'product_id' => '2',
'quantity' => -1,
'sale_price' => '123.4567',
'status' => 1,
),
),
'is_storno'=true
4. Shipping orders
For electronic deliveries and downloadable goods, please skip this section. Shipping an eMAG Marketplace order
requires the seller to issue an AWB using eMAG Marketplace API.
35
The resource is AWB and the available actions are read and save
To save an AWB just call the API with the following parameters:
locker_id The pickup point id. Should be filled in with the pickup point id Optional. String value between 3 and 255
received on the order. If filled in, the courier will deliver the parcel characters
in the designated locker.
is_oversize If set to 1, marks the delivery as containing oversized products Required. Value can only be 0 or 1.
weight The weight of delivery Optional. Double value between 0 and 99999
envelope_number Number of envelopes to be delivered Required. Integer value between 0 and 9999. If
parcel_number is 0, this parameter cannot be 0
parcel_number Number of parcels to be delivered Required. Integer value between 0 and 999. If
envelope_number is 0, this parameter cannot
be 0
courier_account_i Unique identifier for seller’s courier account. If not provided, a Optional. Integer.
d default account will be used.
pickup_and_return If set to 1, sender expects something in return to this expedition Optional. Value can only be 0 or 1.
(documents, buy-back products, etc).
saturday_delivery If set to 1, sender requests the package to be delivered on Optional. Value can only be 0 or 1.
Saturday.
sameday_delivery If set to 1, sender requests the package to be delivered the same Optional. Value can only be 0 or 1.
day.
36
Key Description Constraints
contact Receiver's contact person name Required. String value between 1 and 255
phone1 S/R first phone number Required. String value between 8 and 11 digits (only '+' character is allowed at
the beginning of the string)
phone2 S/R second phone number Optional. String value between 8 and 11 digits (only '+' character is allowed at the
beginning of the string)
IMPORTANT:
For orders with “pickup” as a delivery method if you do not change the locker id that is already included in the
“shipping_street” field the AWB will be issued as a locker delivery using the proper courier account regardless of the
actual courier account you specified when issuing the AWB.
reservation_id The eMAG internal AWB reservation id Integer value between 1 and 4294967295.
Must be a valid AWB in eMAG database.
AWB – read
order_id The id of the order on which the AWB was Integer. order_id=243409
issued
37
AWB – read
courier The courier used for issuing the AWB List of arrays.
courier_name The eMAG internal courier name used for String. courier_name="SAMEDAY"
issuing the AWB
38
4.3. Reading AWB PDF files
To download an AWB PDF file call the MARKETPLACE_API_URL/awb URL as in the example below
<html>
Running...<br>
<?
$username = 'user';
$password = 'pass';
$hash = base64_encode($username . ':' . $password);
$headers = array(
'Authorization: Basic ' . $hash
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://marketplace.emag.ro/awb/read_pdf?emag_id=9755945&awb_format=A4';
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
echo $result . "\n";
?>
</html>
Optional: You can set the paper format on PDF download link by using the parameter "awb_format=A4" in the link. The
possible values are A4, A5, A6.
The following method will be released in the near future (H2 2019)
To download an AWB just call the API with the following parameters:
awb_forma The paper format on PDF download The possible values are A4, A5, A6 and ZPL
t
To read an AWB in ZPL type call the MARKETPLACE_API_URL/awb URL as in the example below
<html>
Running...<br>
<?
$username = 'user';
$password = 'pass';
$hash = base64_encode($username . ':' . $password);
$headers = array(
'Authorization: Basic ' . $hash
39
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://marketplace.emag.ro/awb/read_zpl?emag_id=9755945';
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
echo $result . "\n";
?>
</html>
Using this request will return a base64 encoded content of the ZPL format as in the example below
awb/read_zp
http method: POST
l read_zpl response
example.txt
In order to issue an AWB you need to submit the correct locality id. You can also use the id from the order.
The resource is locality and the available actions are read and count.
name All localities with this name String of length between 0 and 60
modified All localities modified after this date Date with the 'Y-m-d H:i:s' format
name All localities with this name String of length between 0 and 60
modified All localities modified after this date Date with the 'Y-m-d H:i:s' format
40
Key Description Constraints
itemsPerPage The maximum number of localities to return. Optional. Integer value between 1 and 100.
currentPage The page offset. Optional. Integer value between 1 and 65535.
modified Last modification date Date with the 'Y-m-d H:i:s' format
In order to issue an AWB you need to submit the correct courier account id.
courier_account_type The type of the Integer. Possible values: 1 - RMA; 2 - Order; 3 - RMA & Order; 4 - Non Marketplace
account
courier_account_properties The courier account Array. Possible values: 1 – Regular; 4 – Locker delivery
properties
41
3 - acknowledged
4 - refused
5 - canceled
6 - received
7 - finalized
The resource is RMA and the available actions are read, save.
42
RMA – read and save/update
pickup_country Required.
Type: Varchar
pickup_suburb Required.
Type: Varchar
pickup_city Required.
Type: Varchar
pickup_address Required.
Type: Varchar
pickup_zipcode Optional.
Type: Varchar
Default value: NULL
43
RMA – read and save/update
44
RMA – read and save/update
45
5.2. Status change permissions
The following matrix defines the return request processing flow in eMAG Marketplace:
New status
Actual status 2 - New 3 - Acknowledged 4 - Rejected 5 - Canceled 6 - Received 7 - Finalized
2 - New Yes Yes No Yes No No
3 - Acknowledged No Yes No Yes Yes No
4 - Rejected No No Yes No No No
5 - Canceled No No No Yes No No
6 - Received No No Yes No Yes Yes
7 - Finalized No No No No No Yes
*Some of the statuses were left out by design; these should not be used in any seller implementation
There are two types of possible deliveries for the return requests:
pick-up requests - courier picks up the returned product(s) from the customer and delivers them to the seller
regular deliveries - courier delivers the returned/replaced product back to the customer
46