Skip to main content

REST API Connection

This guide describes how to configure Retool to execute semantic queries against the Timbr REST API using either a Timbr API token or an OAuth 2.0 (JWT) authentication flow.

Creating a Resource with Timbr API Token

Follow these steps to create a Retool Resource that authenticates using a Timbr-issued token.

  1. In Retool, open the Resources tab and click Create newResource.
  2. Under the APIs category, select REST API.
  3. Configure the resource with the following values:

Configuration (Token Based)

FieldValue
Base URLTimbr environment URL including protocol (e.g., https://demo-env.timbr.ai)
URL Parameters/timbr/api/query/
Header: Content-Typeapplication/json
Header: x-api-key<Timbr API token>
Body(leave empty)
Cookies(leave empty)
AuthenticationNone

The trailing slash in /timbr/api/query/ is required if present in your environment's routing configuration. Remove it if your gateway normalizes paths.

REST API Config

  1. Click Create resource. If any validation errors occur, review each field and correct the values as needed.

Creating a Resource with OAuth 2.0 (JWT)

Use this option when your organization enforces SSO or centralized identity governance.

  1. In Retool, open the Resources tab and click Create newResource.
  2. Select REST API.
  3. Configure the resource as follows:

Configuration (OAuth 2.0 JWT)

FieldValue
Base URLTimbr environment URL including protocol (e.g., https://demo-env.timbr.ai)
URL Parameters(leave empty)
Header: x-jwt-tokenOAUTH2_TOKEN (Retool automatically substitutes this placeholder)
Body(leave empty)
Cookies(leave empty)
AuthenticationOAuth 2.0 → Authorization Code Grant
Authorization URLe.g., https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize
Access Token URLe.g., https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token
Client IDValue from your identity provider
Client SecretValue from your identity provider
Scopes(list scopes if required by provider)
Promptconsent (or retain default)

OAuth Config

  1. Click Connect with OAuth to initiate the authorization flow.

OAuth Test

  1. After successful authentication you are redirected back to the Create resource page with a success notification.

OAuth Success

  1. Click Create resource to finalize.
Notes
TopicGuidance
Token SubstitutionRetool injects the resolved JWT into the x-jwt-token header automatically. Do not hard-code tokens.
Tenant IDIn Azure AD this is the Directory (tenant) ID. Ensure you're using the correct directory for the Timbr environment.
ScopesOnly include those required for issuing a valid JWT. Extraneous scopes can cause consent failures.

Executing Semantic Queries Using the Resource

Once the resource is created, you can issue semantic SQL queries to Timbr.

The following example uses the resource with Timbr API Token to execute the semantic query.

  1. Open (or create) a Retool app and drag a query-capable component (e.g., Query JSON with REST API, Table binding, etc.).
  2. Select the previously created REST API resource.
  3. Set the HTTP method to POST and set the endpoint path to timbr/api/query (omit a leading slash unless Retool requires it based on your Base URL format).
  4. In the Body section, choose JSON and provide the required payload fields:
FieldDescription
ontology_nameThe ontology name defined in Timbr
querySemantic SQL statement (e.g., SELECT * FROM concept_name LIMIT 10)

Query Config

  1. Click Preview to validate. If results look correct, click Save.
  2. If your UI component does not automatically render data, select the component and in the right-hand panel set its data source to: {{query1.data.data}}.
note

Replace query1 with the actual name of your Retool query.

Data Binding


Troubleshooting

SymptomPossible CauseResolution
401 UnauthorizedInvalid or expired tokenRegenerate token or re-authenticate OAuth resource
404 Not FoundIncorrect endpoint pathVerify timbr/api/query vs /timbr/api/query/ based on Base URL normalization
CORS / network errorCorporate proxy or firewall rulesWhitelist Timbr domain and Retool egress

Summary

You can integrate Retool with Timbr via either direct API token authentication or enterprise SSO using OAuth 2.0 JWT flows. After configuring the resource, semantic SQL queries can be posted to timbr/api/query, returning ontology-aware results for rapid application prototyping and internal tooling.

For expanded capabilities (relationships expansion, calculated properties, pagination, etc.) refer to the official Timbr API documentation.