---
updatedAt: 2025-03-08T01:43:26.000Z
agentTools:
  projectIndex: https://mealmeapi.readme.io/llms.txt
---

# Create Cart

Use this API to create a cart, by providing a list of products and the fulfillment mode. Upon successful creation, this API will generate a cart ID which can later be retrieved using the [Retrieve Cart API](https://docs.mealme.ai/reference/get_retrieve_cart) and used to place an order using the [Create Order API](https://docs.mealme.ai/reference/post_order_v2).

# OpenAPI definition

````json
{
  "openapi": "3.0.0",
  "paths": {
    "/cart/create": {
      "post": {
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Create_Cart_Output"
                }
              }
            }
          },
          "400": {
            "description": "Input Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error_-_Input_Validation"
                }
              }
            }
          },
          "401": {
            "description": "Missing Authorization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error_-_Unauthorized"
                }
              }
            }
          },
          "422": {
            "description": "Checkout Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Checkout_error"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Too_Many_Requests"
                }
              }
            }
          }
        },
        "summary": "Create Cart",
        "operationId": "post_create_cart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Create_Cart_Input"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "apikey": []
          }
        ],
        "tags": [
          "Cart"
        ]
      }
    }
  },
  "info": {
    "title": "The MealMe API",
    "version": "1.0",
    "description": "# Self-Serve API for out-of-the-box checkout from millions of stores for delivery & pickup.\n## About MealMe\n- Download the MealMe app as a live demonstration of what The Food API can power: https://apps.apple.com/us/app/mealme/id1460140965\n- MealMe was started in 2018. The Food API has powered the MealMe app in 2021 to earn millions in sales, ranking as one of the Top 50 Food & Drink apps for the entire year and getting featured as App of The Day.\n## API Features\n### Search the largest selection of restaurants & grocery stores\n- Our search engine includes the majority of grocery stores & restaurants & convenience stores in the US\n- MealMe's Checkout API aggregates the realtime updates of individual webpages for the most up-to-date information, unlike crowdsourced data APIs like Yelp.\n### Browse real-time restaurant menus & grocery inventory\n- Every menu item & grocery product returned includes real-time ordering availability, prices, and even item customizations and modifiers.\n- This means we have a more detailed, more accurate, and more actionable selection of restaurant menus, grocery inventory, and food products than any other food API in the US.\n\n### Get the cheapest & fastest delivery quotes\n- Our delivery selection in the USA includes dozens of third-party delivery services and courier services as well as over 100,000 stores with their own drivers.\n- This means we have cheaper and faster delivery quotes than any other food API in the US.\n### Order anything\n- Right out of the box, our API allows sending an order to 1M+ stores and 100M+ products for pickup or delivery.\n- This means that we have a larger ordering selection than any other API in the US. \n## API Endpoints\n* **`/restaurants`**: The Restaurant API \n     * **`/search`**: The Restaurant Search API \n         * **`/cart`**: The Restaurant Cart Search API \n         * **`/item`**: The Restaurant Menu Item Search API \n         * **`/store`**: The Restaurant Store Search API \n     * **`/details`**: The Restaurant Details API \n         * **`/item`**: The Restaurant Menu Item API \n         * **`/menu`**: The Restaurant Menu API \n         * **`/quotes`**: The Restaurant Delivery & Pickup API \n* **`/groceries`**: The Grocery API \n     * **`/search`**: The Grocery Search API \n         * **`/cart/v2`**: The Grocery Cart Search API \n         * **`/product/v2`**: The Grocery Product Search API \n         * **`/store`**: The Grocery Store Search API \n     * **`/details`**: The Grocery Details API \n         * **`/product`**: The Grocery Product API \n         * **`/products`**: The Grocery Store Inventory API \n         * **`/quotes`**: The Grocery Delivery & Pickup API \n* **`/order`**: The Food Ordering API \n     * **`/add_payment_method`**: The Add Payment Method API \n     * **`/finalize`**: The Delivery and Pickup Ordering API \n     * **`/order`**: The Delivery and Pickup Ordering API \n* **`/courier`**: The Courier Ordering API \n     * **`/cancel`**: The Courier Order Cancel API \n     * **`/order`**: The Last-Mile Ordering API \n     * **`/quote`**: The Courier Quote API \n* **`/account`**: The Client Account Stats API \n     * **`/billing`**: The Client Account Billing API \n         * **`/fees`**: The Client Account Endpoint Fees API \n         * **`/orders`**: The Client Account Completed Orders API \n     * **`/orders`**: The Client Account Orders Listing API \n     * **`/requests`**: The Client Account Endpoint Requests Listing API \n* **`/customer`**: The Customer Service API \n     * **`/service`**: The Customer Service API \n         * **`/exit_chat`**: The Customer Service Chat Exit API \n         * **`/fetch_chat_ids`**: The Customer Service Chat Fetching API \n         * **`/initiate_chat`**: The Customer Service Initiating Chat API \n         * **`/read_messages`**: The Customer Service Read Chat API \n         * **`/send_message`**: The Customer Service Messaging API \n* **`/location`**: The Location Geocoding API \n     * **`/geocode`**: The Address to Coordinates API \n     * **`/reverse_geocode`**: The Coordinates to Address API \n* **`/places`**: The Places API \n     * **`/search`**: The Places Search API \n     * **`/inventory`**: The Places Inventory API \n     * **`/checkout`**: The Places Checkout API \n* **`/utilities`**: The Utilities API \n     * **`/add_store`**: The Adding Store By Google Place ID API \n     * **`/grocery_store_lookup`**: The Grocery Store Lookup API \n     * **`/restaurant_store_lookup`**: The Restaurant Lookup API \n\n## API Tutorial for Python\nWant a tutorial for another language? Reach out to api@mealme.ai!\n\n### 0. Get your API Key \n- **In this sandbox website**: enter your API Key into the green \"Authorize\" lock button on the right \n- **In your code**: pass the API Key into the `id_token` HTTP Header \n\n### 1. Navigate this sandbox\n1. First, choose to focus on the **Groceries API** or **Restaurants API** (`/groceries` or `/restaurants`) \n2. Try out the **Store Search API** (`/search/store`)\n   - At this point, test that your API Key works!\n   - To get started, try the example San Francisco search query by hitting the \"Try it out\" button then the blue \"Execute\" button.\n3. Take a `quote_id` from a store and pass it into the **Quote API** (`/details/quotes`) or **Menu API** (`/details/menu` or `/details/inventory`) \n\n### 2. Integrate the API with one line of code\nOpen terminal and type these commands to set up your environment. Ensure you already have python3 installed.\n```\npip3 install requests\npython3\nimport requests \n```\nYour terminal is now showing a shell to execute python3 commands. Execute the API request command:\n```\nprint(requests.get(f\"https://mealme-4.mealme.ai/restaurants/search/store?query=pizza&latitude=37.7786357&longitude=-122.3918135\", headers={\"Id-Token\": \"API:KEY\"}).json()) \n```\nBe sure you replaced \"API:KEY\" with your actual API Key! You'll see a JSON of pizza stores nearby.\n\n### 3. Run Sample Project\nThe sample code prints out the first available menu at a pizza store nearby. Download the sample project here: https://drive.google.com/file/d/1pk_fIEYr4Qf0coAphm4UZ975dQVYtTKM/view?usp=sharing \n\n## FAQ \n- Why aren't response times always fast?\n    - The sandbox website is slow to load massive JSON responses, especially for the Search API, so use Postman instead for API requests to speed it up by several seconds. In fact, really big responses get the error \"RangeError: Maximum call stack size exceeded.\"\n    - The sandbox server is much, much less performance-optimized than the production servers.\n- Should I request the `/details/item` or `/details/product` API if customizations were returned from the `/details/menu` or `/details/products` API?\n    - No. Do not call the item or product details endpoint if menu or inventory API returns `should_fetch_customizations: false` in its response.\n        - If the menu or products API returns `should_fetch_customizations: false`, then the product customizations are returned in the menu response.\n    - Even if the \"customizations\" key is empty, that's fine. That means there's no customizations for that item.\n- Why does the blue \"Execute\" button sometimes do nothing when I click it?\n    - This means your input data is invalid, such as an invalid JSON for a POST request.\n\n## API Status Codes \nWe get alerted of anything that's not a 200. If it's urgent, do not hesitate to email api@mealme.ai - we will get back to you ASAP! These are the general guidelines for the API status codes. See individual routes for specific status codes. \n\n`200 OK` - Response to a successful request.\n\n`400 Bad Request` - Malformed request; request body validation errors.\n\n`401 Unauthorized` - When no or invalid authentication details are provided.\n\n`403 Forbidden` - When authentication succeeded but authenticated user doesn't have access to the resource.\n\n`404 Not Found` - When a non-existent endpoint is requested.\n\n`406 Unavailable` -  When a delivery or pickup service or store is unavailable right now.\n\n`422 Unprocessable Entity` - The request was well-formed but was unable to be not acceptable.\n\n`500 Server Error` - The server encountered an unexpected condition which prevented it from completing the request.\n\n`501 Not Implemented` - The HTTP method is not supported by the server and cannot be handled.\n\n`502 Bad Gateway` - The server got an invalid response while working as a gateway to get a response needed to handle the request.\n\n`503 Service Unavailable` - The server is not ready to handle the request.\n\n`504 Gateway Timeout` - The server is acting as a gateway and cannot get a response in time for a request.\n\n"
  },
  "tags": [
    {
      "name": "Cart",
      "description": "Cart API"
    }
  ],
  "servers": [
    {
      "url": "https://api.mealme.ai"
    }
  ],
  "components": {
    "securitySchemes": {
      "apikey": {
        "type": "apiKey",
        "in": "header",
        "name": "Id-Token"
      }
    },
    "schemas": {
      "Error_-_Unauthorized": {
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "The reason authentication failed.",
            "example": "Incorrect API key"
          }
        },
        "type": "object"
      },
      "Error_-_Input_Validation": {
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "The description of the incorrect input value.",
            "example": "Missing/Invalid required input parameter: <parameter>"
          }
        },
        "type": "object"
      },
      "Too_Many_Requests": {
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "The encountered rate limit description.",
            "example": "10 per 1 second(s)!"
          }
        },
        "type": "object"
      },
      "Cart_Item": {
        "required": [
          "product_id"
        ],
        "properties": {
          "product_id": {
            "type": "string",
            "description": "The product's ID."
          },
          "quantity": {
            "type": "integer",
            "description": "The selected quantity (must be greater than 0). If not provided, a quantity of 1 is selected."
          },
          "product_marked_price": {
            "type": "integer",
            "description": "The self-provided marked price (in cents) to be used in the email receipt."
          },
          "selected_options": {
            "type": "array",
            "description": "The list of selected options for the product.",
            "items": {
              "$ref": "#/components/schemas/Selected_Option"
            }
          },
          "notes": {
            "type": "string",
            "description": "The product notes for the store."
          }
        },
        "type": "object"
      },
      "Selected_Option": {
        "required": [
          "option_id",
          "quantity"
        ],
        "properties": {
          "option_id": {
            "type": "string",
            "description": "Option ID"
          },
          "quantity": {
            "type": "integer",
            "description": "The option quantity (must be greater than 0)"
          },
          "marked_price": {
            "type": "integer",
            "description": "The self-provided option marked price (in cents). This will only affect prices shown in the reciept email sent to the customer."
          }
        },
        "type": "object"
      },
      "Email_Receipt_Specifications": {
        "properties": {
          "prices_marked": {
            "type": "boolean",
            "description": "If `true`, the price(s) in the email receipt will reflect the amount(s) specified via the `product_marked_price` and `marked_price` input parameters. If `charge_user` is `true`, the total charged will also reflect these amount(s).",
            "default": false,
            "example": false
          },
          "added_fee": {
            "description": "Your added service fee. Any added fees will be reflected in the email receipt and included in the total charged when `charger_user` is `true`.",
            "allOf": [
              {
                "$ref": "#/components/schemas/Added_Fee"
              }
            ]
          },
          "unify_service_fee": {
            "type": "boolean",
            "description": "Whether to combine the underlying service's service fee and your `added_fee` in one line item in the email receipt.",
            "default": false,
            "example": false
          },
          "misc_fees": {
            "type": "array",
            "description": "List of miscellaneous fees or discounts to display in the email receipt.",
            "example": [
              {
                "fee_name": "Chef tip",
                "fee_amount": 200
              }
            ],
            "items": {
              "$ref": "#/components/schemas/Miscellaneous_Fee"
            }
          },
          "disable_email": {
            "type": "boolean",
            "description": "Whether to send the user an email receipt.",
            "default": false,
            "example": false
          }
        },
        "type": "object"
      },
      "Added_Fee": {
        "properties": {
          "added_fee_flat": {
            "type": "integer",
            "description": "Flat fee added by API client, in cents.",
            "default": 0,
            "example": 100
          },
          "added_fee_percent": {
            "type": "integer",
            "description": "Percent fee added by API client, range [0-100].",
            "default": 0,
            "example": 50
          },
          "is_added_fee_taxable": {
            "type": "boolean",
            "description": "Whether API client added fee is taxable.",
            "example": false
          }
        },
        "type": "object"
      },
      "Miscellaneous_Fee": {
        "required": [
          "fee_amount",
          "fee_name"
        ],
        "properties": {
          "fee_name": {
            "type": "string",
            "description": "Name of the fee"
          },
          "fee_amount": {
            "type": "integer",
            "description": "The fee amount, in cents"
          },
          "fee_percent": {
            "type": "number",
            "description": "The fee percentage, range [0-100]. Applied to the base amount specified by `fee_base`.",
            "default": 0,
            "example": 10.5
          },
          "fee_base": {
            "type": "string",
            "description": "The base amount to apply `fee_percent` to. `subtotal` applies to order subtotal, `total` applies to order total.",
            "default": "subtotal",
            "example": "subtotal",
            "enum": [
              "subtotal",
              "total"
            ]
          }
        },
        "type": "object"
      },
      "Checkout_error": {
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "The reason a checkout error was encountered.",
            "example": "Checkout Error: Does not meet order minimum requirement."
          },
          "invalid_option_ids": {
            "type": "array",
            "description": "The list of invalid option IDs.",
            "example": [
              "n2z3o2ndeC_xNeD918jRVrgI-Oq6vUhuLkgiTnoAIhxWmZhKsqPRqcmz1joT4IvIPh1HnMC01yM070ODKJrE62x95u1IfLF1-89nJiFWkjEqUA6Gq4VKN14-MhZBc_d0gKU5AkrJYGIIpCbfzbK0pOhj3NIEhQHRkQaQr7CtID0UyQp-AxZRCobu80WU3rDACmdCMWHL3K_2ChtpMWS8eoVh_1xvqwUEEDEMio_98vLwamPyehQUTmebfgwz3RtjetNZR2fXIx3OLEUWGXbyzIlY7NGI9D3qD52PyxOSmQYEGf3lsaoXa03CIx8H1f19NrPOuGh2pnbZS-83Mf6DWKmDDjVXvq7JCCamVO1GPYxEeh5Hz9AnZsDJaLXVGGplwMu6zYRhxBMMG8nSu-UFc7UOGrBTBJlVJyC6Q3s-MlW3R8KaUA=="
            ],
            "items": {
              "type": "string",
              "description": "The option ID."
            }
          }
        },
        "type": "object"
      },
      "Create_Cart_Input": {
        "required": [
          "items",
          "pickup",
          "user_id"
        ],
        "properties": {
          "cart_id": {
            "type": "string",
            "description": "The optional ID of an existing cart to update.",
            "default": "",
            "example": "-N8vZEd-UnW_gZu6c4iO"
          },
          "items": {
            "type": "array",
            "description": "List of cart items.",
            "default": [
              {
                "product_id": "gAAAAABjG7vcneDPtykGbsBcLjJUqW8qqJFctTqQDovWuSkEd9VlTM0dNVVKPLcDAMHXhna_dsa-RJOrXBO82jvvMCDXHYCz3Qwv9qEznaqGB2OXKA-k9cWAQFv1S7epy-C5yCDj7MLlDLl1psRTBRtUcv2PUnaYMMnMvonWGbzQbkGr0_0yjtFNS38EosYy-0-l3_0wLfSzQjSPVQ2Go9FUL4Dw_lvLYMkPHnGnewXnh0HtztKYrMn4lZQppC505ReRYfWxMQkMnqq10EbYMYRGDlEkYCNQX8TFtrNeq3ikYpmctjinfqdhs1-AjapHL6wpkyoRoY6rnKE7dBQjIkn_nIQ1aXmznzKpR5P0Xr9xvp5w2IkCWK8_MhHEenGct1y7n3yGteXzQM4o5Md1yynTwRal7Bq4QoVt-EzyLoW-ZtX8-snYWnDpNLduZLW7j3XCo8EIEBlKUSWkvNl0gbQgyosKgZB573GNQ-rEu3RYvJ_S_Ri62ywBYf_zTexUJtERtIpd6lawr6sty3Wpyq1zhve2zuhsRJ8wj_uorThApJreOXRiOpzyFXTZWxjXz3EklKoqPjUCVllMjVkVQUYkUghVvfr9dO7GWhkqGsRkRHjGxX7coYlI3GaVEQdaIcVrAo2zJBOJt42j5xwgOz0Gw2oupiwQwYtWpUVnYX0JHssDlbmbDON8ddU7YJdGxhC3TOFAGXLIzCPbRifamoEu2np7wbNQ8pDB5tX07lwVQIbrVs0thXYpdGxKk1eKx_c1aKQcf-srjZKHVUvO_4zSRC2FqIpdaYPU0pDDlIovXu6NgoB7CL0=",
                "notes": "No whipped cream."
              }
            ],
            "example": [
              {
                "product_id": "gAAAAABjG7vcneDPtykGbsBcLjJUqW8qqJFctTqQDovWuSkEd9VlTM0dNVVKPLcDAMHXhna_dsa-RJOrXBO82jvvMCDXHYCz3Qwv9qEznaqGB2OXKA-k9cWAQFv1S7epy-C5yCDj7MLlDLl1psRTBRtUcv2PUnaYMMnMvonWGbzQbkGr0_0yjtFNS38EosYy-0-l3_0wLfSzQjSPVQ2Go9FUL4Dw_lvLYMkPHnGnewXnh0HtztKYrMn4lZQppC505ReRYfWxMQkMnqq10EbYMYRGDlEkYCNQX8TFtrNeq3ikYpmctjinfqdhs1-AjapHL6wpkyoRoY6rnKE7dBQjIkn_nIQ1aXmznzKpR5P0Xr9xvp5w2IkCWK8_MhHEenGct1y7n3yGteXzQM4o5Md1yynTwRal7Bq4QoVt-EzyLoW-ZtX8-snYWnDpNLduZLW7j3XCo8EIEBlKUSWkvNl0gbQgyosKgZB573GNQ-rEu3RYvJ_S_Ri62ywBYf_zTexUJtERtIpd6lawr6sty3Wpyq1zhve2zuhsRJ8wj_uorThApJreOXRiOpzyFXTZWxjXz3EklKoqPjUCVllMjVkVQUYkUghVvfr9dO7GWhkqGsRkRHjGxX7coYlI3GaVEQdaIcVrAo2zJBOJt42j5xwgOz0Gw2oupiwQwYtWpUVnYX0JHssDlbmbDON8ddU7YJdGxhC3TOFAGXLIzCPbRifamoEu2np7wbNQ8pDB5tX07lwVQIbrVs0thXYpdGxKk1eKx_c1aKQcf-srjZKHVUvO_4zSRC2FqIpdaYPU0pDDlIovXu6NgoB7CL0=",
                "notes": "No whipped cream."
              }
            ],
            "items": {
              "$ref": "#/components/schemas/Cart_Item"
            }
          },
          "pickup": {
            "type": "boolean",
            "description": "Whether to the order fulfillment type is pickup or delivery.",
            "default": false,
            "example": false
          },
          "driver_tip_cents": {
            "type": "integer",
            "description": "The tip for the driver, in cents.",
            "default": 100,
            "example": 100
          },
          "user_latitude": {
            "type": "number",
            "description": "The latitude of the user.",
            "default": 37.7786357,
            "example": 37.7786357
          },
          "user_longitude": {
            "type": "number",
            "description": "The longitude of the user.",
            "default": -122.3918135,
            "example": -122.3918135
          },
          "user_street_num": {
            "type": "string",
            "description": "Street number of the user.",
            "default": "188",
            "example": "188"
          },
          "user_street_name": {
            "type": "string",
            "description": "Street name of the user.",
            "default": "King Street",
            "example": "King Street"
          },
          "user_apt_num": {
            "type": "string",
            "description": "Apartment number of the user",
            "example": "108"
          },
          "user_city": {
            "type": "string",
            "description": "City of the user.",
            "default": "San Francisco",
            "example": "San Francisco"
          },
          "user_state": {
            "type": "string",
            "description": "State of the user.",
            "default": "CA",
            "example": "CA"
          },
          "user_country": {
            "type": "string",
            "description": "Country of the user. Can be `US` or `CA`.",
            "default": "US",
            "example": "US"
          },
          "user_zipcode": {
            "type": "string",
            "description": "Zipcode of the user.",
            "default": "94107",
            "example": "94107"
          },
          "user_dropoff_notes": {
            "type": "string",
            "description": "Dropoff delivery notes for the user.",
            "default": "Leave in lobby",
            "example": "Leave in lobby"
          },
          "user_name": {
            "type": "string",
            "description": "User's name, so the store and/or driver know who to give the food to at dropoff.",
            "default": "Steve Jobs",
            "example": "Steve Jobs"
          },
          "user_email": {
            "type": "string",
            "description": "User's email, for the order confirmation, updates, and tracking link.",
            "default": "steve@apple.com",
            "example": "steve@apple.com"
          },
          "user_phone": {
            "type": "integer",
            "description": "User's phone number, so the store and/or driver know who to call for pickup or delivery. Must include country code.",
            "default": 14044442058,
            "example": 14044442058
          },
          "user_id": {
            "type": "string",
            "description": "Unique User ID for the API customer's platform.",
            "default": "7B36A9CF",
            "example": "7B36A9CF"
          },
          "disable_sms": {
            "type": "boolean",
            "description": "Whether to send the user order status updates via SMS.",
            "default": false,
            "example": false
          },
          "email_receipt_specifications": {
            "description": "Set of optional configurations used to modify email reciept",
            "allOf": [
              {
                "$ref": "#/components/schemas/Email_Receipt_Specifications"
              }
            ]
          },
          "customer_order_id": {
            "type": "string",
            "description": "The self provided order id to attach to this order. This will be returned in the response from [Get Orders](https://docs.mealme.ai/reference/get_account_orders) when looking up an order.",
            "example": "ABC123"
          },
          "autofill_selected_options": {
            "type": "boolean",
            "description": "Whether to automatically select the default quantity for all options and fulfill all customization requirements.",
            "default": false,
            "example": false
          }
        },
        "type": "object"
      },
      "Create_Cart_Output": {
        "required": [
          "cart_id"
        ],
        "properties": {
          "cart_id": {
            "type": "string",
            "description": "The ID of the newly created cart",
            "example": "-N8vZEd-UnW_gZu6c4iO"
          }
        },
        "type": "object"
      }
    }
  }
}
````