Skip to content

Authentication

The Poli Page Ruby SDK authenticates every request with a bearer token. The key prefix determines which environment the request hits.

Pass the key to the client constructor:

client = PoliPage::Client.new(api_key: ENV.fetch("POLI_PAGE_API_KEY"))

The SDK never reads ENV["POLI_PAGE_API_KEY"] implicitly. You always pass the key in. #inspect and #to_s redact the key so it never leaks into logs or backtraces.

require "poli_page"
client = PoliPage::Client.new(api_key: ENV.fetch("POLI_PAGE_API_KEY"))