Sha256: 349f8d91af745f81c6c5f216c4ff5492132a40ef0c27e438f6fdd4b5692a9c5d

Contents?: true

Size: 733 Bytes

Versions: 5

Compression:

Stored size: 733 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.campaigns
```

## 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 in file, you can request methods on `MailerLite` class
directly.

Example:

```ruby
MailerLite.campaigns
```

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mailerlite-1.1.0 examples/authentication.md
mailerlite-1.0.2 examples/authentication.md
mailerlite-1.0.1 examples/authentication.md
mailerlite-1.0.0 examples/authentication.md
mailerlite-0.3.0 examples/authentication.md