Using Apollo Sandbox: Testing Your Local GraphQL API
Apollo Sandbox is the essential browser-based IDE for testing and introspecting your GraphQL API. Learn how to launch it and run your first query today.

Previously in this course, we covered Installing Apollo Server: Your GraphQL API Foundation and Defining the TypeDefs for your Apollo Server Project. Now that you have a server running with a basic schema, it's time to interact with it.
Developing GraphQL APIs without a specialized tool is like trying to drive a car while blindfolded. You need a way to send queries, inspect the schema, and view responses in real-time. That is where Apollo Sandbox comes in.
What is Apollo Sandbox?
Apollo Sandbox is a powerful, browser-based IDE designed specifically for GraphQL development. Unlike a standard REST client (like Postman or cURL), Sandbox is "GraphQL-aware." This means it understands your schema, provides auto-completion while you type, and helps you construct valid queries by suggesting available fields.
When you start your Apollo Server in development mode, it automatically serves an instance of Apollo Sandbox at the root URL of your server. It acts as a bridge between your code and your browser, allowing you to iterate on your API without writing a frontend application.
Launching Your Sandbox

Assuming you have your project set up from our previous lessons, ensure your server is running (usually via node index.js or npm start).
- Open your terminal and confirm your server is listening (check for console logs like "Server ready at http://localhost:4000").
- Navigate to
http://localhost:4000in your browser. - You should see the Apollo Sandbox welcome screen.
If you are prompted to connect, ensure the URL points to your local endpoint (e.g., http://localhost:4000). If everything is configured correctly, the left-hand sidebar will populate with your schema documentation.
Executing Your First Query
Once the Sandbox is open, you will see a central pane for writing your operations. Let's run a test query to ensure your server is communicating with the client.
Copy the following into the operation editor:
GraphQLquery TestConnection { # Replace 'hello' with a field from your current project's schema hello }
Click the Play button (the triangle icon). You should see the response appear in the right-hand panel in JSON format.
Why use Sandbox over raw HTTP requests?
| Feature | Raw HTTP (cURL) | Apollo Sandbox |
|---|---|---|
| Schema Validation | None | Real-time syntax checking |
| Introspection | Requires manual requests | Auto-generated documentation |
| Autocomplete | None | Intelligent field suggestions |
| Query Formatting | Manual | One-click Prettier formatting |
Hands-on Exercise
To verify your setup, perform the following steps:
- Open your
typeDefsfile and ensure you have at least one field defined under theQuerytype. - Launch your local server.
- Open Apollo Sandbox and use the auto-complete feature (press
Ctrl + SpaceorCmd + Spaceinside the editor) to see if it lists your defined fields. - Execute a query for that field and observe the JSON response.
Common Pitfalls
- Server not running: The most common issue is forgetting to start the development server. Sandbox cannot connect to a non-existent port.
- Introspection disabled: If you have followed security best practices like those discussed in GraphQL security: Hardening Schema Exposure Against Introspection, you may have explicitly disabled introspection. If you can't see your documentation, check your server configuration to ensure
introspection: trueis set for development environments. - CORS errors: If your browser is hitting a different port or domain, you might encounter Cross-Origin Resource Sharing (CORS) errors. Apollo Server handles this by default, but ensure you haven't restricted origin access too tightly in your production config.
FAQ
Q: Does Apollo Sandbox save my queries? A: Sandbox keeps your current state in the browser's local storage for your convenience during the session, but it is not a persistent database.
Q: Is this tool safe for production? A: Sandbox is for development. In production, you should almost always disable introspection to prevent unauthorized users from mapping out your entire API structure.
Q: Can I use other tools like Insomnia or GraphiQL? A: Absolutely. While we use Apollo Sandbox because it integrates seamlessly with Apollo Server, the underlying GraphQL protocols are standard. Any tool that supports introspection will work.
Recap

In this lesson, we transitioned from writing static schema code to actively testing our API. You now know how to launch Apollo Sandbox, use it to send operational queries, and utilize the built-in IDE features to speed up your development workflow.
Up next: We will dive into Understanding Introspection to see how tools like the Sandbox actually "discover" the shape of your API automatically.
Work with me

Custom WordPress Plugin Development
Custom WordPress & WooCommerce plugins built to standard โ by the developer behind a plugin with 5,000+ active installs and a SaaS with 10,000+ users.

Laravel REST API Development
Clean, secure, well-documented Laravel REST APIs โ the backend engine for your app, mobile client, or SaaS. Built by an API specialist.


