Sign Up
Loading...

Using variables in HTTP request headers and JavaScript support

Asked by Jose on March 7, 2025

  • How do I include a variable in the HTTP request headers (for example, Authorization: Bearer {{API_key}})?
  • Can I store API keys as global variables and reference them in functions/endpoints?
  • Can I use JavaScript for data processing?

Answered by Twidget

Set the HTTP Request headers field to an object and add keys such as Content‑Type and Authorization. For Authorization, set the field to Variable and concatenate the prefix and key (for example: 'Bearer' + $global.apiKey) or use the platform’s variable expression to build the header value.

You can store API keys as global variables and reference them in endpoints and server functions. Twidget does not allow running arbitrary JavaScript code directly inside the platform.

Related Questions