Quickstart
DocumentationQuickstartGrubhub supported
A GOOD IDEA IS ONLY THE START.

Make your first
real order.

Restaurant and grocery ordering for your app or agent. Find a store, build a cart, check out, and keep your users updated—all through MealMe.

Grubhub is supported today. Search covers restaurants and groceries, with pickup and delivery depending on the address. More services are coming.
01

Create a workspace and save your card.

Use your existing MealMe login or create an account. Stripe saves your card without an initial charge. Get a server API key from the API keys tab.

Search stores, load menus and build cart quotes for free until your first order is confirmed. Nothing accrues for later collection. Add credits from $5 to cover the full food total; your first order has no API fee. Afterward, successful billable calls cost $0.10 from credits.

02

Install the SDK. Keep the key on your server.

The package includes TypeScript types and has no runtime dependencies. Prefer REST? Use the endpoint reference in the sidebar.

Terminal
npm install https://mealmeai.vercel.app/sdk/mealme-sdk-0.3.4.tgz
mealme.ts
import { MealMe } from '@mealme/sdk';

// Server only. Never expose this key in your browser app.
const mealme = new MealMe({
  apiKey: process.env.MEALME_API_KEY!,
  baseUrl: 'https://mealmeai.vercel.app'
});
03

Find a store and quote a cart.

This example stops at a quote. Replace the sample address, recipient, and customer ID with your own. For groceries, search “groceries” or a store name.

first-cart.ts
const address = {
  line1: '233 S Wacker Dr',
  city: 'Chicago', state: 'IL', postalCode: '60606'
};

const found = await mealme.search({
  address: '233 S Wacker Dr, Chicago, IL 60606',
  query: 'burgers', fulfillment: 'delivery'
});
const store = found.restaurants[0];
if (!store) throw new Error('Try another address or search.');

const menu = await mealme.menu(store.id, {
  latitude: found.location.latitude,
  longitude: found.location.longitude,
  zipCode: address.postalCode, fulfillment: 'delivery'
});

// A simple first cart: choose an item without required options.
// In your UI, collect each option group's min/max choices.
const item = menu.items.find(i =>
  typeof i.priceCents === 'number' &&
  i.groups.every(group => group.min === 0)
);
if (!item) throw new Error('Choose an item and its options.');

const quote = await mealme.quote({
  externalCustomerId: 'your-customer-id',
  restaurantId: store.id,
  fulfillmentType: 'delivery', deliveryAddress: address,
  recipient: { name: 'Alex', phone: '2025550100' },
  tipCents: 200,
  items: [{ id: item.id, quantity: 1, optionIds: [] }]
});
console.log(quote.quote.totalCents, quote.quote.expiresAt);
// Stop here to review the quote and fund your first order.
Item options matter. Each menu item includes option groups with minimum and maximum selections. Send selected choice IDs in optionIds. The final quote is the price to review before ordering.
04

Add credits, then place the order.

Choose your top-up after the quote is ready. Fund the full food total. The first order has no API fee; later order submissions also cost $0.10. Your app handles its own customer payment, if applicable.

place-order.ts
// Fund the full food total before ordering. The first order has no API fee.
// After your first confirmed order, later billable calls cost $0.10 from credits.
// Your backend authorizes your customer's payment, if applicable.
// Persist an order key for this purchase BEFORE submitting.
const order = await mealme.place({
  quoteId: quote.quoteId,
  confirmRealOrder: true,
  maxTotalCents: quote.quote.totalCents
}, { idempotencyKey: yourPersistedOrderKey });

// Save the order ID, customer payment ID and key together.
console.log(order.id, order.status, order.trackingUrl);
// A timeout is an unknown outcome. Reconcile with the same key.
This is a real purchase. Confirm the quote, recipient, and fulfillment choice before calling place. Keep the same persisted idempotency key for the same purchase. A timeout does not mean the order failed.