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

Shared JSON/REST request helper used by `Tipalti.Payees`, `Tipalti.Invoices`,
`Tipalti.Payments`, and the `Tipalti.Procurement.*` modules.

Handles URL/query building, JSON encoding/decoding, auth header injection
(OAuth2 bearer token for `:rest`, static `x-api-key` for `:procurement`),
and translates HTTP error responses into the `Tipalti.Error` hierarchy.

# `api`

```elixir
@type api() :: :rest | :procurement
```

# `request`

```elixir
@spec request(api(), Tipalti.Config.t(), Tipalti.HTTP.method(), String.t(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Performs a JSON request against either the REST or Procurement API.

## Options

  * `:query` — map/keyword of query string params.
  * `:json` — a term to JSON-encode as the request body.
  * `:headers` — additional request headers.
  * `:operation` — an atom used only for telemetry metadata and error
    messages (e.g. `:list_payees`).

---

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