401/api-keys, /subscription, /usage, /checkout/session, /subscription/change/preview, /subscription/change, /billing/portal, /playground/*

Invalid token

How to fix the Scrnpix API 401 error when the session JWT token is expired, malformed, or has an invalid signature.

When Does This Happen?

This error occurs when the session cookie contains a JWT that is expired, has been tampered with, or was signed with a different secret. This affects all JWT-protected endpoints including dashboard, billing, and playground routes. JWTs have a limited lifetime and must be refreshed by logging in again.

Reproduce This Error

curl -H "Cookie: session=expired.jwt.token" \
  "https://api.scrnpix.com/api-keys"
{"error": "Invalid token"}

How to Fix

  1. 1Log in again through the Scrnpix dashboard to get a fresh session token
  2. 2Clear your browser cookies and re-authenticate
  3. 3If using an HTTP client, update the session cookie value after re-login

Correct Request

curl -H "Cookie: session=valid-jwt-token" \
  "https://api.scrnpix.com/api-keys"
{"keys": [{"id": "...", "name": "Default", "keyPrefix": "sk_...", "isActive": true}]}

Related Errors

Frequently Asked Questions

How long do session tokens last?

Session tokens have a limited lifetime set by the server. When your token expires, you will need to log in again to get a new one. The exact duration depends on server configuration.

Still Having Issues?

Check your API key and subscription status in the dashboard, or explore our language guides for integration examples.

Go to Dashboard