# `Tipalti.Config`
[🔗](https://github.com/iamkanishka/tipalti/blob/main/lib/tipalti/config.ex#L1)

Holds credentials and connection settings for all three Tipalti API
families. Build one with `new/1` and pass it as the first argument to
every `Tipalti.*` function.

Nothing here is validated eagerly against Tipalti's servers — validation
is limited to shape/presence checks so that misconfiguration fails fast,
locally, with a clear message instead of a confusing HTTP error.

# `mode`

```elixir
@type mode() :: :sandbox | :production
```

# `procurement_opts`

```elixir
@type procurement_opts() :: [{:api_key, String.t()}]
```

# `rest_opts`

```elixir
@type rest_opts() :: [client_id: String.t(), client_secret: String.t()]
```

# `soap_opts`

```elixir
@type soap_opts() :: [payer_name: String.t(), api_key: String.t()]
```

# `t`

```elixir
@type t() :: %Tipalti.Config{
  max_retries: non_neg_integer(),
  mode: mode(),
  procurement: %{optional(:api_key) =&gt; String.t()},
  procurement_base_url: String.t(),
  receive_timeout: pos_integer(),
  rest: %{
    optional(:client_id) =&gt; String.t(),
    optional(:client_secret) =&gt; String.t()
  },
  rest_base_url: String.t(),
  soap: %{optional(:payer_name) =&gt; String.t(), optional(:api_key) =&gt; String.t()},
  soap_base_url: String.t(),
  soap_version: String.t(),
  telemetry_prefix: [atom()]
}
```

# `new`

```elixir
@spec new(keyword()) :: t()
```

Builds a new `Tipalti.Config`.

## Options

  * `:mode` — `:sandbox` (default) or `:production`. Selects the default
    base URL for every API family unless overridden below.
  * `:rest` — `[client_id: ..., client_secret: ...]` for the modern OAuth2
    REST API.
  * `:soap` — `[payer_name: ..., api_key: ...]` for the legacy SOAP API.
  * `:procurement` — `[api_key: ...]` for the Procurement REST API.
  * `:rest_base_url`, `:soap_base_url`, `:procurement_base_url` — override
    the computed base URL for that API family (useful for tests or
    self-hosted proxies).
  * `:soap_version` — SOAP endpoint version segment, defaults to `"v11"`.
  * `:receive_timeout` — per-request timeout in milliseconds (default `30_000`).
  * `:max_retries` — retry attempts for idempotent/safe requests on
    transient failures (default `3`).

Only the sections you actually use need to be populated — e.g. a config
built with only `:soap` opts is fine as long as you only call
`Tipalti.SOAP.*` functions with it.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
