> For the complete documentation index, see [llms.txt](https://docs.thewalletcrew.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thewalletcrew.io/developers-guides/scripting/globals.md).

# Globals

Index of every global available in scripts - fetch, console, sleep, toDateTime, ensureLatin and CryptoJS - with links to their reference pages.

A global is a name that is available in every script file, without an import. The platform provides a small, fixed set: one function to call external systems, a few helpers for text, dates, waiting and signing, and a console for logging. Capabilities that are not globals are [modules](https://docs.thewalletcrew.io/developers-guides/scripting/modules.md): `getSecret`, the Secutix `fetch` and `semantics` (Apple Music).

## List of globals

| Global                               | What it does                                                                                                       | Reference                                                                                                 |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------- |
| `fetch(url, options?)`               | Sends an HTTP request and returns `{ StatusCode, ResponseText }`. Supports authentication, caching and throttling. | [fetch](https://docs.thewalletcrew.io/developers-guides/scripting/globals/fetch.md)                       |
| `console`                            | Writes to the platform's log: `log`, `debug`, `trace`, `table`, `info`, `warn`, `assert`, `error`.                 | [Utility globals](https://docs.thewalletcrew.io/developers-guides/scripting/globals/tools.md#console)     |
| `sleep(ms)`                          | Returns a promise that resolves after a delay.                                                                     | [Utility globals](https://docs.thewalletcrew.io/developers-guides/scripting/globals/tools.md#sleep)       |
| `toDateTime(value)`                  | Converts a string or a JavaScript date to a UTC date, or `null`.                                                   | [Utility globals](https://docs.thewalletcrew.io/developers-guides/scripting/globals/tools.md#todatetime)  |
| `ensureLatin(value, replacement?)`   | Turns look-alike and accented characters into plain Latin letters.                                                 | [Utility globals](https://docs.thewalletcrew.io/developers-guides/scripting/globals/tools.md#ensurelatin) |
| `CryptoJS.HmacSHA256(secret, value)` | Computes an HMAC-SHA256 signature as uppercase hexadecimal text.                                                   | [Utility globals](https://docs.thewalletcrew.io/pages/fiqFJBqR7L97fi4g6kzy#cryptojs.hmacsha256)           |

Other names that the editor shows in a handler, such as `context` in the default export, are parameters handed to the script and not globals. The standard JavaScript built-ins (`JSON`, `Math`, `Date`, `Array`, and so on) are available as usual.

## Rules that apply to all globals

Globals that can be awaited (`fetch`, `sleep`) return promises, so handlers that use them are written with `async` and `await`. Globals keep no state between runs; reuse data with the `Cache` option of [`fetch`](https://docs.thewalletcrew.io/developers-guides/scripting/globals/fetch.md) (see [How scripts run](https://docs.thewalletcrew.io/developers-guides/scripting/how-scripts-run.md#when-files-are-loaded)).

## FAQ

<details>

<summary><strong>Is there a `setTimeout` or `setInterval`?</strong></summary>

They are not part of the documented set. A pause is written with `await sleep(ms)`, and recurring work belongs to the scheduler of the platform rather than to a script.

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.thewalletcrew.io/developers-guides/scripting/globals.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
