> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paubox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Rails SDK authentication

> Configure Paubox API credentials for the Rails SDK in an initializer backed by environment variables, plus Forms client setup and key security notes.

## Obtain your API key

The Email API requires one credential:

* **API key**: a secret token that authenticates your requests

It is available in the [Paubox dashboard](https://next.paubox.com) under **API Credentials**.

## Configure the initializer

Create `config/initializers/paubox.rb`:

```ruby theme={null}
Paubox.configure do |config|
  config.api_key = ENV['PAUBOX_API_KEY']
end
```

The gem registers itself as a Railtie, so this initializer runs before ActionMailer is configured. Credentials are automatically applied to every email delivery; no per-request setup is needed.

## Set environment variables

Add your API key to your environment (e.g. via a `.env` file with `dotenv-rails`, Rails credentials, or your deployment platform's secret management):

```bash theme={null}
PAUBOX_API_KEY=YOUR_API_KEY
```

## Forms client

`PauboxRails::Forms::Client` requires no credentials. Form submissions are associated with the form ID, not an API key.

```ruby theme={null}
client = PauboxRails::Forms.client
```

## Security notes

* Never hard-code credentials in initializer files; always read from environment variables or encrypted credentials.
* The gem does not log API keys or request bodies.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.