Authentication

The CLI needs your live API key (rs_live_) for every command that calls the API. There are three ways to provide it. The --api-key flag overrides RS_API_KEY, and RS_API_KEY overrides the config file.

Option 1: Config File

Save your API key to the config file:

rs config set api_key rs_live_xxxxx
Set api_key

Your key is stored locally (file mode 0600) and used for all subsequent commands.

rs login also saves the key. It first validates the key with GET /v1/usage, which uses no credit, and fails with authentication failed if the key is not an active rs_live_ key. Like the other commands, rs login sends the request to RS_BASE_URL when that variable is set.

Option 2: Environment Variable

Set RS_API_KEY in your shell or CI/CD environment:

export RS_API_KEY=rs_live_xxxxx
rs take https://example.com

This overrides the config file and is ideal for CI/CD pipelines, Docker containers, and scripts. For a complete pipeline setup, see the rs CLI in CI.

CI/CD Examples

GitHub Actions:

- name: Take screenshot
  env:
    RS_API_KEY: ${{ secrets.RS_API_KEY }}
  run: rs take https://example.com --preset og_card -o screenshot.png

GitLab CI:

screenshot:
  script:
    - rs take https://example.com --preset og_card -o screenshot.png
  variables:
    RS_API_KEY: $RS_API_KEY

Option 3: Command Flag

Pass the key directly with --api-key:

rs take https://example.com --api-key rs_live_xxxxx

This overrides both the config file and environment variable. Useful for one-off commands or testing with a different key.

Signed URL Keys

To generate signed URLs, you also need your public key ID (rs_pub_) and secret key (rs_secret_). The secret key signs the URL; the public key ID goes in the URL. rs signed-url still needs an API key configured, because it creates an API client first.

rs config set public_key_id rs_pub_xxxxx
rs config set secret_key rs_secret_xxxxx

Or set them as environment variables (these override the config file):

export RS_API_KEY=rs_live_xxxxx
export RS_PUBLIC_KEY_ID=rs_pub_xxxxx
export RS_SECRET_KEY=rs_secret_xxxxx

View Current Configuration

rs config
api_key:       rs_live_****xxxx
public_key_id: rs_pub_xxxxx
secret_key:    rs_secret_****xxxx
path:          /Users/you/.config/renderscreenshot/config.json

You can also read and set individual values:

rs config get api_key              # Get a specific value (masked)
rs config set api_key rs_live_xxx  # Set a value

rs whoami prints your masked key and credit usage from GET /v1/usage.

Logout

Remove stored credentials:

rs logout
Credentials removed

rs logout deletes the config file. It does not unset RS_API_KEY, RS_PUBLIC_KEY_ID or RS_SECRET_KEY.

Config File Location

The config file is stored at:

OS Path
macOS / Linux ~/.config/renderscreenshot/config.json
Windows %APPDATA%\renderscreenshot\config.json

You can override this with the RS_CONFIG_PATH environment variable:

export RS_CONFIG_PATH=/path/to/config.json

Config File Format

{
  "api_key": "rs_live_xxxxx",
  "public_key_id": "rs_pub_xxxxx",
  "secret_key": "rs_secret_xxxxx"
}

Was this page helpful?