GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. It provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.
Send a GraphQL query to your API and get exactly what you need, nothing more and nothing less. GraphQL queries always return predictable results.
GraphQL queries access not just the properties of one resource but also smoothly follow references between them. While typical REST APIs require loading from multiple URLs, GraphQL APIs get all the data your app needs in a single request.
Queries are used to fetch data from the server. You describe the shape of the data you want, and the server returns a JSON response that matches that exact shape.
query GetUserAndPosts {
user(id: "123") {
name
email
posts(limit: 2) {
title
content
}
}
}Mutations are used to modify data on the server (create, update, delete). Like queries, mutations can also return data, allowing you to fetch the updated state in a single request.
mutation CreateNewPost($title: String!, $content: String!) {
createPost(input: { title: $title, content: $content }) {
post {
id
title
createdAt
}
}
}Subscriptions maintain an active connection to the server (usually via WebSockets) and push updates to the client whenever specific events occur.
subscription OnNewMessage($roomId: ID!) {
messageAdded(roomId: $roomId) {
id
text
sender {
name
}
}
}Enter a GraphQL endpoint URL in the address bar to automatically fetch the schema via introspection, or go to the Schema tab to import a schema from a file or URL manually.
Use the Schema Explorer on the left to browse available fields and click the + icon to add them to your query, or type directly into the Query Editor.
Click Query to send the request. For HTTP requests, you'll see the response in the right panel. For Subscriptions, select WS as the protocol to establish a WebSocket connection and receive real-time updates.