Skip to content

Authentication

The Poli Page Ruby SDK authenticates every request with a bearer token. An API key belongs to exactly one environment of your organization, and the API renders the project’s copy published in that environment.

A key’s text names its environment: a key is pp_{env}_{32 lowercase hex}, matching

^pp_(?=[a-z][a-z0-9-]{0,19}_)[a-z][a-z0-9]*(?:-[a-z0-9]+)*_[0-9a-f]{32}$

Standard and service keys share this one format. The SDK passes the key through as-is and does not check its format; it never sends an environment either, because the API resolves it from the key.

| Environment | Key | Watermark | Counted | | ------------------------------------- | -------------- | --------- | ------- | | sandbox (every org) | pp_sandbox_… | yes | no | | live (every org, deletable on Pro+) | pp_live_… | no | yes | | created on Pro+ (e.g. staging) | pp_staging_… | no | yes |

“Counted” means the render counts toward the organization’s monthly PDF quota. sandbox renders are watermarked, are not counted, and their documents expire 30 days after creation. There is no watermark option: a template that wants a watermark outside sandbox uses the poli-watermark class.

Every key hits the same endpoint, https://api.poli.page by default or whatever you pass as base_url: (see Configuration).

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"))