Skip to content

Authentication

The Poli Page Go SDK authenticates every request with a bearer token. An API key belongs to one environment of your organization, and its text names that environment.

Pass the key to NewClient via option.WithAPIKey:

client := polipage.NewClient(
option.WithAPIKey(os.Getenv("POLI_PAGE_API_KEY")),
)

The SDK never reads POLI_PAGE_API_KEY implicitly. You always pass the key in. It sends the key as is and never inspects or validates it.

A key is pp_{env}_ followed by 32 lowercase hex characters, where {env} is the environment’s name: 1-20 characters, lowercase letters, digits and single inner hyphens, starting with a letter. Standard and service keys share this format. A full key matches:

^pp_(?=[a-z][a-z0-9-]{0,19}_)[a-z][a-z0-9]*(?:-[a-z0-9]+)*_[0-9a-f]{32}$
EnvironmentKeyWatermarkCounted
sandbox (every org)pp_sandbox_…yesno
live (every org, deletable on Pro+)pp_live_…noyes
created on Pro+ (e.g. staging)pp_staging_…noyes

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

A render uses the project’s copy published in the key’s environment. Every key uses the same endpoint, https://api.poli.page.

package main
import (
"os"
"github.com/poli-page/sdk-go"
"github.com/poli-page/sdk-go/option"
)
func main() {
_ = polipage.NewClient(
option.WithAPIKey(os.Getenv("POLI_PAGE_API_KEY")),
)
}