Connect to an API

Learn how to connect to REST, GraphQL or SOAP APIs.

You can connect Retool to most APIs using our native integrations. If you need to connect to an internal API, or if there isn't a supported integration, you can connect using our REST API integration or GraphQL Integration.

1. Create an API resource

Resources represent connections to data sources and are what you query within your Retool apps. Log in to Retool and navigate to the Resources tab. Click Create new > Create a new resource and select REST API. This opens the Connect a resource page where you add your connection information.

Adding a REST API resource

At a minimum, you need the base URL of the API you want to connect to. You can also pass URL parameters, headers, etc. If your API requires authentication, you can configure that on this page as well. For example, OAuth2.0 requires an Authorization URL, Access Token URL, etc. After you enter your connection details, click Create resource and then Create an app. This opens the App editor.

2. Query your API

When the App editor opens, query1 is created automatically with the resource you added. You can see this in the Resource dropdown in the query editor. To query your API, click Save & Run. If needed, you can update query1 with additional URL parameters, headers, etc.

Querying an API

If you see authentication errors, verify your authentication details are correct. See our API authentication documentation for more information.

SOAP APIs

You can connect to SOAP APIs using the same process as REST APIs but you need to format SOAP queries differently.

  • Use the SOAP endpoint as the URL of the request. If you use WSDL, provide the path to the WSDL inside the URL.
  • SOAP endpoints must be sent as POST requests.
  • Add 'Content-Type' = 'text/xml' to the header. If you use a SOAP 1.1 service, you also need to include the SOAPAction header and appropriate value.
  • Use the Raw body type to define the SOAP request.
  • See your API specification for required headers. The name of the SOAP method is usually provided in the SOAP body but may need to be provided in the header instead.