E-commerce API
E-commerce Import API
Bulk-import shop data — customers, products, categories, and orders — into MailerLite in a single request.
You can bulk import categories, products and orders to the platform.
Categories import
If you want to import multiple categories for the given shop, send this POST request
POST https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/importRequest body
| Parameter | Type | Required | Limitations |
|---|---|---|---|
| shop_id | integer | yes | Must provide valid shop id |
[
{
"name": "Category 1",
"exclude_from_automations": false
},
{
"name": "Category 2",
"exclude_from_automations": false
}
]Response
If the categories were created:
Response Code: 200 OK{
"data": [
{
"id": 46919150796276752,
"name": "Category 1",
"exclude_from_automations": false,
"created_at": "2022-02-13T09:46:29.000000Z",
"updated_at": "2022-02-13T09:46:29.000000Z"
},
{
"id": 46919150798373905,
"name": "Category 2",
"exclude_from_automations": false,
"created_at": "2022-02-13T09:46:29.000000Z",
"updated_at": "2022-02-13T09:46:29.000000Z"
}
]
}Error
Response Code: 422 Unprocessable EntityThe error response will contain information about the invalid data.
{
"message": "The given data was invalid.",
"errors": {
"0.name": ["The name field is required."]
}
}Products import
If you want to import products for the given shop, use this POST request
POST https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/products/importRequest body
| Parameter | Type | Required | Limitations |
|---|---|---|---|
| shop_id | integer | yes | Must provide valid shop id |
[
{
"name": "Product name",
"price": 123.40,
"url": "https://shop-url.com/product-name",
"image": "https://shop-url.com/product-image.jpg",
"exclude_from_automations": false,
"categories": [
46919150796276752,
46919150798373905
]
},
{
"name": "Product 2 name",
"price": 123.40,
"url": "https://shop-url.com/product-name",
"image": "https://shop-url.com/product-image.jpg",
"exclude_from_automations": false,
"categories": [
46919150796276752,
46919150798373905
]
}
]Response
If the products were created:
Response Code: 200 OK{
"data": [
{
"id": 46920297804203043,
"name": "Product name",
"price": 123.4,
"url": null,
"image": null,
"exclude_from_automations": false,
"categories": [
{
"id": 46919150796276752,
"name": "Category 1",
"exclude_from_automations": false,
"created_at": "2022-02-13T09:46:29.000000Z",
"updated_at": "2022-02-13T09:46:29.000000Z"
},
{
"id": 46919150798373905,
"name": "Category 2",
"exclude_from_automations": false,
"created_at": "2022-02-13T09:46:29.000000Z",
"updated_at": "2022-02-13T09:46:29.000000Z"
}
]
},
{
"id": 46920297809445924,
"name": "Product 2 name",
"price": 123.4,
"url": null,
"image": null,
"exclude_from_automations": false,
"categories": [
{
"id": 46919150796276752,
"name": "Category 1",
"exclude_from_automations": false,
"created_at": "2022-02-13T09:46:29.000000Z",
"updated_at": "2022-02-13T09:46:29.000000Z"
},
{
"id": 46919150798373905,
"name": "Category 2",
"exclude_from_automations": false,
"created_at": "2022-02-13T09:46:29.000000Z",
"updated_at": "2022-02-13T09:46:29.000000Z"
}
]
}
]
}Error
Response Code: 422 Unprocessable EntityThe error response will contain information about the invalid data.
{
"message": "The given data was invalid.",
"errors": {
"0.name": ["The name field is required."]
}
}Orders import
If you want to import orders including customers, carts and cart items for the given shop, send this POST request
POST https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/orders/importRequest body
| Parameter | Type | Required | Limitations |
|---|---|---|---|
| shop_id | integer | yes | Must provide valid shop id |
[
{
"customer": {
"email": "customer@email.com",
"create_subscriber": true,
"accepts_marketing": true
},
"cart": {
"items": [
{
"ecommerce_product_id": "46920297804203043",
"variant": "product variant",
"quantity": 1,
"price": 123.40
}
]
},
"status": "pending",
"total_price": 123.40
},
{
"customer": {
"email": "customer2@email.com",
"create_subscriber": true,
"accepts_marketing": true
},
"cart": {
"items": [
{
"ecommerce_product_id": "46920297804203043",
"variant": "product variant",
"quantity": 1,
"price": 123.40
}
]
},
"status": "pending",
"total_price": 123.40
}
]Response
If the orders were created:
Response Code: 200 OK{
"data": [
{
"id": 46920756608631854,
"customer": {
"id": 46920756260504617,
"email": "customer@email.com",
"accepts_marketing": true,
"subscriber": {
"id": "46920756366410794",
"email": "customer@email.com",
"status": "active",
"source": "manual",
"sent": 0,
"opens_count": 0,
"clicks_count": 0,
"open_rate": 0,
"click_rate": 0,
"ip_address": null,
"subscribed_at": "2022-02-13 10:12:00",
"unsubscribed_at": null,
"created_at": "2022-02-13 10:12:00",
"updated_at": "2022-02-13 10:12:00",
"opted_in_at": null,
"optin_ip": null
}
},
"cart": {
"id": 46920756586611756,
"checkout_url": null,
"cart_total": "0",
"items": [
{
"id": 46920756598146093,
"product": {
"id": 46920297804203043,
"name": "Product name",
"price": "123.4",
"url": null,
"image": null,
"exclude_from_automations": false,
"categories": [
{
"id": 46919150796276752,
"name": "Category 1",
"exclude_from_automations": false,
"created_at": "2022-02-13T09:46:29.000000Z",
"updated_at": "2022-02-13T09:46:29.000000Z"
},
{
"id": 46919150798373905,
"name": "Category 2",
"exclude_from_automations": false,
"created_at": "2022-02-13T09:46:29.000000Z",
"updated_at": "2022-02-13T09:46:29.000000Z"
}
]
},
"variant": "product variant",
"quantity": 1,
"price": "123.4"
}
]
},
"total": 123.4,
"status": "pending",
"created_at": "2022-02-13T10:12:00.000000Z",
"updated_at": "2022-02-13T10:12:00.000000Z"
},
{
"id": 46920756705100851,
"customer": {
"id": 46920756614923311,
"email": "customer2@email.com",
"accepts_marketing": true,
"subscriber": {
"id": "46920756639040560",
"email": "customer2@email.com",
"status": "active",
"source": "manual",
"sent": 0,
"opens_count": 0,
"clicks_count": 0,
"open_rate": 0,
"click_rate": 0,
"ip_address": null,
"subscribed_at": "2022-02-13 10:12:00",
"unsubscribed_at": null,
"created_at": "2022-02-13 10:12:00",
"updated_at": "2022-02-13 10:12:00",
"opted_in_at": null,
"optin_ip": null
}
},
"cart": {
"id": 46920756693566513,
"checkout_url": null,
"cart_total": "0",
"items": [
{
"id": 46920756700906546,
"product": {
"id": 46920297804203043,
"name": "Product name",
"price": "123.4",
"url": null,
"image": null,
"exclude_from_automations": false,
"categories": [
{
"id": 46919150796276752,
"name": "Category 1",
"exclude_from_automations": false,
"created_at": "2022-02-13T09:46:29.000000Z",
"updated_at": "2022-02-13T09:46:29.000000Z"
},
{
"id": 46919150798373905,
"name": "Category 2",
"exclude_from_automations": false,
"created_at": "2022-02-13T09:46:29.000000Z",
"updated_at": "2022-02-13T09:46:29.000000Z"
}
]
},
"variant": "product variant",
"quantity": 1,
"price": "123.4"
}
]
},
"total": 123.4,
"status": "pending",
"created_at": "2022-02-13T10:12:00.000000Z",
"updated_at": "2022-02-13T10:12:00.000000Z"
}
]
}Error
Response Code: 422 Unprocessable EntityThe error response will contain information about the invalid data.
{
"message": "The given data was invalid.",
"errors": {
"0.customer": ["The 0.customer field is required."]
}
}