> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://mailchimp.com/developer/marketing/api/ecommerce/create-store-order-line/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://mailchimp.com/_mcp/server. # Add order line item POST https://api.mailchimp.com/3.0/ecommerce/stores/{store_id}/orders/{order_id}/lines Content-Type: application/json Add a new line item to an existing order. Reference: https://mailchimp.com/developer/marketing/api/ecommerce/create-store-order-line ## Authentication - `Authorization` header (bearer token, required) — Authorization using a Mailchimp API key (a.k.a. Bearer token) - `Authorization` header (bearer token, required) — Authorization using OAuth ## Request ### Path parameters - `store_id` (string, required) — The store id. - `order_id` (string, required) — The id for the order in a store. ### Body (application/json) This endpoint expects an object. - `id` (string, required) — A unique identifier for the order line item. - `price` (30EcommerceStoresStoreIdOrdersOrderIdLinesPostRequestBodyContentApplicationJsonSchemaPrice, required) - `product_id` (string, required) — A unique identifier for the product associated with the order line item. - `product_variant_id` (string, required) — A unique identifier for the product variant associated with the order line item. - `quantity` (integer, required) — The quantity of an order line item. - `discount` (30EcommerceStoresStoreIdOrdersOrderIdLinesPostRequestBodyContentApplicationJsonSchemaDiscount, optional) - `product` (EcommerceStoresOrdersPost, optional) — Information about a specific product. ## Response ### 200 - `_links` (list of ECommerceOrderLineItemLinksItems, optional) — A list of link types and descriptions for the API schema documents. - `discount` (double, optional) — The total discount amount applied to a line item. - `id` (string, optional) — A unique identifier for an order line item. - `image_url` (string, optional) — The image URL for a product. - `price` (ECommerceOrderLineItemPrice, optional) - `product_id` (string, optional) — A unique identifier for the product associated with an order line item. - `product_title` (string, optional) — The name of the product for an order line item. - `product_variant_id` (string, optional) — A unique identifier for the product variant associated with an order line item. - `product_variant_title` (string, optional) — The name of the product variant for an order line item. - `quantity` (integer, optional) — The order line item quantity. ## Types ### 30EcommerceStoresStoreIdOrdersOrderIdLinesPostRequestBodyContentApplicationJsonSchemaPrice ### 30EcommerceStoresStoreIdOrdersOrderIdLinesPostRequestBodyContentApplicationJsonSchemaDiscount ### EcommerceStoresOrdersPost Information about a specific product. - `id` (EcommerceStoresOrdersPostId, required) — A unique identifier for the product. - `title` (string, required) — The title of a product. - `variants` (list of EcommerceStoresOrdersPostVariantsItems, required) — An array of the product's variants. At least one variant is required for each product. A variant can use the same `id` and `title` as the parent product. - `description` (string, optional) — The description of a product. - `handle` (string, optional) — The handle of a product. - `image_url` (string, optional) — The image URL for a product. - `images` (list of EcommerceStoresOrdersPostImagesItems, optional) — An array of the product's images. - `published_at_foreign` (string, optional) — The date and time the product was published. - `type` (string, optional) — The type of product. - `url` (string, optional) — The URL for a product. - `vendor` (string, optional) — The vendor for a product. ### ECommerceOrderLineItemLinksItems This object represents a link from the resource where it is found to another resource or action that may be performed. - `href` (string, optional) — This property contains a fully-qualified URL that can be called to retrieve the linked resource or perform the linked action. - `method` (enum, optional) — The HTTP method that should be used when accessing the URL defined in 'href'. - Allowed values: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `HEAD` - `rel` (string, optional) — As with an HTML 'rel' attribute, this describes the type of link. - `schema` (string, optional) — For HTTP methods that can receive bodies (POST and PUT), this is a URL representing the schema that the body should conform to. - `targetSchema` (string, optional) — For GETs, this is a URL representing the schema that the response should conform to. ### ECommerceOrderLineItemPrice ### EcommerceStoresOrdersPostId A unique identifier for the product. ### EcommerceStoresOrdersPostVariantsItems Information about a specific product variant. - `id` (EcommerceStoresOrdersPostVariantsItemsId, required) — A unique identifier for the product variant. - `title` (string, required) — The title of a product variant. - `backorders` (string, optional) — The backorders of a product variant. - `image_url` (string, optional) — The image URL for a product variant. - `inventory_quantity` (integer, optional) — The inventory quantity of a product variant. - `price` (EcommerceStoresOrdersPostVariantsItemsPrice, optional) - `sku` (string, optional) — The stock keeping unit (SKU) of a product variant. - `url` (string, optional) — The URL for a product variant. - `visibility` (string, optional) — The visibility of a product variant. ### EcommerceStoresOrdersPostImagesItems Information about a specific product image. - `id` (string, required) — A unique identifier for the product image. - `url` (string, required) — The URL for a product image. - `variant_ids` (list of EcommerceStoresOrdersPostImagesItemsVariantIdsItems, optional) — The list of product variants using the image. ### EcommerceStoresOrdersPostVariantsItemsId A unique identifier for the product variant. ### EcommerceStoresOrdersPostVariantsItemsPrice ### EcommerceStoresOrdersPostImagesItemsVariantIdsItems ## Examples **Request** ```json { "id": "string", "price": 1.1, "product_id": "string", "product_variant_id": "string", "quantity": 1 } ``` **Response** ```json { "_links": [ { "href": "string", "method": "GET", "rel": "string", "schema": "string", "targetSchema": "string" } ], "discount": 1.1, "id": "string", "image_url": "string", "price": 1.1, "product_id": "string", "product_title": "string", "product_variant_id": "string", "product_variant_title": "string", "quantity": 1 } ``` **SDK Code** ```python import requests url = "https://api.mailchimp.com/3.0/ecommerce/stores/store_id/orders/order_id/lines" payload = { "id": "string", "price": 1.1, "product_id": "string", "product_variant_id": "string", "quantity": 1 } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.mailchimp.com/3.0/ecommerce/stores/store_id/orders/order_id/lines'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"id":"string","price":1.1,"product_id":"string","product_variant_id":"string","quantity":1}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.mailchimp.com/3.0/ecommerce/stores/store_id/orders/order_id/lines" payload := strings.NewReader("{\n \"id\": \"string\",\n \"price\": 1.1,\n \"product_id\": \"string\",\n \"product_variant_id\": \"string\",\n \"quantity\": 1\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.mailchimp.com/3.0/ecommerce/stores/store_id/orders/order_id/lines") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"id\": \"string\",\n \"price\": 1.1,\n \"product_id\": \"string\",\n \"product_variant_id\": \"string\",\n \"quantity\": 1\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.mailchimp.com/3.0/ecommerce/stores/store_id/orders/order_id/lines") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"id\": \"string\",\n \"price\": 1.1,\n \"product_id\": \"string\",\n \"product_variant_id\": \"string\",\n \"quantity\": 1\n}") .asString(); ``` ```php request('POST', 'https://api.mailchimp.com/3.0/ecommerce/stores/store_id/orders/order_id/lines', [ 'body' => '{ "id": "string", "price": 1.1, "product_id": "string", "product_variant_id": "string", "quantity": 1 }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.mailchimp.com/3.0/ecommerce/stores/store_id/orders/order_id/lines"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"id\": \"string\",\n \"price\": 1.1,\n \"product_id\": \"string\",\n \"product_variant_id\": \"string\",\n \"quantity\": 1\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "id": "string", "price": 1.1, "product_id": "string", "product_variant_id": "string", "quantity": 1 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.mailchimp.com/3.0/ecommerce/stores/store_id/orders/order_id/lines")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` > Find all the Mailchimp API documentation and tools developers need to send marketing and transactional emails.