SDKs overview
Retool is designed as a platform for building internal tools with a visual interface, allowing developers to create applications by dragging and dropping components and connecting them to various data sources. While the primary interaction is often through this visual builder, Retool also provides mechanisms for programmatic interaction through its JavaScript API and integration capabilities. This allows developers to extend the platform's functionality, automate tasks, and integrate with external systems.
The core of Retool's developer extensibility lies in its support for JavaScript within the application builder. Developers can write custom JavaScript code to define component logic, transform data, and interact with external APIs. This approach minimizes the need for a traditional standalone SDK for building Retool applications themselves, as the development environment is integrated within the Retool platform. However, for interacting with Retool from outside, or for advanced programmatic control, Retool offers specific APIs and methods.
Retool applications can connect to a wide array of data sources, including databases, REST APIs, GraphQL APIs, and third-party services. The platform provides built-in connectors for many popular services, and custom JavaScript can be used to interact with any HTTP-accessible API. This flexibility allows developers to integrate virtually any backend system into their Retool applications, enhancing their functionality without requiring extensive boilerplate code for each integration.
For operations that require deeper programmatic control over Retool itself, such as deploying applications, managing users, or interacting with Retool Workflows programmatically, developers typically utilize Retool's API reference documentation. This HTTP-based API allows for external systems to interact with Retool resources, enabling automation and integration into larger development pipelines. This distinguishes it from a client-side SDK that might be used to build components or applications from scratch in a different environment.
Official SDKs by language
Retool primarily leverages JavaScript as its language for extending functionality within the platform. While there isn't a traditional, installable SDK package for every programming language in the way a payment gateway might offer one, the platform fully supports JavaScript for client-side logic and interaction, and provides a robust HTTP API for external programmatic access. The focus is on integrating JavaScript directly into the Retool application builder for dynamic behavior.
The table below summarizes the official approach to SDKs and programmatic interaction with Retool.
| Language | Package/Approach | Install Command (if applicable) | Maturity |
|---|---|---|---|
| JavaScript | Integrated JavaScript API (within Retool) | N/A (built-in) | Stable/Core |
| Any (HTTP) | Retool REST API | N/A (HTTP requests) | Stable |
The integrated JavaScript API allows developers to write code directly within Retool components (e.g., query transformers, event handlers, custom components) to manipulate data, control UI elements, and call external APIs. This is extensively documented in the Retool JavaScript documentation.
Installation
For the integrated JavaScript functionality within Retool, no separate installation is required. Developers write JavaScript directly in Retool's code editors within the application builder. For example, when creating a new query or configuring a component's event handler, a JavaScript editor is provided.
To interact with Retool's REST API from an external application, you would typically use an HTTP client library available in your chosen programming language. For instance, in Node.js, you might use axios or the built-in fetch API. In Python, you might use requests. These are standard libraries for making HTTP requests and are not specific to Retool.
// Example using Node.js with axios to interact with an external API from Retool
// (This code would live within a Retool query or custom component)
const axios = require('axios');
async function fetchDataFromExternalAPI() {
try {
const response = await axios.get('https://api.example.com/data');
return response.data;
} catch (error) {
console.error('Error fetching data:', error);
throw new Error('Failed to fetch data');
}
}
If you are deploying Retool in a self-hosted environment, the installation process involves setting up Docker containers or Kubernetes deployments. This is an infrastructure-level installation and does not involve installing client-side SDKs for application development. Details for self-hosting Retool are provided in their official documentation.
Quickstart example
This example demonstrates how to use JavaScript within a Retool application to fetch data from an external API and display it. This is a common pattern for integrating external services into Retool without a dedicated SDK.
Step 1: Create a new Retool query
In your Retool application, click on + New query in the bottom panel. Select REST API as the resource type. Configure the query as follows:
- Method:
GET - URL:
https://api.github.com/users/retool - Name:
githubUserQuery
You can then run this query to see the data returned from the GitHub API for the 'retool' user. This query is now available for other components in your Retool application.
Step 2: Display data in a Text Input component
Drag a Text Input component onto your canvas. In the component's inspector panel, set its Default value to a JavaScript expression that references the query:
{{ githubUserQuery.data.name }}
This will display the name of the GitHub user fetched by your query. If you want to display the full JSON response in a JSON Explorer component, you could set its Data property to {{ githubUserQuery.data }}.
Step 3: Add a button to refetch data
Drag a Button component onto the canvas. In the button's inspector panel, under Event handlers, add a new handler:
- Event:
Click - Action:
Run a query - Query:
githubUserQuery
Now, every time you click this button, the githubUserQuery will re-run, fetching the latest data from the GitHub API. This demonstrates how Retool components interact with queries using integrated JavaScript expressions.
For more complex logic, you can define custom JavaScript functions or transformers directly within Retool queries to process data before it's displayed or used by other components. For example, to filter an array of objects returned by an API, you might add a transformer to your query:
// Example of a Query Transformer in Retool
// This code runs AFTER the API response is received
return data.filter(item => item.status === 'active');
This approach allows developers to leverage JavaScript's full power within the Retool environment without needing to manage external SDK installations for core application building.
Community libraries
Given Retool's focus on an integrated development environment, community contributions often manifest as shared components, custom JavaScript utilities, or pre-built Retool applications that can be imported and adapted. While there isn't a central repository for traditional SDKs built by the community for Retool, developers frequently share code snippets and patterns for common tasks.
The Retool community forum and various online developer communities serve as platforms for sharing these types of resources. Developers might share custom JavaScript functions for data manipulation, reusable component configurations, or examples of integrating with specific third-party APIs not covered by Retool's native integrations.
For example, a developer might share a JavaScript utility function for debouncing user input in a text field to reduce API calls, or a complex SQL query that powers a specific dashboard. These contributions enhance the capabilities of Retool applications but are typically integrated directly into the Retool environment rather than installed as external libraries.
Additionally, because Retool can connect to virtually any API, developers often rely on existing SDKs and libraries for those external services (e.g., Stripe's Node.js library, Twilio's Python helper library) and then integrate the results of those SDKs into Retool via custom API calls or server-side scripts. This allows Retool to act as the front-end for complex back-end operations managed by other SDKs.
The extensibility model encourages developers to use standard web technologies and existing npm packages (via custom components or server-side integrations) rather than relying on a platform-specific community SDK ecosystem. The Retool Custom Components feature allows developers to embed their own React components, opening up possibilities for integrating a vast array of existing JavaScript libraries and frameworks.