Authentication
The Poli Page Python 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.
API keys
Section titled “API keys”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.
Environments
Section titled “Environments”| 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).
Passing the key
Section titled “Passing the key”Pass the key to the client constructor, or let the SDK pick it up from POLI_PAGE_API_KEY:
import osfrom poli_page import PoliPage
# Explicit:client = PoliPage(api_key=os.environ["POLI_PAGE_API_KEY"])
# Implicit — same env var, fewer characters:client = PoliPage()If no key is provided either way, the constructor raises PoliPageError(code="invalid_options").
Example
Section titled “Example”import osfrom poli_page import PoliPage
client = PoliPage(api_key=os.environ["POLI_PAGE_API_KEY"])