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, customers 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."]
}
}Customers import
If you want to import multiple customers for the given shop, send this POST request
POST https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/customers/importRequest body
| Parameter | Type | Required | Limitations |
|---|---|---|---|
| shop_id | integer | yes | Must provide valid shop id |
[
{
"email": "customer@email.com",
"resource_id": "1001",
"accepts_marketing": true,
"create_subscriber": true,
"total_spent": 149.99,
"orders_count": 3
},
{
"email": "customer2@email.com",
"resource_id": "1002",
"accepts_marketing": false,
"create_subscriber": false
}
]Response
Customers are saved in the background, so the response returns the accepted data.
Response Code: 200 OK{
"data": [
{
"resource_id": "1001",
"email": "customer@email.com",
"accepts_marketing": true,
"create_subscriber": true
},
{
"resource_id": "1002",
"email": "customer2@email.com",
"accepts_marketing": false,
"create_subscriber": false
}
]
}Error
Response Code: 422 Unprocessable EntityThe error response will contain information about the invalid data.
{
"message": "The given data was invalid.",
"errors": {
"0.email": ["The 0.email field is required."]
}
}Response Code: 413 Request Entity Too LargeReturned when the customers would exceed the account's subscriber limit.
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,
"enabled": true,
"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,
"enabled": true,
"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 |
| orders | array | yes | The orders to import |
{
"orders": [
{
"customer": {
"email": "customer@email.com",
"create_subscriber": true,
"accepts_marketing": true,
"name": "Dummy",
"last_name": "Testerson"
},
"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
}
]
}Each order's customer object takes the same fields as Create/update customer, including the optional name and last_name (strings, max 255 characters). They are saved to the subscriber's Name and Last name fields. An empty or null value leaves the existing value unchanged. If a name is invalid, the validation error is reported under orders.N.customer.
Instead of a customer object, you can send customer_id, the MailerLite ID of an existing customer in this shop. Each order needs either customer or customer_id.
Response
If the orders were created:
Response Code: 200 OK{
"data": [
{
"id": 46920756608631854,
"customer": {
"id": 46920756260504617,
"email": "customer@email.com",
"accepts_marketing": true,
"total_spent": null,
"orders_count": null,
"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,
"resource_id": null,
"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,
"enabled": true,
"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",
"attribution": null,
"created_at": "2022-02-13T10:12:00.000000Z",
"updated_at": "2022-02-13T10:12:00.000000Z",
"completed_at": null
},
{
"id": 46920756705100851,
"customer": {
"id": 46920756614923311,
"email": "customer2@email.com",
"accepts_marketing": true,
"total_spent": null,
"orders_count": null,
"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,
"resource_id": null,
"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,
"enabled": true,
"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",
"attribution": null,
"created_at": "2022-02-13T10:12:00.000000Z",
"updated_at": "2022-02-13T10:12:00.000000Z",
"completed_at": null
}
]
}Error
Response Code: 422 Unprocessable EntityThe error response will contain information about the invalid data.
{
"message": "The given data was invalid.",
"errors": {
"orders.0.cart": ["The orders.0.cart field is required."],
"orders.0.cart.items": ["The orders.0.cart.items field is required."]
}
}