Sha256: 976c204e11a7acfdc38f2b8892d6a787d8f44293d107f6437ccfe563680b9f79

Contents?: true

Size: 748 Bytes

Versions: 9

Compression:

Stored size: 748 Bytes

Contents

# Authentication Example

When you sign up for an account, you are given an **API key**. You authenticate to
the [MailerLite][mailerlite] API by providing your API key in the request.
You can find your API key in page: Integrations ยป Developer API.

## Using variable

```ruby
client = MailerLite::Client.new(api_key: 'my-secret-api-key')
```

Example:

```ruby
client.groups
```

## Using global class config

Or create file under `config/initializers/mailerlite.rb`

```ruby
MailerLite.configure do |config|
  config.api_key = 'my-secret-api-key'
end
```

When you configured global settings in file, then you can request methods
on `MailerLite` class directly.

Example:

```ruby
MailerLite.groups
```

[mailerlite]: https://www.mailerlite.com

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mailerlite-1.16.1 examples/authentication.md
mailerlite-1.16.0 examples/authentication.md
mailerlite-1.15.0 examples/authentication.md
mailerlite-1.14.0 examples/authentication.md
mailerlite-1.13.1 examples/authentication.md
mailerlite-1.13.0 examples/authentication.md
mailerlite-1.12.0 examples/authentication.md
mailerlite-1.11.0 examples/authentication.md
mailerlite-1.10.0 examples/authentication.md