# `ApifyClient.Config`
[🔗](https://github.com/social-growth-studio/apify-client-ex/blob/v1.0.0/lib/apify_client/config.ex#L1)

Configuration for the Apify API client.

Every API function accepts a prebuilt configuration as
`config: %ApifyClient.Config{}`, or the options of `new/1` directly
(`token: ...`). See `ApifyClient.Client` for how they are combined.

# `t`

```elixir
@type t() :: %ApifyClient.Config{
  base_url: String.t(),
  json_library: module(),
  max_retries: non_neg_integer(),
  min_delay_between_retries_ms: non_neg_integer(),
  public_base_url: String.t(),
  timeout_ms: non_neg_integer(),
  token: String.t() | nil,
  user_agent_suffix: String.t() | nil
}
```

# `api_url`

```elixir
@spec api_url(t()) :: String.t()
```

Returns the versioned base URL for API calls.

# `new`

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

Creates a configuration.

The configuration is not read from the application environment (see
[the Elixir library guidelines](https://hexdocs.pm/elixir/design-anti-patterns.html#using-application-configuration-for-libraries)).
Build it in your application, from your own configuration, and pass it to the
calls as `config:`:

    defmodule MyApp.Apify do
      def config do
        ApifyClient.Config.new(token: Application.fetch_env!(:my_app, :apify_token))
      end
    end

    ApifyClient.Actors.call("apify/web-scraper", input, config: MyApp.Apify.config())

## Options

  * `:token` - Apify API token. Without one, requests are sent unauthenticated,
    which works only for public endpoints (the Store, public Actors). The
    token is never read from the environment; pass
    `token: System.fetch_env!("APIFY_TOKEN")` to use the environment variable.
  * `:base_url` - base URL of the API (default: `"https://api.apify.com"`)
  * `:public_base_url` - public base URL of the API (default: `:base_url`)
  * `:max_retries` - retries for rate limits, server and network errors (default: 8)
  * `:min_delay_between_retries_ms` - delay before the first retry; doubles with
    every retry (default: 500)
  * `:timeout_ms` - receive timeout per request (default: 360_000)
  * `:user_agent_suffix` - appended to the `User-Agent` header
  * `:json_library` - `ApifyClient.JSON` adapter (default:
    `config :apify_client, :json_library`, then `ApifyClient.JSON.Native`)

# `public_api_url`

```elixir
@spec public_api_url(t()) :: String.t()
```

Returns the versioned public base URL.

---

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