> ## Documentation Index
> Fetch the complete documentation index at: https://docs.manifest.build/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK options

> The options of manifest(), the callback, and what the SDK sends to Manifest.

## Options

An option passed to `manifest()` replaces its environment variable. The SDK
starts once per process, so a new configuration needs a restart. In PHP, a
second `manifest()` call does update the key, the address and the callback.

| Role                           | Python    | Node     | PHP       | Environment variable | Default                           |
| ------------------------------ | --------- | -------- | --------- | -------------------- | --------------------------------- |
| Project key                    | `key`     | `key`    | `$apiKey` | `MNFST_KEY`          | None: the SDK does nothing        |
| Manifest address               | `url`     | `url`    | `$url`    | `MNFST_URL`          | `https://api.manifest.build`      |
| Callback                       | `on_heal` | `onHeal` | `$onHeal` | None                 | None                              |
| SDK active in PHPUnit and Pest |           |          |           | `MNFST_IN_TESTS=1`   | No: the SDK stays silent in tests |

The Hermes plugin reads `MNFST_KEY` and `MNFST_URL`. `HERMES_TRACE_DIR` sets
the folder where the plugin writes its log.

## The callback

The callback is a function of yours that the SDK runs after each recoverable
request. It receives one event with six fields: `url`, `status_code`,
`heal_status`, `replay_status_code`, `heal_ms` and `operations`. Node and PHP
write the names in camelCase.

| `heal_status`      | What happened                                                                            |
| ------------------ | ---------------------------------------------------------------------------------------- |
| `patched`          | Manifest sent a patch that worked before, and your app received the answer to the retry. |
| `unverified`       | Manifest sent a new patch, and your app received the answer to the retry.                |
| `no_patch`         | Manifest has no patch, and your app received the original error.                         |
| `resolving`        | Manifest was still looking for a patch, and your app received the original error.        |
| `autofix_disabled` | Live self-healing is off, and your app received the original error.                      |
| `heal_unreachable` | The SDK could not reach Manifest, and your app received the original error.              |
| `replay_failed`    | The retry got no answer, and your app received the original error.                       |

With `patched` or `unverified`, a `replay_status_code` of `None` in Python or
`null` in Node and PHP means the SDK could not send the retry. Your app then
received the original error.

## What leaves your app

For every request, the SDK sends the method, the URL without its query
string, the status code, the latency and the date. The path of the URL is sent
as it is, so an ID inside the path reaches Manifest.

For a recoverable request, it also sends the headers, the body and the error.
It masks keys, tokens and passwords in the query string and the headers. It
removes top-level body fields named like a key, a token or a password, and
puts them back for the retry. A secret in a nested field, and other personal
data in the body, reach Manifest.

Your app waits for the patch up to 60 seconds in Python and Node, 10 in PHP
and 20 in Hermes, then receives the original error.
