Skip to main content
Chromiumly needs either a hosted API key or a self-hosted endpoint. Environment variables work in all runtimes (Node, Deno, Bun). On Node.js you can also use the config library or Chromiumly.configure().

Hosted API

When using the hosted API at https://api.chromiumly.dev, set your API key. You do not set GOTENBERG_ENDPOINT; the library uses the hosted URL automatically.

Environment variable

GOTENBERG_API_KEY=your-api-key

Code

import { Chromiumly } from "chromiumly";

Chromiumly.configure({
  apiKey: "your-api-key",
});

Self-hosted endpoint

When running Gotenberg yourself (e.g. via Docker), set the base URL of the Gotenberg API.

dotenv (environment)

GOTENBERG_ENDPOINT=http://localhost:3000

config library

{
  "gotenberg": {
    "endpoint": "http://localhost:3000"
  }
}

Code

import { Chromiumly } from "chromiumly";

Chromiumly.configure({ endpoint: "http://localhost:3000" });

Resolution order

The library resolves the endpoint as follows:
  1. If you called Chromiumly.configure() with endpoint or apiKey, that is used.
  2. Otherwise it reads from the environment (e.g. GOTENBERG_ENDPOINT, GOTENBERG_API_KEY) or from the config library.
  3. If an API key is set (and no endpoint), the endpoint becomes https://api.chromiumly.dev.
If neither an endpoint nor an API key is configured, conversion calls will throw when they try to resolve the endpoint.
For authentication (basic auth, custom headers), see Authentication.