Loading...
Please wait a moment

Turn a GraphQL Query into REST Endpoints

Paste a GraphQL query above and you get the REST requests that would fetch the same data: a GET path for each root field with its arguments as URL-encoded query parameters, a POST with a JSON body for each mutation, related endpoints for nested field selections, and the response shape. It is handy when you are designing a REST API next to a GraphQL one, or explaining a GraphQL query to someone who thinks in HTTP methods.

How to Convert GraphQL to REST — Step-by-Step

Step 1

Input Your GraphQL Query

Planning a REST API that covers the same data as your GraphQL API? Or need to understand how a GraphQL query maps to REST? Paste your query from any source.

•
Paste: Drop in a query or a mutation; the output updates half a second after you stop typing
•
Upload: Select a .graphql or .gql file
•
Sample: Loads a users query with nested posts, so you can see a related endpoint
Step 2

How the Query Is Read

The converter maps GraphQL concepts to RESTful conventions:

•
Root fields: Become URL paths (/api/users)
•
Arguments: Become query parameters (?status=active&limit=25)
•
Field selections: Define the response shape; aliases and fragments are taken into account
•
Nested fields: Become related endpoints (/api/users/:userId/posts)
•
Mutations: Become POST requests with the arguments as a JSON body
Step 3

Copy or Download

•
Copy: Paste into your API documentation or OpenAPI spec
•
Download: Save it as rest-api-spec.txt

Frequently Asked Questions

How does a GraphQL query map to REST?

Each top-level field becomes a path under /api, so users(status: "active", limit: 25) { id name } turns into GET /api/users?status=active&limit=25. The fields you select become the response shape, written as JSON with "..." where a value would go. The page only reads the query text; it has never seen your schema or resolvers, so the paths are a suggestion you will probably rename.

What happens to nested fields?

A nested field with its own selection, like posts inside users, is listed as a related endpoint such as GET /api/users/:userId/posts, and it keeps its own arguments as query parameters. Deeper levels follow the same pattern. In the response shape every nested selection is shown as a list, because the query alone cannot tell a single object from a list.

How are lists, objects and special characters written in the URL?

Every value is URL-encoded, so quotes, spaces, &, #, % and characters like José or emoji come back unchanged when the server decodes them. A list repeats the key (tags=a&tags=b) and an input object uses brackets (filter[status]=ACTIVE). Null values are left out, since a query string has no way to say null; a note at the top of the output tells you when that happens.

What about mutations, variables and fragments?

A mutation becomes a POST request whose arguments are sent as a JSON body. A $variable uses its default value from the query; without one it is shown as a {name} placeholder for you to fill in. Fragments and inline fragments are expanded into the fields they contain. Subscriptions are refused, as they stream events and have no single REST request.

Are long IDs and decimals kept exactly?

Yes. Numbers are copied from your query text instead of being turned into JavaScript numbers, so an ICCID like 8901240544102066246 keeps every digit and 14.50 keeps its trailing zero, in the URL and in a JSON body alike. A quoted value such as "00501" stays a string.

Is my query sent anywhere?

No. The query is parsed and converted in your browser and is not uploaded or kept. Reloading the page starts again with an empty editor.

Working with GraphQL in other places? Try GraphQL to SQL, MongoDB to GraphQL, SQL to GraphQL or the GraphQL Formatter.