GraphQL Integration

Connect Retool to any GraphQL API.

1. Add to Retool

Create a new resource in Retool, and select "GraphQL" as the type. Enter your API endpoint in the "Base URL" field. Depending on how authentication is set up for your API, you may need to enter URL parameters or headers, or set the method via the "Authentication" dropdown. See here for more details on authentication.

Resources > Add > GraphQL

2. Create Queries

You can now select your newly-created GraphQL resource from the Resource dropdown when creating queries in your Retool apps.

GraphQL queries have one main distinction from other queries in Retool — arguments. Instead of putting Retool variables (e.g. {{textInput.value}}) directly into the query body, you can specify arguments within the query body and bind them to Retool variables via the "Variables" section underneath the editor. This makes your queries much neater.

Some pointers:

  • We parse the GraphQL query. If it's a mutation, we won't automatically refresh the query every time the parameters change. (Much like POST requests in REST APIs.)

  • We read the schema from your introspection endpoint, and use it for autocomplete and linting.

  • To reformat your GraphQL query nicely, press the Format button on the top bar.

You can display the results of GraphQL queries as with any other query in Retool.

Updated 9 months ago

GraphQL Integration

Connect Retool to any GraphQL API.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.