> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.fabricgateway.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.fabricgateway.ai/_mcp/server.

# Secret Injector plugin

> Reference for the Secret Injector plugin, which adds a secret from a vault to upstream requests.

The Secret Injector plugin adds a secret to the request that the upstream receives, as a header or a query parameter. The data plane fetches the secret from a vault on every request, so secret values never appear in the plugin configuration. The plugin can also remove a header or query parameter that the client sent. Secret Injector is a Preview plugin, so the data plane must allow Preview plugins.

## Where it runs

|             |                                                                                                                                                                                               |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Protocols   | HTTP and LLM routes. On MCP routes, only requests that the gateway forwards as plain HTTP. Tool calls, tool lists, and session setup that the gateway makes itself don't get injected values. |
| Scope kinds | `service`, `route`                                                                                                                                                                            |
| Phase       | Request                                                                                                                                                                                       |

On LLM routes, a header that the connection's own credential writes overwrites an injected header of the same name.

## Configuration

**`injections`** `array of objects` — required

The changes to make, in order. Must not be empty.

---

**`injections[].target`** `string` — required

`header` or `query`.

---

**`injections[].name`** `string` — required

The header or query parameter name.

---

**`injections[].mode`** `string` — default: set

`set` replaces any value that the client sent. `add` keeps the client's value and adds another. `delete` removes the header or parameter, and needs no `source`.

---

**`injections[].source.vault_id`** `string`

The vault that holds the secret. Required for `set` and `add`.

---

**`injections[].source.value_ref`** `string`

The reference to the secret in the vault. Required for `set` and `add`.

---

**`injections[].source.property`** `string`

The field to read from a structured secret.

---

**`injections[].source.version`** `string`

The secret version to read.

---

**`injections[].value_template`** `string` — default: The secret value

A template that must contain `{{secret}}`, for example `Bearer {{secret}}`.

---

**`injections[].on_missing`** `string` — default: fail

What to do when the secret can't be read. `fail` breaks the plugin. With the default `fail_closed`, the request ends with `502`. `skip` leaves out this injection and applies the rest.

---

An injection that contains the secret itself, in a `value`, `secret`, or `secret_ref` field, is rejected. An instance with an invalid configuration never runs, and every request that it applies to gets `502`.

## Example

```json
{
  "name": "partner-api-key",
  "plugin_id": "secret-injector",
  "scope": { "kind": "service", "name": "partner-api" },
  "config": {
    "injections": [
      {
        "target": "header",
        "name": "Authorization",
        "value_template": "Bearer {{secret}}",
        "source": { "vault_id": "my-vault", "value_ref": "partner/api-key" }
      },
      { "target": "header", "name": "X-Debug", "mode": "delete" }
    ]
  }
}
```

## Related guides

* [Manage credentials](/configure/credentials)
* [Secrets and keys](/run/secrets-and-keys)