# Change plugins for one call (https://effetch.monarcode.dev/docs/plugins/per-call)

A client's plugins run on every call, but some calls need something
different: a login that sends no token, or a slow export that needs more
time. Rather than build a second client for them, you change the plugins for
that one call. This page shows how, and how a call's changes combine with
the plugin's defaults and with an endpoint's.

## Skip or adjust a plugin

Pass `plugins` in the call's options, keyed by the plugin's name. `false`
skips that plugin, and an object changes some of its options:

```ts
import * as Effect from "effect/Effect";

import { Fetch } from "@monarcode/effetch";
import { bearer, retry, timeout } from "@monarcode/effetch/plugins";

class Api extends Fetch.Service<Api>()("Api", {
  baseUrl: "https://api.example.com",
  plugins: [
    retry(),
    timeout({ duration: "10 seconds" }),
    bearer({ token: "token" }),
  ],
}) {}

export const program = Effect.gen(function* () {
  const api = yield* Api;

  // Logging in sends no token.
  yield* api.post("/auth/login", {
    body: { user: "ada" },
    plugins: { bearer: false },
  });

  // A slow export gets more time, and isn't retried.
  yield* api.get("/reports/export", {
    plugins: { timeout: { duration: "2 minutes" }, retry: { times: 0 } },
  });
});
```

TypeScript checks the plugin names and the option types, so a misspelled
name or a wrong option doesn't compile. Each plugin decides which options a
call can change. To see what each built-in plugin accepts, see the
**Per call** column in [Built-in plugins](https://effetch.monarcode.dev/docs/plugins#what-each-plugin-does).
A plugin you write accepts any of the options in its `defaults` (see
[Write a plugin](https://effetch.monarcode.dev/docs/plugins/writing)).

## How a call's changes apply

A call's changes combine with the rest as follows:

- **Options you leave out keep their defaults.** A call that passes
  `{ consoleLogger: { detail: "summary" } }` changes `detail` only, and
  keeps the other settings. A key set to `undefined` is left out too, so it
  keeps the value it would have without it, and you can pass a value that
  may be missing, such as `{ retry: { times: maybeTimes } }`, as it is.
  Any object still turns the plugin on, even one whose keys are all
  `undefined`: on an endpoint bound with `retry: false`, that call
  retries.
- **`false` skips the whole plugin.** Its `wrap`, `onRequest` and
  `onResponse` don't run for that call, and neither do its `onError` and
  `onExit`. A skipped `consoleLogger` prints nothing, for example.
- **A call's changes go on top of an endpoint's.** When you bind an
  endpoint with `plugins` overrides, a call to it can pass its own. For each
  plugin, the call's value wins, and when both are option objects they're
  merged, key by key. See
  [Call an endpoint](https://effetch.monarcode.dev/docs/endpoints/calling).

## What's next

- [Write a plugin](https://effetch.monarcode.dev/docs/plugins/writing): write your own plugins, with
  options that calls can override.
- [Retry-After and a time limit](https://effetch.monarcode.dev/docs/plugins/retry-after): override the
  whole-call budget for one call.
- [Log to the console](https://effetch.monarcode.dev/docs/plugins/console-logging): change the console
  output for one call.