To integrate Mindbody with V0 by Vercel, create a Next.js API route that calls the Mindbody Public API using your API key and site credentials stored as Vercel environment variables. V0 generates the class schedule and booking UI; the API route fetches live class data and handles booking requests server-side for fitness studio and wellness apps.
Build a Fitness Studio Booking App with Mindbody and V0
Mindbody powers over 60,000 fitness studios, yoga classes, spas, and wellness businesses worldwide. For founders building wellness apps, membership portals, or fitness discovery platforms, the Mindbody Public API provides access to class schedules, instructor profiles, service bookings, client accounts, and payment processing — everything you need to build a branded booking experience on top of an existing Mindbody business.
The V0 + Mindbody integration follows the standard Next.js API route pattern: V0 generates your class schedule display and booking form UI, while a server-side API route handles all Mindbody API calls. This is important because Mindbody API keys must never appear in client-side code. The API also requires user token authentication for booking actions, which means your API route needs to handle the two-step flow: get a user token from Mindbody's auth endpoint, then use it to create a booking.
This guide focuses on the two most common use cases — displaying class schedules publicly and allowing authenticated clients to book classes — using the Mindbody v6 Public API. Note that Mindbody API access requires a Partner relationship agreement; you'll need to apply at developers.mindbodyonline.com before you can use the API.
Integration method
V0 generates a Next.js frontend for displaying class schedules and booking flows. A Next.js API route at app/api/mindbody/route.ts proxies requests to the Mindbody Public API using your API key and site credentials, keeping sensitive tokens server-side. The Vercel deployment hosts both the UI and the secure API proxy.
Prerequisites
- A Mindbody partner developer account with API access approved at developers.mindbodyonline.com
- Your Mindbody API key and the Site ID of the business you want to integrate with
- A V0 account at v0.dev and a Vercel account for deployment
- The Mindbody business's staff username and password for API authentication (or client credentials for user-specific actions)
- Basic understanding of REST APIs and Next.js API routes
Step-by-step guide
Generate the Class Schedule UI with V0
Generate the Class Schedule UI with V0
Open V0 at v0.dev and describe the class schedule interface you want to build. V0 will generate a Next.js React component with realistic placeholder data so you can see the design before connecting real Mindbody data. Be specific about the layout — weekly calendar vs daily list, card format, booking button placement — so the generated code matches your vision closely. V0 will also scaffold app/api/mindbody/route.ts as a stub. Critically, tell V0 in your prompt that the data comes from /api/mindbody/classes so it wires the fetch call correctly in the component. Once V0 generates the initial design, you can refine it with follow-up prompts asking for specific design changes like color scheme, font size, or layout adjustments. The Design Mode in V0 lets you tweak spacing and typography without spending credits. When satisfied, click Deploy in V0 to push to Vercel — you'll configure real credentials in the next steps.
Create a fitness class schedule page with a clean card layout. Each class card shows: class name in bold, instructor name, start time, duration in minutes, and a badge showing spots remaining. Add a 'Book Class' button that calls POST /api/mindbody/book with the class ID. Include a date picker at the top to filter classes by day. Use a teal and white color scheme.
Paste this in V0 chat
Pro tip: Ask V0 to generate with mock data first so you can perfect the design before integrating real Mindbody data. It is much faster to iterate on layout without waiting for API calls.
Expected result: V0 generates a class schedule page with cards, a date picker, and booking buttons. The project deploys to a Vercel preview URL with placeholder data showing.
Create the Mindbody API Route for Class Schedules
Create the Mindbody API Route for Class Schedules
The Mindbody Public API uses API key authentication passed in the request headers. For fetching class schedules, you call the GET /class/classschedules or GET /class/classes endpoint with your API key in the Api-Key header and the SiteId in the SiteId header. Create the API route at app/api/mindbody/classes/route.ts. The route fetches upcoming classes for the specified site from Mindbody's API and returns the relevant fields to the frontend. You need to handle pagination since Mindbody returns results in pages — for a studio with many classes, you may need to pass StartDateTime and EndDateTime parameters to filter the date range. The Mindbody API base URL for v6 is https://api.mindbodyonline.com/public/v6. Parse the response to extract class name, instructor, start time, end time, total booking count, and available booking count. Return this as a clean array to the frontend rather than the raw Mindbody response format, which can be deeply nested.
1import { NextResponse } from 'next/server';23const MINDBODY_BASE = 'https://api.mindbodyonline.com/public/v6';45export async function GET(request: Request) {6 const { searchParams } = new URL(request.url);7 const startDate = searchParams.get('startDate') ?? new Date().toISOString().split('T')[0];8 const endDate = searchParams.get('endDate') ?? startDate;910 try {11 const response = await fetch(12 `${MINDBODY_BASE}/class/classes?StartDateTime=${startDate}&EndDateTime=${endDate}&Limit=50`,13 {14 headers: {15 'Api-Key': process.env.MINDBODY_API_KEY!,16 'SiteId': process.env.MINDBODY_SITE_ID!,17 'Content-Type': 'application/json',18 },19 }20 );2122 if (!response.ok) {23 const err = await response.text();24 return NextResponse.json({ error: err }, { status: response.status });25 }2627 const data = await response.json();28 const classes = (data.Classes ?? []).map((cls: Record<string, unknown>) => ({29 id: cls.Id,30 name: (cls.ClassDescription as Record<string, unknown>)?.Name,31 instructor: `${((cls.Staff as Record<string, unknown>)?.FirstName ?? '')} ${((cls.Staff as Record<string, unknown>)?.LastName ?? '')}`.trim(),32 startDateTime: cls.StartDateTime,33 endDateTime: cls.EndDateTime,34 totalBooked: cls.TotalBooked,35 maxCapacity: cls.MaxCapacity,36 spotsAvailable: (cls.MaxCapacity as number) - (cls.TotalBooked as number),37 }));3839 return NextResponse.json({ classes });40 } catch (error) {41 console.error('Mindbody API error:', error);42 return NextResponse.json({ error: 'Failed to fetch classes' }, { status: 500 });43 }44}Pro tip: Use StartDateTime and EndDateTime query parameters to limit results to the current week — fetching all future classes can return hundreds of records and slow down your page.
Expected result: The API route returns a JSON array of class objects when called with a date range. You can test it at /api/mindbody/classes?startDate=2026-04-01 in the browser.
Implement Booking Endpoint with User Token Auth
Implement Booking Endpoint with User Token Auth
Booking a class in Mindbody requires a user token — a client-specific authentication token obtained by calling Mindbody's /usertoken/issue endpoint with the client's Mindbody username and password. This is a two-step flow: first authenticate the user to get a token, then use that token in the booking request. Create two route handlers: one at app/api/mindbody/auth/route.ts for issuing user tokens, and one at app/api/mindbody/book/route.ts for creating bookings. The auth route takes the user's credentials (sent from your frontend login form) and returns a user token which the frontend stores in memory or a secure cookie — never in localStorage. The booking route receives the class ID and user token, then calls the Mindbody POST /class/addclienttoclass endpoint. Note that Mindbody also has a concept of 'client service' required for booking — the client must have a valid pass or membership. Handle the error case where the client has no valid services and return a clear message so the frontend can prompt the user to purchase.
1// app/api/mindbody/auth/route.ts2import { NextResponse } from 'next/server';34const MINDBODY_BASE = 'https://api.mindbodyonline.com/public/v6';56export async function POST(request: Request) {7 const { username, password } = await request.json();89 const response = await fetch(`${MINDBODY_BASE}/usertoken/issue`, {10 method: 'POST',11 headers: {12 'Api-Key': process.env.MINDBODY_API_KEY!,13 'SiteId': process.env.MINDBODY_SITE_ID!,14 'Content-Type': 'application/json',15 },16 body: JSON.stringify({17 Username: username,18 Password: password,19 }),20 });2122 const data = await response.json();23 if (!response.ok || !data.AccessToken) {24 return NextResponse.json({ error: 'Authentication failed' }, { status: 401 });25 }2627 return NextResponse.json({ token: data.AccessToken });28}Pro tip: Store the user token in a secure HTTP-only cookie via the Set-Cookie response header rather than returning it in the JSON body — this prevents JavaScript access to the token.
Expected result: Posting valid Mindbody client credentials to /api/mindbody/auth returns a user access token. Invalid credentials return a 401 error.
Add Environment Variables in Vercel Dashboard
Add Environment Variables in Vercel Dashboard
With the API routes created, configure the required credentials in Vercel. Navigate to your Vercel project at vercel.com, select your project, then go to Settings → Environment Variables. Add MINDBODY_API_KEY with your Mindbody developer API key — this is the key you received when your developer account was approved. Add MINDBODY_SITE_ID with the numerical Site ID of the Mindbody business location you're integrating with. You can find the Site ID in the Mindbody business portal or in the API documentation for your partner account. Both variables should be set for Production and Preview environments. For local development, create a .env.local file in your project root with the same keys. After adding variables, go to the Deployments tab and click Redeploy to apply the new configuration. If you are integrating with multiple Mindbody locations (multi-site), you can make the Site ID dynamic by passing it as a parameter from the frontend and validating it against an allowlist in your API route rather than hardcoding a single value.
1# .env.local (for local development only — set in Vercel Dashboard for production)2MINDBODY_API_KEY=your_mindbody_api_key_here3MINDBODY_SITE_ID=-99 # Use -99 for sandbox testingPro tip: Mindbody provides a sandbox site with ID -99 for testing. Use MINDBODY_SITE_ID=-99 in your Preview environment and only switch to the real site ID in Production.
Expected result: Both environment variables appear in Vercel Dashboard. A redeployment is triggered and the API routes can now authenticate with Mindbody.
Connect the Frontend and Test the Full Booking Flow
Connect the Frontend and Test the Full Booking Flow
With the API routes in place and credentials configured, update your V0-generated frontend to fetch real class data and handle the booking flow end-to-end. The class schedule component should call GET /api/mindbody/classes with the selected date on page load and whenever the date picker changes. Display the returned classes in your card layout. When a user clicks 'Book Class', check if they're logged in (have a stored user token). If not, show a login modal that calls POST /api/mindbody/auth. Once authenticated, call POST /api/mindbody/book with the class ID and user token. After a successful booking, refresh the class list so the spot count updates immediately. Test the complete flow in the Vercel preview deployment against the Mindbody sandbox (Site ID -99). Common issues at this stage include CORS errors (which don't apply because all Mindbody calls are server-side), date format mismatches (Mindbody expects ISO 8601 format: 2026-04-01T00:00:00), and booking failures due to the sandbox client having no valid service/pass. For production deployments with complex multi-location setups, RapidDev can help architect the multi-site routing logic.
Update the class schedule component to fetch from GET /api/mindbody/classes with the selected date as a query parameter startDate. When the 'Book Class' button is clicked, if no auth token is in memory, show a login modal. After login (POST /api/mindbody/auth), call POST /api/mindbody/book with the classId and token. Show a success toast on booking confirmation.
Paste this in V0 chat
Pro tip: Use React Query or SWR for the class schedule fetch — it handles refetching, caching, and loading states automatically, reducing the code you need to write for the schedule component.
Expected result: The class schedule loads real Mindbody data. The login modal appears when booking, authenticates successfully, and the booking confirmation shows after a successful POST to /api/mindbody/book.
Common use cases
Studio Class Schedule Page
Build a public-facing class schedule that shows upcoming classes, instructors, available spots, and class descriptions pulled live from Mindbody. Visitors can browse the schedule and click to book, which triggers the booking flow.
Create a fitness class schedule page with a weekly calendar view. Each day shows a list of classes with the class name, instructor, start time, duration, and available spots. Add a 'Book' button on each class card that calls /api/mindbody/book. Use a clean, modern design with a teal color scheme.
Copy this prompt to try it in V0
Client Booking Portal
Create a member portal where existing Mindbody clients can log in, view their upcoming bookings, book new classes, and cancel reservations. The app authenticates the client against Mindbody's user token system.
Build a client booking portal with a login form, a list of upcoming booked classes, a class browser with filters for date and class type, and a booking confirmation modal. The login should POST to /api/mindbody/auth and the booking list should GET from /api/mindbody/bookings.
Copy this prompt to try it in V0
Wellness Business Discovery Widget
Embed a class schedule widget on a studio's existing marketing website built with V0. The widget shows today's and tomorrow's classes with direct booking links, acting as a lightweight booking entry point without replacing the full Mindbody interface.
Create a compact class schedule widget that fits in a sidebar. Show the next 5 upcoming classes with class name, time, and a 'Book Now' link. Fetch from /api/mindbody/classes and refresh every 5 minutes. Style it to match a wellness brand with soft gradients.
Copy this prompt to try it in V0
Troubleshooting
401 Unauthorized: 'Invalid API key' when calling Mindbody API
Cause: The MINDBODY_API_KEY environment variable is incorrect, or the API key has been revoked. Mindbody API keys are tied to specific partner accounts.
Solution: Log in to your Mindbody developer account at developers.mindbodyonline.com, navigate to your app credentials, and verify the API key matches what is stored in Vercel. Regenerate the key if needed and update the Vercel environment variable, then redeploy.
403 Forbidden or empty Classes array for a real site ID
Cause: Your partner API key may not have permission to access the specified site. Mindbody requires the business to authorize your API key before you can access their data.
Solution: Coordinate with the Mindbody business owner to whitelist your API key in their Mindbody staff portal, or work through your Mindbody partner account manager. For testing, use the sandbox site ID -99 which is always accessible.
Booking fails with 'Client has no valid services'
Cause: The authenticated client does not have an active membership or class pass in Mindbody that covers the class being booked.
Solution: In the sandbox environment, add a test pass to the test client account via the Mindbody staff portal. In production, check the client's services before showing the 'Book' button by calling GET /api/mindbody/clientservices — if empty, direct them to purchase a pass first.
Date filtering returns no classes despite classes existing in Mindbody
Cause: The date format passed to the Mindbody API is incorrect. Mindbody requires ISO 8601 format with time component.
Solution: Ensure StartDateTime and EndDateTime are formatted as full ISO 8601 strings like 2026-04-01T00:00:00. A date-only string like 2026-04-01 may not be parsed correctly by the Mindbody API.
1const startDate = `${date}T00:00:00`;2const endDate = `${date}T23:59:59`;Best practices
- Always use the Mindbody sandbox (site ID -99) during development and testing — never test against a production studio's live booking system
- Cache class schedule data with a short TTL (60-300 seconds) using Vercel KV or a simple in-memory cache to reduce Mindbody API calls and stay within rate limits
- Store user access tokens in HTTP-only cookies rather than localStorage or React state to prevent XSS attacks from stealing booking credentials
- Validate class availability server-side in the booking route before submitting — the spotsAvailable count shown in the UI may be stale
- Implement rate limiting on your /api/mindbody/auth route to prevent brute-force attacks against client Mindbody credentials
- Return user-friendly error messages for common booking failures (no valid pass, class is full, already booked) instead of raw Mindbody API error codes
- Log all booking attempts and outcomes in Vercel Function Logs so you can audit booking activity and debug issues without exposing data to the frontend
Alternatives
Calendly is simpler to integrate for 1:1 appointment scheduling but lacks fitness-specific features like class capacity management and membership passes.
Acuity Scheduling (Squarespace) offers appointment and class booking with a simpler API, making it easier to integrate but with fewer fitness-studio-specific features than Mindbody.
Practo is the better choice for healthcare and doctor appointment scheduling, while Mindbody is purpose-built for fitness studios and wellness businesses.
Frequently asked questions
Do I need a Mindbody partner agreement to use the API?
Yes. Mindbody requires you to apply for API access through their developer portal at developers.mindbodyonline.com. The approval process involves reviewing your use case and signing a partner agreement. This can take several days to weeks, so apply early in your development process.
Can I display class schedules for multiple Mindbody locations?
Yes. The Mindbody API is site-specific, so you make separate API calls with different Site IDs for each location. You can make MINDBODY_SITE_ID dynamic in your API route by accepting it as a query parameter and validating it against an allowlist of authorized site IDs stored in your environment or database.
Is client data (names, emails) accessible via the Mindbody API?
Yes, but with restrictions. Client data access requires user token authentication — a client can only access their own data unless you use staff-level credentials. Be careful about storing or logging client PII fetched from Mindbody, as it is subject to privacy regulations including GDPR and CCPA.
Can I accept payments through the Mindbody API?
Mindbody has payment APIs for processing purchases, but the integration is complex and requires PCI compliance considerations. For simple fitness apps, it is often better to direct users to Mindbody's native checkout for payments and use the API only for schedule display and booking management.
How do I handle class cancellations in the API?
Mindbody provides a POST /class/removeclientfromclass endpoint for cancellations. Similar to booking, it requires a user token and the class visit ID (not the class ID). Store the visit ID returned from the booking confirmation so you can reference it for cancellations.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation