# `Twilio.Client`
[🔗](https://github.com/jeffhuen/twilio_elixir/blob/main/lib/twilio/client.ex#L1)

Twilio API client. Holds credentials and executes requests.

## Usage

    # From application config (simplest)
    client = Twilio.client()

    # Explicit credentials
    client = Twilio.client("ACxxx", "auth_token")

    # With options
    client = Twilio.client("ACxxx", "auth_token",
      region: "ie1",
      edge: "dublin",
      max_retries: 3
    )

# `t`

```elixir
@type t() :: %Twilio.Client{
  account_sid: String.t(),
  auth_token: String.t(),
  edge: String.t() | nil,
  finch: atom(),
  max_retries: non_neg_integer(),
  open_timeout: pos_integer(),
  password: String.t(),
  read_timeout: pos_integer(),
  region: String.t() | nil,
  user_agent_extensions: [String.t()],
  username: String.t()
}
```

# `new`

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

Create a new client from application config.

# `new`

```elixir
@spec new(String.t(), String.t()) :: t()
```

Create a new client with explicit credentials.

# `new`

```elixir
@spec new(String.t(), String.t(), keyword()) :: t()
```

Create a new client with explicit credentials and options.

## Options

  * `:region` - Twilio region (e.g., `"us1"`, `"ie1"`)
  * `:edge` - Twilio edge location (e.g., `"ashburn"`, `"dublin"`)
  * `:max_retries` - Maximum retry attempts (default: `0`)
  * `:open_timeout` - Connection timeout in ms (default: `30_000`)
  * `:read_timeout` - Read timeout in ms (default: `30_000`)
  * `:finch` - Custom Finch instance name (default: `Twilio.Finch`)
  * `:account_sid` - Override account SID for subaccounts

# `request`

```elixir
@spec request(t(), atom(), String.t(), keyword()) ::
  {:ok, map()} | {:ok, map(), map()} | :ok | {:error, Twilio.Error.t()}
```

Execute an API request.

## Options

  * `:params` - Request parameters (map)
  * `:base_url` - Base URL for the request
  * `:page_key` - Key for pagination results
  * `:content_type` - Request content type (`:form` or `:json`, default `:form`)
  * `:max_retries` - Override client max_retries for this request
  * `:return_response` - Return `{:ok, data, response}` with metadata
  * `:idempotency_token` - Custom idempotency token for POST requests

---

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