{
  "openapi": "3.1.0",
  "info": {
    "title": "MealMe Restaurant & Grocery Ordering API",
    "version": "2.0.0",
    "description": "Search restaurants and groceries and place pickup or delivery orders through Grubhub. API calls are free until the first provider-confirmed order, including its submission. No card is needed for discovery, and pre-order calls never accrue fees. Fund the full food total before ordering with prepaid credits from $5. Buying credits does not start metering. After the first confirmed order, successful billable calls cost $0.10 from credits. Account, canonical quote reads, address suggestions, order status and support are unmetered. Monetary values use USD cents. Existing legacy endpoints retain their billing terms."
  },
  "servers": [
    {
      "url": "https://mealmeai.vercel.app",
      "description": "Production"
    },
    {
      "url": "https://mealmeai-test.vercel.app",
      "description": "Development: Stripe test funding, owner-approved real checkout only"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/api/v2/addresses/suggest": {
      "get": {
        "operationId": "suggestAddresses",
        "summary": "Free address suggestions",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "suggestions": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient prepaid credits for a food order or for billable calls after the first confirmed order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Expired quote, conflicting key, or pending outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/restaurants/search": {
      "get": {
        "operationId": "searchStores",
        "summary": "Search restaurant and grocery locations through Grubhub (free until first order, then $0.10 on success)",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "query",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fulfillment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "delivery",
                "pickup"
              ],
              "default": "delivery"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 12
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "service": {
                          "$ref": "#/components/schemas/Service"
                        },
                        "location": {
                          "type": "object",
                          "properties": {
                            "latitude": {
                              "type": "number"
                            },
                            "longitude": {
                              "type": "number"
                            }
                          }
                        },
                        "restaurants": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Store"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient prepaid credits for a food order or for billable calls after the first confirmed order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Expired quote, conflicting key, or pending outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/restaurants/{restaurantId}/menu": {
      "get": {
        "operationId": "getMenu",
        "summary": "Live menu and required item options (free until first order, then $0.10 on success)",
        "parameters": [
          {
            "name": "restaurantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "latitude",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "longitude",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "zipCode",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fulfillment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "delivery",
                "pickup"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "service": {
                          "$ref": "#/components/schemas/Service"
                        },
                        "restaurantId": {
                          "type": "string"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/MenuItem"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient prepaid credits for a food order or for billable calls after the first confirmed order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Expired quote, conflicting key, or pending outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/orders/quote": {
      "post": {
        "operationId": "quoteOrder",
        "summary": "Final checkout quote (free until first order, then $0.10 on success)",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Quote"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient prepaid credits for a food order or for billable calls after the first confirmed order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Expired quote, conflicting key, or pending outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/quotes/{quoteId}": {
      "get": {
        "operationId": "getQuote",
        "summary": "Read your quote and ownership details (free)",
        "parameters": [
          {
            "name": "quoteId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Quote"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient prepaid credits for a food order or for billable calls after the first confirmed order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Expired quote, conflicting key, or pending outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/orders": {
      "post": {
        "operationId": "placeOrder",
        "summary": "Place a real Grubhub order (prepaid food; first order API fee $0, then $0.10); reconcile unknown outcomes",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 160
            },
            "description": "Persist and reuse this key for the same order; a timeout does not mean failure."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quoteId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "confirmRealOrder": {
                    "type": "boolean",
                    "const": true
                  },
                  "maxTotalCents": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5000
                  }
                },
                "required": [
                  "quoteId",
                  "confirmRealOrder",
                  "maxTotalCents"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient prepaid credits for a food order or for billable calls after the first confirmed order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Expired quote, conflicting key, or pending outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/orders/{orderId}": {
      "get": {
        "operationId": "getOrder",
        "summary": "Order status, hosted tracking, support details and cumulative refunds (free)",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient prepaid credits for a food order or for billable calls after the first confirmed order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Expired quote, conflicting key, or pending outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/account": {
      "get": {
        "operationId": "getAccount",
        "summary": "Workspace, masked card, billing stage and available balance (free)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "workspace": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid"
                            }
                          }
                        },
                        "balanceCents": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "currency": {
                          "type": "string",
                          "enum": [
                            "usd"
                          ]
                        },
                        "apiCallCents": {
                          "type": "integer",
                          "enum": [
                            0,
                            10
                          ],
                          "description": "Current billable-call price. Zero until the first confirmed order."
                        },
                        "environment": {
                          "type": "string",
                          "enum": [
                            "live",
                            "test_payments"
                          ]
                        },
                        "billing": {
                          "type": "object",
                          "properties": {
                            "stage": {
                              "type": "string",
                              "enum": [
                                "add_card",
                                "first_order",
                                "ordering",
                                "topup_required",
                                "prepaid"
                              ]
                            },
                            "card": {
                              "type": [
                                "object",
                                "null"
                              ],
                              "properties": {
                                "brand": {
                                  "type": "string"
                                },
                                "last4": {
                                  "type": "string"
                                }
                              }
                            },
                            "firstOrderUsageCents": {
                              "type": "integer",
                              "const": 0,
                              "description": "Deprecated compatibility field; pre-order API calls never accrue fees."
                            },
                            "apiCallsFree": {
                              "type": "boolean",
                              "description": "True until the first provider-confirmed order; top-ups do not change it."
                            },
                            "apiCallPriceCents": {
                              "type": "integer",
                              "enum": [
                                0,
                                10
                              ]
                            },
                            "orderApiFeeCents": {
                              "type": "integer",
                              "enum": [
                                0,
                                10
                              ]
                            },
                            "firstOrderAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient prepaid credits for a food order or for billable calls after the first confirmed order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Expired quote, conflicting key, or pending outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/embedded/sessions": {
      "post": {
        "operationId": "createOrderingSession",
        "summary": "Create a scoped browser ordering session (free)",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "externalCustomerId": {
                    "type": "string"
                  },
                  "allowedOrigin": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [
                  "externalCustomerId",
                  "allowedOrigin"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sessionId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient prepaid credits for a food order or for billable calls after the first confirmed order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Expired quote, conflicting key, or pending outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/embedded/checkout": {
      "post": {
        "operationId": "authorizeCheckout",
        "summary": "Approve the exact customer basket after your own payment authorization (free)",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sessionUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "quoteId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "maxTotalCents": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5000
                  }
                },
                "required": [
                  "sessionUrl",
                  "quoteId",
                  "maxTotalCents"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "checkoutToken": {
                          "type": "string"
                        },
                        "idempotencyKey": {
                          "type": "string"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient prepaid credits for a food order or for billable calls after the first confirmed order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Expired quote, conflicting key, or pending outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/orders/{orderId}/support": {
      "get": {
        "operationId": "getOrderSupport",
        "summary": "Read order support cases (free)",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "orderId": {
                          "type": "string"
                        },
                        "cases": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient prepaid credits for a food order or for billable calls after the first confirmed order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Expired quote, conflicting key, or pending outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "requestOrderSupport",
        "summary": "Record an order-support request; this does not cancel an order or approve a refund",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 160
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "cancellation",
                      "refund",
                      "delivery_issue",
                      "other"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 2000
                  }
                },
                "required": [
                  "kind",
                  "message"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient prepaid credits for a food order or for billable calls after the first confirmed order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Expired quote, conflicting key, or pending outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/webhooks": {
      "get": {
        "operationId": "getWebhooks",
        "summary": "Read your webhook configuration and recent delivery results (free)",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "configureWebhook",
        "summary": "Configure a public HTTPS webhook; save the returned signing secret securely",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "enabled": {
                    "type": "boolean",
                    "default": true
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/app-settings": {
      "get": {
        "operationId": "getAppSettings",
        "summary": "Optional tracking-page branding and app support link (free)",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "configureApp",
        "summary": "Customize your tracking page (free)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "appName": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 80
                  },
                  "supportUrl": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [
                  "appName",
                  "supportUrl"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/wallet/topups": {
      "post": {
        "operationId": "createTopup",
        "summary": "Start hosted Stripe funding from $5; returns a URL, does not charge by itself",
        "security": [
          {
            "dashboardSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amountCents": {
                    "type": "integer",
                    "minimum": 500,
                    "maximum": 100000
                  }
                },
                "required": [
                  "amountCents"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "A signed-in developer dashboard session is required"
          }
        }
      }
    },
    "/api/v2/wallet/topups/confirm": {
      "post": {
        "operationId": "confirmTopup",
        "summary": "Confirm a paid dashboard top-up exactly once",
        "security": [
          {
            "dashboardSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sessionId": {
                    "type": "string",
                    "pattern": "^cs_(live|test)_"
                  }
                },
                "required": [
                  "sessionId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "A signed-in developer dashboard session is required"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An existing active live MealMe API key or a new live ordering key. Keep keys on your server. Use scoped embedded sessions for the browser."
      },
      "dashboardSession": {
        "type": "http",
        "scheme": "bearer",
        "description": "The signed-in developer's Supabase dashboard access token. API keys and embedded tokens cannot save cards or manage funding."
      }
    },
    "schemas": {
      "Service": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "grubhub"
            ]
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "Address": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string"
          },
          "line2": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "postalCode": {
            "type": "string"
          }
        },
        "required": [
          "line1",
          "city",
          "state",
          "postalCode"
        ]
      },
      "Store": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "imageUrl": {
            "type": "string",
            "format": "uri"
          },
          "menuUrl": {
            "type": "string",
            "format": "uri"
          },
          "cuisines": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rating": {
            "type": "number"
          },
          "isOpen": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "cuisines"
        ]
      },
      "MenuItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "priceCents": {
            "type": "integer",
            "minimum": 0
          },
          "imageUrl": {
            "type": "string",
            "format": "uri"
          },
          "groups": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "min": {
                  "type": "integer",
                  "minimum": 0
                },
                "max": {
                  "type": "integer",
                  "minimum": 0
                },
                "choices": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "priceCents": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "priceCents"
                    ]
                  }
                }
              },
              "required": [
                "id",
                "name",
                "min",
                "max",
                "choices"
              ]
            }
          }
        },
        "required": [
          "id",
          "name",
          "priceCents",
          "groups"
        ]
      },
      "QuoteInput": {
        "type": "object",
        "properties": {
          "externalCustomerId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "restaurantId": {
            "type": "string"
          },
          "restaurantName": {
            "type": "string"
          },
          "restaurantUrl": {
            "type": "string",
            "format": "uri"
          },
          "fulfillmentType": {
            "type": "string",
            "enum": [
              "delivery",
              "pickup"
            ]
          },
          "recipient": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "email": {
                "type": "string",
                "format": "email"
              }
            },
            "required": [
              "name"
            ]
          },
          "deliveryAddress": {
            "$ref": "#/components/schemas/Address"
          },
          "deliveryInstructions": {
            "type": "string"
          },
          "tipCents": {
            "type": "integer",
            "minimum": 0
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 30,
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 20
                },
                "optionIds": {
                  "type": "array",
                  "maxItems": 100,
                  "items": {
                    "type": "string"
                  },
                  "default": []
                }
              },
              "required": [
                "id",
                "quantity"
              ]
            }
          }
        },
        "required": [
          "externalCustomerId",
          "restaurantId",
          "recipient",
          "deliveryAddress",
          "items"
        ]
      },
      "Quote": {
        "type": "object",
        "properties": {
          "quoteId": {
            "type": "string",
            "format": "uuid"
          },
          "externalCustomerId": {
            "type": "string"
          },
          "restaurantName": {
            "type": "string"
          },
          "fulfillmentType": {
            "type": "string",
            "enum": [
              "delivery",
              "pickup"
            ]
          },
          "service": {
            "$ref": "#/components/schemas/Service"
          },
          "realOrder": {
            "type": "boolean"
          },
          "expired": {
            "type": "boolean"
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "quote": {
            "type": "object",
            "properties": {
              "subtotalCents": {
                "type": "integer",
                "minimum": 0
              },
              "deliveryFeeCents": {
                "type": "integer",
                "minimum": 0
              },
              "serviceFeeCents": {
                "type": "integer",
                "minimum": 0
              },
              "taxCents": {
                "type": "integer",
                "minimum": 0
              },
              "tipCents": {
                "type": "integer",
                "minimum": 0
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0
              },
              "currency": {
                "type": "string",
                "enum": [
                  "usd"
                ]
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "totalCents",
              "expiresAt"
            ]
          }
        },
        "required": [
          "quoteId",
          "quote"
        ]
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "quoteId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "placing",
              "confirmed",
              "failed",
              "reconciliation_required"
            ]
          },
          "externalCustomerId": {
            "type": "string"
          },
          "restaurantName": {
            "type": "string"
          },
          "fulfillmentType": {
            "type": "string",
            "enum": [
              "delivery",
              "pickup"
            ]
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0
          },
          "providerOrderId": {
            "type": "string"
          },
          "trackingUrl": {
            "type": "string",
            "format": "uri"
          },
          "receiptUrl": {
            "type": "string",
            "format": "uri"
          },
          "refundedCents": {
            "type": "integer",
            "minimum": 0
          },
          "refundStatus": {
            "type": "string"
          },
          "support": {
            "type": "object",
            "properties": {
              "phone": {
                "type": "string"
              },
              "phoneLabel": {
                "type": "string"
              },
              "phoneUrl": {
                "type": "string"
              },
              "orderNumber": {
                "type": "string"
              },
              "appName": {
                "type": "string"
              },
              "appSupportUrl": {
                "type": "string"
              }
            }
          },
          "tracking": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "etaStart": {
                "type": "string"
              },
              "etaEnd": {
                "type": "string"
              },
              "updatedAt": {
                "type": "string"
              }
            }
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "required": [
                "name",
                "quantity"
              ]
            }
          }
        },
        "required": [
          "id",
          "status",
          "totalCents"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "orderId": {
                "type": "string",
                "format": "uuid"
              },
              "outcomeUncertain": {
                "type": "boolean"
              }
            },
            "required": [
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      }
    }
  }
}
