Connecting to an API

Connect to any REST, GraphQL or SOAP API.

You can make requests to any HTTP, GraphQL or SOAP API with Retool. Many developers get data from their own internal APIs, render them in Tables, then post data (like resetting passwords) back again to their own API. But you can also connect Retool to APIs like Stripe, Salesforce, Slack, etc.

You query REST resources in an interface where you can set URL params, headers and cookies:

POST to httpbinPOST to httpbin

Need help authenticating? Check out our dedicated auth docs.


Video: connecting your API to Retool

We put together a video that walks through the basics of connecting an API to Retool here.

JSON Body in API requests

By default, it is easy to construct a JSON object using the key-value interface. To create a more complex structure, you can nest objects as children of a key like below:

Alternatively, you can also switch from the key-value interface to send custom JSON. Here is an equivalent query to above. You will need to specify the Content-Type header in order for this to work.


Formatting JSON can be a little confusing at first!

For a value that should be a string, make sure to wrap the {{ }} with double quotes.
For a value that is a boolean / number, do not wrap the {{ }} with double quotes.
For a value that is an object / array, wrap the value inside with a JSON.stringify

Since it can be a little confusing at times to discover the right way to format, an easy alternative is to just construct the entire object dynamically like below:


SOAP API can be done very similarly. See SOAP APIs

Uploading Files

Retool has 3 file input components:

  • File Button
  • File Input
  • File Dropzone

The file componentsThe file components

These inputs allow you to instruct users to select files to upload, with support for restricted file types, multiple files, directories, and parsing.


File values

Each file input has 3 properties where uploaded file data might be stored:

  • value is an array of the files, binary encoded
  • files is an array of the file metadata (name, type, size)
  • parsedValue is an array of the parsed file data (if parseFiles is true). Retool currently supports parsing CSV, TSV, Excel, JSON, and plain text files.

Uploading files using REST queries is currently supported in two ways:

Uploading using binary

Uploading using form data

Misc. features

How do I automatically add user specific information like the user's email or Google ID?


Only available for on-prem users of Retool

If you want the API requests that get made in Retool to contain information about the user who made the request, you can use two magic constants in the API Resource configuration screen.


For example, if you want every api request to contain an extra header called X-User-Email and X-User-Google-Id you can just add two new resource headers like in the screenshot below.

Did this page help you?